facebookresearch / facebookresearch/detectron2

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

Open
#5,385 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.