-
Notifications
You must be signed in to change notification settings - Fork 382
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
[Fix] unify recognition dataset parts return signature #1041
[Fix] unify recognition dataset parts return signature #1041
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1041 +/- ##
=======================================
Coverage 94.93% 94.94%
=======================================
Files 135 135
Lines 5625 5633 +8
=======================================
+ Hits 5340 5348 +8
Misses 285 285
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Small comment though :)
|
||
# Check target | ||
if isinstance(target, dict): | ||
assert "boxes" in target, "Target should contain 'boxes' key" | ||
assert "labels" in target, "Target should contain 'labels' key" | ||
else: | ||
assert isinstance(target, str) or isinstance( | ||
target, np.ndarray | ||
), "Target should be a string or a numpy array" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering that the target is unchanged since the constructor was run, that should be moved to the constructor (because otherwise it increases data reading latency)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean to check it inside every dataset ? otherwise we have only access inside _read_sample and getitem !? And i don't think it changes the runtime noticeably
|
||
# Check target | ||
if isinstance(target, dict): | ||
assert "boxes" in target, "Target should contain 'boxes' key" | ||
assert "labels" in target, "Target should contain 'labels' key" | ||
else: | ||
assert isinstance(target, str) or isinstance( | ||
target, np.ndarray | ||
), "Target should be a string or a numpy array" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
This PR:
Hopefully that this is now a match to avoid mistakes for transformations
Closes:
#935