Mask_rcnn: KeyError during training with my own dataset

Created on 19 Feb 2019  路  2Comments  路  Source: matterport/Mask_RCNN

Good day, I am trying to follow the Color Splash Example via this blog post where I used my own class, which detects roofs in the image. I just replaced the balloon class with roof so the configuration has only 2 classes (including the background). I annotated my own images using VIA v.2.0.5. However during training, I am getting the following error:

Epoch 1/30 ERROR:root:Error processing image {'id': '0030_0040.png', 'source': 'roof', 'path': 'roxas-mask-rcnn/val/0030_0040.png', 'width': 255, 'height': 260, 'polygons': [{'name': 'polygon', 'all_points_x': [7, 42, 90, 14, 1, 1, 19], 'all_points_y': [107, 89, 175, 213, 186, 144, 135]}, {'name': 'polygon', 'all_points_x': [185, 231, 253, 254, 220], 'all_points_y': [142, 117, 157, 183, 202]}, {'name': 'polygon', 'all_points_x': [82, 119, 135, 92], 'all_points_y': [220, 202, 226, 250]}]} Traceback (most recent call last): File "/home/deankarlo/anaconda3/envs/tf-gpu/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1709, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/home/deankarlo/anaconda3/envs/tf-gpu/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1275, in load_image_gt source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]] KeyError: 'roof'

Why is it looking for a key named roof? Is it supposed to look for source instead? Any help is appreciated. Thank you!

Most helpful comment

Solved. The problem is just a misnaming of the class. Specifically:

class RoofDataset(utils.Dataset):

    def load_roof(self, dataset_dir, subset):
        """Load a subset of the Roof dataset.
        dataset_dir: Root directory of the dataset.
        subset: Subset to load: train or val
        """
        # Add classes. We have only one class to add.
        self.add_class("roof", 1, "roof") #this line has a mistake, class is misnamed

Thank you.

All 2 comments

Solved. The problem is just a misnaming of the class. Specifically:

class RoofDataset(utils.Dataset):

    def load_roof(self, dataset_dir, subset):
        """Load a subset of the Roof dataset.
        dataset_dir: Root directory of the dataset.
        subset: Subset to load: train or val
        """
        # Add classes. We have only one class to add.
        self.add_class("roof", 1, "roof") #this line has a mistake, class is misnamed

Thank you.

Thanks a lot cvKDean!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msson picture msson  路  4Comments

canerozer picture canerozer  路  3Comments

Mabinogiysk picture Mabinogiysk  路  3Comments

Mhaiyang picture Mhaiyang  路  4Comments

LifeBeyondExpectations picture LifeBeyondExpectations  路  4Comments