Object Detection API (issue)

I am using this colab file to run mask rcnn object detection model. Colab تشخیص شیء TensorFlow Hub

For visualization purposes it uses TensorFlow Object Detection API.

print('loading model...')
hub_model = hub.load(model_handle)
print('model loaded!')

# running inference
results = hub_model(image_np)

# different object detection models have additional results
# all of them are explained in the documentation
result = {key:value.numpy() for key,value in results.items()}
print(result.keys())

I don’t want to rely on object detection API. But I want to use models from thub. Now, how can I get instance wise segmentaiton mask for input image?

The results key above doesn’t have it. I’m expected to get instance mask as the following format.

(BATCH, HEIGHT, WITHD, DEPTH)

So, if a image contains 1 people, 2 dog, 1 cant, the shape would be

(1, HEIGHT, WIDTH, 4)

where, assume that,

1, HEIGHT, WITHD, 1 - for 1st people
1, HEIGHT, WITHD, 1 - for 2nd people
1, HEIGHT, WITHD, 1 - for 3rd people
1, HEIGHT, WITHD, 1 - for 4th people

But the results don’t give such formatted output.

result = {key:value.numpy() for key,value in results.items()}
print(result.keys())

for using that Mask RCNN, I’d suggest reading their visualisation method to have a better understanding on how they do the segmentation.

for something closer to what you are expecting, you might use a model for image segmentation like:
https://tfhub.dev/google/collections/deeplab-edgetpu/1

as far as I remember they have an output similar to what you are expecting

@lgusm Thanks for the suggestion. I’ve already visited those scirpts.

I am not using semantic segmentation and I need to use instance segmentation. The output of thub_mask_rccn model does give detection_mask output but it only gives cropped and resize version of intance mask. But I am expectin get location aware each mask channel.