fathomnet / fathomnet-py

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

How to generate COCO annotation file with different species and constraints #12

Closed mi2celis closed 2 years ago

mi2celis commented 2 years ago

I am trying to generate a COCO annotation file for species with the following constraints:

For Anoplopoma fimbria > 700 meters depth

For Gonatus onyx > 1000 meters depth

For Sebastes > 32 degrees latitude

For Sebastolobus > 38 degrees latitude

For Dosidicus gigas < 500 meters depth

For Nanomia bijuga: > 500 meters

I tried: fathomnet-generate -c "Anoplopoma fimbria" --min-depth 701 \ -c "Gonatus onyx" --min-depth 1001 \ -c "Nanomia bijuga" --min-depth 501 \ -c "Dosidicus gigas" --max-depth 500 \ -c "Sebastes" --min-latitude 32.1 \ -c "Sebastolobus" --min-latitude 38.1 \ --format coco -o out_of_region

This did not generate anything.

How can I do this? Do I need to generate each file separately? This may not be ideal since the id's would not be different for the different species.

Thanks again for your help.

mi2celis commented 2 years ago

I apologize for the bold font. I just pasted from my bash script and it had "#"

kevinsbarnard commented 2 years ago

Hi @mi2celis, you are correct, this would need to be done separately; the constraints you specify apply to all concepts you include. In other words, it's not currently possible to specify constraints per-concept. Per-concept constraints could be a feature we add in the future.

Alternatively, you could generate these sub-datasets in the VOC format, then combine the XMLs into one directory (though annotations for images in common would need to be composited). From there, a conversion from VOC to COCO can be done with another tool, e.g. https://github.com/yukkyo/voc2coco.