I am following the classic balloon example of Mask R-CNN. I trained the model with 2 classes, vehicle and bottle. Now the model perfectly detects both of the objects but It says vehicle (class_id=1) to all of them, where it would say all bottles are vehicle. I probably made some mistakes while configuring the code. Does anybody have an idea about this issue?

Changed the number of classes in the config.py (1 + nb classes) Added these classes in load_ in the custom dataset class

But I think I need to do one more thing and It is about here:

for a in annotations: # print(a) # Get the x, y coordinates of points of the polygons that make up # the outline of each object instance. There are stores in the # shape_attributes (see json format above) polygons = [r['shape_attributes'] for r in a['regions'].values()] # load_mask() needs the image size to convert polygons to masks. # Unfortunately, VIA doesn't include it in JSON, so we must read # the image. This is only managable since the dataset is tiny. image_path = os.path.join(dataset_dir, a['filename']) image = skimage.io.imread(image_path) height, width = image.shape[:2] self.add_image( "vehicle", ## for a single class just add the name here image_id=a['filename'], # use file name as a unique image id path=image_path, width=width, height=height, polygons=polygons)

I couldn't figure out what to change in here. Thank you for your time.