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

datum explore not available on datasets #1252

Closed
CourchesneA opened this issue Jan 27, 2024 · 3 comments
Closed

datum explore not available on datasets #1252

CourchesneA opened this issue Jan 27, 2024 · 3 comments
Assignees

Comments

@CourchesneA
Copy link

I was testing new functions available on the cli such as datum explore.

From the documentation,it looks like the command is available on datasets with the syntax:
datum explore -query-img-path <path/to/image> -topk 10 <path/to/dataset/>

However, when I do exactly this on my dataset, I get the following error:

Traceback (most recent call last):
  File "/home/me/.local/bin/datum", line 8, in <module>
    sys.exit(main())
  File "/home/me/.local/lib/python3.10/site-packages/datumaro/cli/__main__.py", line 150, in main
    retcode = args.command(args)
  File "/home/me/.local/lib/python3.10/site-packages/datumaro/util/scope.py", line 158, in wrapped_func
    ret_val = func(*args, **kwargs)
  File "/home/me/.local/lib/python3.10/site-packages/datumaro/cli/commands/explore.py", line 139, in explore_command
    build_tree = project.working_tree.clone()
AttributeError: 'NoneType' object has no attribute 'working_tree'
@sooahleex
Copy link
Contributor

Hi @CourchesneA , Thanks for your interest on our project and sorry for the late response.

Based on the command you posted, it seems that the issue arises when using 'explore' without having created your project. explore supports two CLI modes: ProjectCli and Cli. For ProjectCli, you need to set up a project first, while for Cli, it is not required.

If you want to use explore via the CLI, make sure to set a target. Refer to the CLI section of the documentation.

datum explore <target> --query-img-path QUERY_PATH -topk TOPK_NUM

If you are using ProjectCli, create a project and import a dataset before running the command, as demonstrated below. You can find further details in the documentation.

datum project create --output-dir <path/to/project>
datum project import --project <path/to/project> <path/to/data>
datum explore --query-img-path QUERY_PATH -topk TOPK_NUM -p <path/to/project>

If you have checked all the above and are still experiencing the issue, please let me know.

@CourchesneA
Copy link
Author

Based on the command you posted, it seems that the issue arises when using 'explore' without having created your project

That is correct, I am not using the project functionality of Datumaro, but I find the dataset manipulations tools really useful. I am trying to use the following syntax that you shared:
datum explore <target> --query-img-path QUERY_PATH -topk TOPK_NUM
but it leads me to the same error that I posted above. It looks like it is still looking for a project.

I was able to get it to work by commenting out those lines in the source code of datumaro:

# datumaro/cli/commands/explore.py:139

    #build_tree = project.working_tree.clone()
    #for target in targets:
    #   build_tree.build_targets.add_explore_stage(target, params=explorer_args)

    explorer = Explorer(*source_datasets)
    for dataset in source_datasets:
        dst_dir = dataset.data_path
        dataset.save(dst_dir, save_media=True, save_hashkey_meta=True)

    #if args.stage:
    #    project.working_tree.config.update(build_tree.config)
    #    project.working_tree.save()

@vinnamkim vinnamkim assigned sooahleex and unassigned vinnamkim Jan 31, 2024
sooahleex added a commit that referenced this issue Feb 20, 2024
@sooahleex
Copy link
Contributor

Hi @CourchesneA , Sorry for late response. I've incorporated your feedback through #1271 regarding the functionality of the explore command when it operates without a project. Now, you can execute the explore command as follows

datum explore explore_dataset --query-img-path ./explore_dataset/bird/ILSVRC2012_val_00001563.JPEG -topk 2

If you've tested the above steps and are still encountering the problem, please don't hesitate to inform me. Thank you!

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

No branches or pull requests

3 participants