facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.54k stars 7.49k forks source link

assert img.shape[:2] == (self.h, self.w) AssertionError #5385

Open Raneem-MT opened 2 weeks ago

Raneem-MT commented 2 weeks ago

I am evaluating MaskDINO, which uses detectron2. I have seen a similar issue, saying this error can be caused by mismatched sizes between the masks and images, but I checked that the sizes match. I evaluated other datasets with no problem, but I ran into issues with this one. I pre-processed the images the same way and checked that the sized made sense. I printed out the shapes but cannot trace back where exactly this shape issue occurred. This is the full error message:

AssertionError: Caught AssertionError in DataLoader worker process 0. Original Traceback (most recent call last): File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/torch/util s/data/_utils/worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/torch/util s/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/torch/util s/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/common.py", line 90, in getitem data = self._map_func(self._dataset[cur_idx]) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/dataset_mapper.py", line 164, in call transforms = self.augmentations(aug_input) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/transforms/augmentation.py", line 264, in call tfm = x(aug_input) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/transforms/augmentation.py", line 170, in call aug_input.transform(tfm) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/transforms/augmentation.py", line 339, in transform self.sem_seg = tfm.apply_segmentation(self.sem_seg) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/transforms/transform.py", line 155, in apply_segmentation segmentation = self.apply_image(segmentation, interp=Image.NEAREST) File "/jmain02/home/J2AD014/mtc11/rxt49-mtc11/.conda/envs/maskdino/lib/python3.8/site-packages/detectron2 /data/transforms/transform.py", line 113, in apply_image assert img.shape[:2] == (self.h, self.w) AssertionError

Has anyone solved this?

github-actions[bot] commented 2 weeks ago

We found that not enough information is provided about this issue. Please provide details following the issue template.