fathomnet / fathomnet-py

FathomNet Python client
https://fathomnet-py.readthedocs.io
MIT License
28 stars 3 forks source link

Example and help for fathomnet-generate #6

Closed mi2celis closed 2 years ago

mi2celis commented 2 years ago

I am trying to use fathomnet-generate. It requires arguments. An example and/or "--help" would be very useful.

I am trying to download some images and bounding boxes for training with YOLOv5. Let's say I want the images and bounding boxes for Plesionika sp. A. How would I use fathomnet-generate to do this? Want the bounding boxes in coco format.

I have followed the example provided in https://medium.com/fathomnet/how-to-download-images-and-bounding-boxes-from-fathomnet-using-python-283ff32c975f to download the images and bounding boxes. This example uses VOC format, but I would like to have the bounding boxes annotations in coco format.

mi2celis commented 2 years ago

I just figured out fathomnet-generate does not work with python 3.6.9, it gives the error:

Traceback (most recent call last): .... AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'

Needs python 3.7 or newer. Then I get the usage message.

Some examples would still really help.

hohonuuli commented 2 years ago

@mi2celis Thanks for posting the issue.

@kevinsbarnard I confirmed that fromisoformat was introduced in python 3.7. Would you update the medium article?

kevinsbarnard commented 2 years ago

@mi2celis Thanks! Documentation will be added for fathomnet-generate per #5. The --help flag is available and may help in the meantime. To your question, try:

fathomnet-generate -c "Plesionika sp. A" --format coco -o Plesionika_sp_A

@hohonuuli I've updated the Medium article. Python 3.7 will also be required at install as of v0.3.0.

mi2celis commented 2 years ago

Thank you for your quick response. I also want to download the Plesionika sp. A images. Can I do it with fathomnet-generate?

kevinsbarnard commented 2 years ago

Not currently, though an option to download images may be added in the future. The image URLs are saved in the resulting Plesionika_sp_A/dataset.json file (as generated by the command before) in the flickr_url and coco_url fields.

For example, with grep and wget, you could do something like:

cd Plesionika_sp_A/
grep -Po '"flickr_url": "\K[^"]*' dataset.json | sort | uniq | xargs wget