Describe the bug
Augmentations do not work when loading the VOC dataset using the VOCMaskParser class. When a record has more than one instance of the same class, the VOCMaskParser does not create a separate mask for each instance. In the example code below, the code fails when it tries to display a record where there are multiple cat instances in the image. I think the problem is in icevision/core/mask.py:
# Imports
from icevision.all import *
import icedata
# Load the Pascal VOC dataset
path = icedata.voc.load_data()
# Get the class_map, a utility that maps from number IDs to classs names
class_map = icedata.voc.class_map()
parser = parsers.VOCMaskParser(
annotations_dir='path/to/voc/Annotations',
images_dir='path/to/voc/JPEGImages',
masks_dir='path/to/voc/SegmentationClass',
)
# Parse data
train_records, _ = parser.parse(data_splitter=None)
# Transformations
train_tfms = tfms.A.Adapter([*tfms.A.resize_and_pad(size=1024), tfms.A.Normalize()])
# Datasets
train_ds = Dataset(train_records, train_tfms)
# Get indices of records where there are more than one instance of the same class
bad_records_idx = [idx for idx, r in enumerate(train_ds.records) if len(r.detection.labels) != len(set(r.detection.labels))]
idx = bad_records_idx[0]
print(train_ds.records[idx])
plt.imshow(Image.open(train_ds.records[idx].common.filepath))
show_samples([train_ds[idx]])
š Bug
Describe the bug Augmentations do not work when loading the VOC dataset using the
VOCMaskParser
class. When a record has more than one instance of the same class, theVOCMaskParser
does not create a separate mask for each instance. In the example code below, the code fails when it tries to display a record where there are multiplecat
instances in the image. I think the problem is inicevision/core/mask.py
:To Reproduce
Steps to reproduce the behavior:
Output:
Expected behavior It should show an image of the record with an overlay of the mask and bbox with the specified augmentations.
Environment: