-
Notifications
You must be signed in to change notification settings - Fork 133
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
Bugfix for explore cli test to get datasetitem through path #1092
Bugfix for explore cli test to get datasetitem through path #1092
Conversation
81d96f7
to
2d9a41d
Compare
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.
I recommend you to break the query explicitly into two cases:
- DatasetItem id (
--query-item-id
) - Arbitrary image file path (not constrained to the project or dataset) (
--query-img-path
)
995f746
to
b809bdc
Compare
src/datumaro/components/algorithms/hash_key_inference/hashkey_util.py
Outdated
Show resolved
Hide resolved
def match_query_subset(query_id, dataset): | ||
subset_names = list(dataset.subsets().keys()) | ||
for subset_name in subset_names: | ||
try: | ||
query_datasetitem = dataset.get(query_id, subset_name) | ||
except Exception: | ||
continue | ||
if query_datasetitem: | ||
break | ||
return query_datasetitem |
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.
Please add subset = None
argument to this function and CLI argument parser. Then, iterate over subsets only if subset == None
. In addition, I think this code should have a problem if there is no item for the given query_id
. You need to raise an appropriate error in this case.
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.
LGTM.
Co-authored-by: Vinnam Kim <[email protected]>
Summary
train_path
not matched withdataset._source_path
,query
is considered asstring
input, not coverted toDatasetitem
or could not bring the properDatasetitem
which is matched withpath
throughdataset.get_datasetitem_by_path(args.query)
.train_path
of CLI path as `project/source-1/images/train/1.jpg'.How to test
Checklist
License
Feel free to contact the maintainers if that's a concern.