Search code examples
pythontensorflowmask

How to use Instance segmentation pretrained MaskRCNN model by Tensorflow?


Tensorflow recently seems to have released pretrained model for instance segmentation using MaskRCNN as per below tweet.

https://twitter.com/TensorFlow/status/963472849511092225

I downloaded mask_rcnn_resnet101_atrous_coco_2018_01_28.tar.gz from this and was trying to figure out how to use it.I found frozen model (pb) file and loaded the graph in Tensorboard.

But I cant figure out what should be the input for the model.I couldn't find a node where simply I can input an image , though I was able to locate nodes where we get classes,masks,bounding boxes etc.

Also there seems to be no details online on how to use it (May be because it is new)


Solution

  • If you follow this tensorflow tutorial it will show you how to run the frozen model on a single/group of images. To apply this to the model you downloaded, the simplest way would be to first replace the line:

    PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'

    with a path to your downloaded model i.e.

    PATH_TO_CKPT = '/absolute/path/to/frozen_inference_graph.pb'

    Then there is no need to run the code under the section Download Model. The rest should work the same.