Dec 11, 2020
Using this modified code below
import pixellib
from pixellib.instance import custom_segmentation
segment_image = custom_segmentation()
segment_image.inferConfig(num_classes= 2, class_names= ["BG", "butterfly", "squirrel"])
segment_image.load_model("mask_rcnn_model/Nature_model_resnet101.h5)
segmask, output = segment_image.segmentImage("sample1.jpg", show_bboxes=True, output_image_name="sample_out.jpg")
you will obtain the following details;
- Each object’s segmentation mask
- Each object’s bounding box coordinate
- Each object’s corresponding class id
You can then manipulate the mask values obtained above to get the segmentation masks’ boundary.