Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty box in image #40

Closed
ghost opened this issue Sep 14, 2021 · 3 comments
Closed

empty box in image #40

ghost opened this issue Sep 14, 2021 · 3 comments
Labels
individual Individual problem and need

Comments

@ghost
Copy link

ghost commented Sep 14, 2021

Hello!

I try to run experiments on my custom dataset, but the following error has occurred in here
IndexError: index 0 is out of bounds for dimension 0 with size 0

In my dataset there are images without bbox annotation, which cause the above error.
i.e., y_loc_img[0] = tensor([], device='cuda:0', size=(0, 4)) for images without bbox annotation.

What does the condition mean y_loc_img[0][0][0] < 0?

@yuantn
Copy link
Owner

yuantn commented Sep 15, 2021

Hello!

MI-AOD needs to add any bounding box to each image in the unlabeled set (the positioning is not required to be accurate). For details, please refer to Question 3 in the Custom Modifications part of FAQ and the corresponding Issue.

The condition y_loc_img[0][0][0] < 0 means that the current data batch is an unlabeled data batch, because we have set all coordinates of the bounding boxes to -1 for the unlabeled data in Lines 70-74 in epoch_based_runner.py (as described in Question 7 in the Training and Test part of FAQ and the corresponding Issues).

@yuantn yuantn added the individual Individual problem and need label Sep 15, 2021
@ghost
Copy link
Author

ghost commented Sep 17, 2021

The answer to question 3 in the Custom Modifications part of FAQ is a bit uncomfortable.
The answer is only related to the condition y_loc_img[0][0][0] < 0?
If then, What if we do it this way??

  1. Add below method to epoch_based_runner.py:
def _add_dataset_flag(self, X, is_unlabeled):
    or _img_meta in X['img_metas'].data[0]:
     _img_meta.update({'is_unlabeled': is_unlabeled})

and add these codes
self._add_dataset_flag(X_L, is_unlabeled=False) to line 31 in epoch_based_runner.py
self._add_dataset_flag(X_L, is_unlabeled=False) to line 60 in epoch_based_runner.py
self._add_dataset_flag(X_U, is_unlabeled=True) to line 79 in epoch_based_runner.py

  1. Replace y_loc_img[0][0][0] < 0 with img_metas[0]['is_unlabeled'] in MIAOD_head.py (e.g., 479 and 565 line)

@yuantn
Copy link
Owner

yuantn commented Sep 18, 2021

The code you provided is a good alternative.
It has the same effect as the original code, both for marking and judging unlabeled data.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
individual Individual problem and need
Projects
None yet
Development

No branches or pull requests

1 participant