Rectlabel-support
Rectlabel-support copied to clipboard
Key Error showing up in training
Today I noticed that if I try to export a coco json file, the files that are created have a KeyError: 'segmentation' issue
This is the traceback I'm seeing
Original Traceback (most recent call last):
File "/home/src/model_training/detectron-training/venv/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
File "/home/src/model_training/detectron-training/venv/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 32, in fetch
data.append(next(self.dataset_iter))
File "/home/src/model_training/detectron-training/detectron2/detectron2/data/common.py", line 296, in iter
yield self.dataset[idx]
File "/home/src/model_training/detectron-training/detectron2/detectron2/data/common.py", line 125, in getitem
data = self._map_func(self._dataset[cur_idx])
File "/home/src/model_training/detectron-training/detectron2/detectron2/utils/serialize.py", line 26, in call
return self._obj(*args, **kwargs)
File "/home/src/model_training/detectron-training/detectron2/detectron2/data/dataset_mapper.py", line 189, in call
self._transform_annotations(dataset_dict, transforms, image_shape)
File "/home/src/model_training/detectron-training/detectron2/detectron2/data/dataset_mapper.py", line 131, in _transform_annotations
instances = utils.annotations_to_instances(
File "/home/src/model_training/detectron-training/detectron2/detectron2/data/detection_utils.py", line 413, in annotations_to_instances
segms = [obj["segmentation"] for obj in annos]
File "/home/src/model_training/detectron-training/detectron2/detectron2/data/detection_utils.py", line 413, in
it seems to happen after I change the name of any object
Thanks for writing the issue.
It looks that "segmentation" is not written in the COCO format because of some reason. We have to reproduce the problem.
Changing the name of any object, this means that on the label dialog, you select another existing object name or add a new object name? After that, exporting to COCO format, the COCO format will be different from the one before changing the object name, such as "segmentation" is missing.
Recently we wrote tutorials how to train Detectron2 models on Ubuntu 22.04 with GPU.
Train bounding boxes using a Faster R-CNN model on Detectron2 Train polygons using a Mask R-CNN model on Detectron2 Train RLE masks using a Mask R-CNN model on Detectron2 Train keypoints using a Keypoint R-CNN model on Detectron2
We trained tens of times on Detectron2 with GPU, but could not encounter the problem. Currently If you need our support to fix this problem, please let us know.