icevision icon indicating copy to clipboard operation
icevision copied to clipboard

negative samples are not implemented for mmdet models

Open rbavery opened this issue 3 years ago • 1 comments

🐛 Bug

Describe the bug Negative samples still needs to be implemented. This error might appear due to cropping, please check your transformations.

To Reproduce train a model with

model_type = models.mmdet.mask_rcnn
backbone = model_type.backbones.mask_rcnn_swin_t_p4_w7_fpn_1x_coco

and use a dataloader containing negative samples

Expected behavior Negative samples are supported, but the clear error is appreciated.

Additional context full traceback

RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/root/work/.ice-env/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/root/work/.ice-env/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 39, in fetch
    data = next(self.dataset_iter)
  File "/root/work/.ice-env/lib/python3.9/site-packages/fastai/data/load.py", line 136, in create_batches
    yield from map(self.do_batch, self.chunkify(res))
  File "/root/work/.ice-env/lib/python3.9/site-packages/fastai/data/load.py", line 166, in do_batch
    def do_batch(self, b): return self.retain(self.create_batch(self.before_batch(b)), b)
  File "/root/icevision/icevision/engines/fastai/adapters/convert_dataloader_to_fastai.py", line 18, in create_batch
    return (dataloader.collate_fn, raise_error_convert)[self.prebatched](b)
  File "/root/icevision/icevision/models/utils.py", line 88, in inner
    tupled_output, records = build_batch(records)
  File "/root/icevision/icevision/models/utils.py", line 79, in inner
    return build_batch(records, **build_batch_kwargs)
  File "/root/icevision/icevision/models/mmdet/common/mask/dataloaders.py", line 63, in build_valid_batch
    return build_train_batch(records=records)
  File "/root/icevision/icevision/models/mmdet/common/mask/dataloaders.py", line 75, in build_train_batch
    masks.append(_masks(record))
  File "/root/icevision/icevision/models/mmdet/common/mask/dataloaders.py", line 110, in _masks
    raise RuntimeError(
RuntimeError: Negative samples still needs to be implemented. This error might appear due to cropping, please check your transformations.

rbavery avatar Jul 13 '22 00:07 rbavery

Dear @rbavery,

I just came across the same bug. Did you find a solution to this to this issue? I tried introducing small background boxes and masks but this hack causes problems at later stages of the pipeline.

With kind regards, Christian

ChristianMarzahl avatar Aug 30 '22 12:08 ChristianMarzahl