Closed qianzhang2018 closed 5 years ago
@qianzhang2018 We don't need mask annotations. You can remove this line https://github.com/tianzhi0549/FCOS/blob/928c610dbae256242a2514fe212f9b10cc6fe0fc/maskrcnn_benchmark/data/datasets/coco.py#L84 to avoid the error.
@tianzhi0549 it works.Thanks,it is very kind of you.
In my case, line 83 and 84 both need to be removed to avoid this error:
masks = SegmentationMask(masks, img.size, mode='poly')
target.add_field("masks", masks)
@tianzhi0549 Why only some users will encounter this problem?
@imyhxy It might be related to their torchvision version.
@tianzhi0549 I am training CenterMask and got this error, weired. And I do need mask annotation.
Traceback (most recent call last): File "tools/train_net.py", line 176, in
main()
File "tools/train_net.py", line 169, in main
model = train(cfg, args.local_rank, args.distributed)
File "tools/train_net.py", line 75, in train
arguments,
File "/home/administrator/USPIntern/zq/FCOS/maskrcnn_benchmark/engine/trainer.py", line 56, in dotrain
for iteration, (images, targets, ) in enumerate(data_loader, start_iter):
File "/home/administrator/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next
return self._process_next_batch(batch)
File "/home/administrator/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
IndexError: Traceback (most recent call last):
File "/home/administrator/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/administrator/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/administrator/.local/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 81, in getitem
return self.datasets[dataset_idx][sample_idx]
File "/home/administrator/USPIntern/zq/FCOS/maskrcnn_benchmark/data/datasets/coco.py", line 107, in getitem
target = target.clip_to_image(remove_empty=True)
File "/home/administrator/USPIntern/zq/FCOS/maskrcnn_benchmark/structures/bounding_box.py", line 223, in clip_to_image
return self[keep]
File "/home/administrator/USPIntern/zq/FCOS/maskrcnn_benchmark/structures/bounding_box.py", line 208, in getitem
bbox.add_field(k, v[item])
File "/home/administrator/USPIntern/zq/FCOS/maskrcnn_benchmark/structures/segmentation_mask.py", line 513, in getitem
selected_instances = self.instances.getitem(item)
File "/home/administrator/USPIntern/zq/FCOS/maskrcnn_benchmark/structures/segmentation_mask.py", line 422, in getitem
selected_polygons.append(self.polygons[i])
IndexError: list index out of range
can you help me ?