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.

Problem with empty bounding box

See original GitHub issue

🐛 Bug

Sometimes during the training procedure I get: ValueError: Expected target boxes to be a tensorof shape [N, 4], got torch.Size([0]). It is caused by the transformation: train_tfms = tfms.A.Adapter([*tfms.A.aug_tfms(size=size, presize=presize), tfms.A.Normalize()]). Sometimes tfms is for “aggressive” that it moves the image in such a way that no bbox is left. It crashes the training procedure

To Reproduce Steps to reproduce the behavior:

  1. Create the dataset, Wheat is fine for this
  2. Apply tfms such as: train_tfms = tfms.A.Adapter([*tfms.A.aug_tfms(size=size, presize=presize), tfms.A.Normalize()])
  3. Set faster_rcnn as model
  4. Run pytorch lightning training
  5. At some random (since aug_tfms is random) point the training will crash.

Expected behavior The training shouldn’t crash, such step should be handled by the training_step/validation_step in the lightning_module or at the model level

Desktop (please complete the following information): Happens both at kaggle notebooks and at colab

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
tugot17commented, Aug 16, 2020

In Wheat dataset it is a case for img with imageid = 2507 (See attached screen). It is rare for this dataset but happens and crashes training.

You can find such situation in your dataset by runnign simple loop


idx_list = []

for idx, x in enumerate(tqdm(train_ds)):
    if not len(x["bboxes"]):
        idx_list.append(idx)
        print(idx)

If not at first time, then try a few times more (since crop is random)

You can chceck out my notebook, hope it helps you reproduce the error

Screenshot from 2020-08-16 17-44-30

0reactions
tugot17commented, Aug 22, 2020

Yeah solved 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bounding Box Not Drawn/Some Variables Are Empty
Even though you have loaded and trained on the data without error, the reason your bounding box shows empty is because during testing...
Read more >
Problem with empty bounding box · Issue #328
In Wheat dataset it is a case for img with imageid = 2507 (See attached screen). It is rare for this dataset but...
Read more >
BoundingBox empty when creating a new level
When you are creating new views the section box bounding box doesn't exist so new bounding box with correctly ordered max/min can be...
Read more >
Unwanted bounding box - Illustrator
I have an empty bounding box on my screen that attaches itself to any object/layer I choose. It won't delete and it doesn't...
Read more >
google vision API returns empty bounding box vertexes ...
why the vertices structure is empty? I am following this article, and the author there uses vertices , but I don't understand why...
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