Skip to content

fix a small bug#908

Merged
sshaoshuai merged 1 commit intoopen-mmlab:masterfrom
Yzichen:yzc
Mar 29, 2022
Merged

fix a small bug#908
sshaoshuai merged 1 commit intoopen-mmlab:masterfrom
Yzichen:yzc

Conversation

@Yzichen
Copy link
Contributor

@Yzichen Yzichen commented Mar 26, 2022

If k>0 is used as the condition, cur_gt.shape[0] will always be greater than 0. For some scenes without targets, cur_gt will be a zero tensor with shape (1, 8), which affects recall_dict['gt'], As a result, it affects the calculation of recall.

@sshaoshuai
Copy link
Collaborator

Thanks for the PR!

Yes, you are right. The first part is a small error.

In the second part of your PR, I require cur_gt.shape[0] > 0 to avoid some unnecessary errors since some codes in the repo may require each scene has at least one GT, or it will cause some errors.
For example, the line 96 will still fake a zero GT in line 96 to avoid the error in the target assigning process:

k = cur_gt.__len__() - 1
while k >= 0 and cur_gt[k].sum() == 0:
k -= 1
cur_gt = cur_gt[:k + 1]
cur_gt = cur_gt.new_zeros((1, cur_gt.shape[1])) if len(cur_gt) == 0 else cur_gt

Nevertheless, thanks for your PR and I will accept it.

@sshaoshuai sshaoshuai merged commit fd20aab into open-mmlab:master Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants