image-segmentation-auto-labels icon indicating copy to clipboard operation
image-segmentation-auto-labels copied to clipboard

A service to auto-generate masks for image segmentation

image-segmentation-auto-labels

CI status Docker status

What's this?

This repository contains a Python application that can be used to quickly generate labelled data for image segmentation tasks. The application can be run as a web service or command line tool and supports a number of algorithms to generate candidate image masks.

More detail on the approaches implemented in this repository is available in the companion Azure Notebook: Using Otsu's method to pre-label training data for image segmentation.

Usage

As a web service

Pull and run the auto-labelling service via docker:

docker run -p 8080:80 cwolff/image_segmentation_auto_labels

This will start the auto-labelling service on port 8080. There are two main routes in the service:

# fetch a list of supported image masking algorithms
curl 'http://localhost:8080/algorithms'

# generate a mask for an image using the provided masking algorithm
curl 'http://localhost:8080/mask' -H 'Content-Type: application/json' -d '
{
  "image_path": "/data/test_image.jpg",
  "algorithm": "otsu_hue",
  "morph": 0
}'

You can use the test page to interactively experiment with the service.

Screenshot of auto-labelling service test page

As a command line tool

Pull and run the auto-labelling tool via docker:

# fetch a list of supported image masking algorithms
docker run cwolff/image_segmentation_auto_labels /do list_algorithms

# generate a mask for an image using the provided masking algorithm
docker run cwolff/image_segmentation_auto_labels /do create_mask "/data/test_image.jpg" "otsu_hue" "0"