Image Segmenter

Get this modelTry the API Try the web app Try in a Node-RED flow

Overview

This model takes an image file as an input and returns a segmentation map containing a predicted class for each pixel in the input image.

This repository contains 2 models trained on PASCAL VOC 2012. One model is trained using the xception architecture and produces very accurate results but takes a few seconds to run and the other model is trained on MobileNetV2 and is faster but less accurate. You can specify which model you wish to use when you start the Docker image. See below for more details.

The segmentation map returns an integer between 0 and 20 that corresponds to one of the labels below for each pixel in the input image. The first nested array corresponds to the top row of pixels in the image and the first element in that array corresponds to the pixel at the top left hand corner of the image. NOTE: the image will be resized and the segmentation map refers to pixels in the resized image, not the original input image.

Model Metadata

Domain Application Industry Framework Training Data Input Data Format
Image & Video Semantic image segmentation Multi Tensorflow VOC2012 ~10k images Image file

References

Licenses

Component License Link
Model GitHub Repository Apache 2.0 LICENSE
Model Code (3rd party) Apache 2.0 TensorFlow Models Repository
Model Weights Apache 2.0 TensorFlow Models Repository
Test Assets Apache 2.0 Asset README

Options available for deploying this model

  • Deploy from Dockerhub:
docker run -it -p 5000:5000 codait/max-image-segmenter
  • Deploy on Kuberneters:
kubectl apply -f https://raw.githubusercontent.com/IBM/MAX-Image-Segmenter/master/max-image-segmenter.yaml

Example Usage

You can test or use this model

Test the model using cURL

Once deployed, you can test the model from the command line. For example if running locally:

curl -F "image=@assets/stc.jpg" -XPOST http://localhost:5000/model/predict
{
  "status": "ok",
  "image_size": [
    256,
    128
  ],
  "seg_map": [
    [
      0,
      0,
      0,
      ...,
      15,
      15,
      15,
      ...,
      0,
      0,
      0
    ],
    ...,
    [
      0,
      0,
      0,
      ...,
      15,
      15,
      15,
      ...,
      0,
      0,
      0
    ]
  ]
}

Test the model in a Node-RED flow

Complete the node-red-contrib-model-asset-exchange module setup instructions and import the image-segmenter getting started flow.