Ayoola Olafenwa
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;

  1. Each object’s segmentation mask
  2. Each object’s bounding box coordinate
  3. Each object’s corresponding class id

You can then manipulate the mask values obtained above to get the segmentation masks’ boundary.

--

--

Ayoola Olafenwa
Ayoola Olafenwa

No responses yet