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.

Question about pad_shape

See original GitHub issue

I make a custom datasets and put it into train ,but I got error as following:

Traceback (most recent call last):
  File "/home/siting/files/DingGuo/mmdetection/tools/train.py", line 90, in <module>
    main()
  File "/home/siting/files/DingGuo/mmdetection/tools/train.py", line 86, in main
    logger=logger)
  File "/home/siting/files/DingGuo/mmdetection/mmdet/apis/train.py", line 59, in train_detector
    _non_dist_train(model, dataset, cfg, validate=validate)
  File "/home/siting/files/DingGuo/mmdetection/mmdet/apis/train.py", line 121, in _non_dist_train
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/mmcv/runner/runner.py", line 355, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/mmcv/runner/runner.py", line 257, in train
    for i, data_batch in enumerate(data_loader):
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 513, in __next__
    return self._process_next_batch(batch)
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 534, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/siting/files/DingGuo/mmdetection/mmdet/datasets/custom.py", line 169, in __getitem__
    data = self.prepare_train_img(idx)
  File "/home/siting/files/DingGuo/mmdetection/mmdet/datasets/custom.py", line 240, in prepare_train_img
    scale_factor, flip)
  File "/home/siting/files/DingGuo/mmdetection/mmdet/datasets/transforms.py", line 109, in __call__
    mmcv.impad(mask, pad_shape[:2], pad_val=0) for mask in masks
  File "/home/siting/files/DingGuo/mmdetection/mmdet/datasets/transforms.py", line 109, in <listcomp>
    mmcv.impad(mask, pad_shape[:2], pad_val=0) for mask in masks
  File "/home/siting/.conda/envs/maskrcnn_benchmark/lib/python3.7/site-packages/mmcv/image/transforms/geometry.py", line 186, in impad
    pad[:img.shape[0], :img.shape[1], ...] = img
ValueError: could not broadcast input array from shape (1094,1604) into shape (1094,1600)

Actually, I put my dataset into detectron or maskbenchmark and it works well, but it doesn’t work here. I think it’s the problem in mask_pad

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jichilencommented, Apr 13, 2019

Maybe you have an image with the shape(A,B,3), but in your annotation it has the shape of (B,A,3)

1reaction
jichilencommented, Apr 13, 2019

This maybe a problem about mmcv.imread(), in which cv2.imread() is used. In some situation, the image is taken by ceilphones and a rotation angle is saved in the image. However the image will not be rotated when using cv2.imread(). But when annotating a image, the rotated image is used. So you may change img = mmcv.imread(osp.join(self.img_prefix, img_info['filename'])) to img = np.array(Image.open(osp.join(self.img_prefix, img_info['filename'])).convert("RGB")) img = img[...,::-1] in custom.py maybe this will help you

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is The Right Pad Shape to use in PCB Footprints?
What pad shape do you think is the right one for footprints - Oblong, Rectangular or Rounded corners? I asked Tom HausherrYou can...
Read more >
Problems with custom pad shape... - PCB Design
My attemt at a package symbol is SW-solder-2mm.dra/psm. Your symbol looks "functional" - but I suspect it actually has the same problem as...
Read more >
How do I create a custom pad shape? - Altium CircuitStudio
I'm trying to create a custom pad shape in the PCB footprint library editor. ... If you have a question you can start...
Read more >
Working with Custom Pad Shapes in Altium Designer
To create a custom shape pad by converting regions: Place one or more overlapping regions defining the custom pad shape in the design...
Read more >
Rounded Rectangle Pad Shape For SON & QFN - PCB Libraries
However, that makes no difference to your question. We'll add Rounded Rectangle pad shape option to SON/QFN packages in an upcoming release ...
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