question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sizeMismatch error

See original GitHub issue

when i use custom data to run a official demo, i got sizeMisMatch error, I annotate my data with rectlabel, and export to coco json data.

ERROR [02/13 14:51:15 d2.engine.train_loop]: Exception during training:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/detectron2/engine/train_loop.py", line 132, in train
    self.run_step()
  File "/usr/local/lib/python3.6/dist-packages/detectron2/engine/train_loop.py", line 208, in run_step
    data = next(self._data_loader_iter)
  File "/usr/local/lib/python3.6/dist-packages/detectron2/data/common.py", line 109, in __iter__
    for d in self.dataset:
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 345, in __next__
    data = self._next_data()
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 838, in _next_data
    return self._process_data(data)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 881, in _process_data
    data.reraise()
  File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 394, in reraise
    raise self.exc_type(msg)
detectron2.data.detection_utils.SizeMismatchError: Caught SizeMismatchError in DataLoader worker process 1.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.6/dist-packages/detectron2/data/common.py", line 39, in __getitem__
    data = self._map_func(self._dataset[cur_idx])
  File "/usr/local/lib/python3.6/dist-packages/detectron2/utils/serialize.py", line 23, in __call__
    return self._obj(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/detectron2/data/dataset_mapper.py", line 76, in __call__
    utils.check_image_size(dataset_dict, image)
  File "/usr/local/lib/python3.6/dist-packages/detectron2/data/detection_utils.py", line 87, in check_image_size
    expected_wh,
detectron2.data.detection_utils.SizeMismatchError: Mismatched (W,H) for image /content/data/Images/130.jpg, got (3264, 2448), expect (2448, 3264)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
ppwwyyxxcommented, Feb 13, 2020

We use Pillow to read the image: https://github.com/facebookresearch/detectron2/blob/e41931e3087737d4c22de077b4437a8e9ec25921/detectron2/data/detection_utils.py#L49-L55 and transpose it (flip its x and y) if it has rotation flag.

So the error you’re seeing means either of the two:

  1. your annotation is wrong. The image has rotation information but not in the annotation
  2. Pillow is wrong. In which case you should find the image and report to Pillow.
0reactions
zlszhonglongshencommented, May 15, 2020

你用的什么标注工具呀,我试试

new.json.txt

这是我的json文件,你看下

Read more comments on GitHub >

github_iconTop Results From Across the Web

HP Printers - Paper Mismatch error (Windows, Mac)
1. In the program you are trying to print from, click File, and then click Print. 2. Make sure your printer is selected,...
Read more >
Paper Size Mismatch error. I have the correct size paper sel...
Randomly while printing I get the Paper Size Mismatch error. The print job is formatted for paper size that is different from what...
Read more >
How to handle “Paper Size Mismatch” errors on library printers
The printer will beep, and display will read “paper size mismatch”. To handle this problem and print your pages, follow these steps: 1....
Read more >
How do I clear the message 'Size Mismatch'? - Brother
The message 'Size Mismatch' will appear if the paper loaded in the paper tray is smaller than letter size (8.5 x 11 inches)...
Read more >
Fix Paper Mismatch Errors in Windows for HP Printers
... the paper tray 00:37 Select the right paper size on Windows 01:27 ... If you notice a paper mismatch error after loading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found