agentmorris / MegaDetector

MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
MIT License
103 stars 24 forks source link

Capture image date/time (Possible enhancmenet) #89

Closed agentmorris closed 1 year ago

agentmorris commented 1 year ago

I was just wondering if there's any kind of flag when running the batch detector to include the image date and time (the date/time the image was taken) as part of the JSON output? I looked quickly and didn't see anything that seemed to do that.

If something like that does not exist, then I would like to ask it be considered as an enhancement also making sure that date/time information is copied as part of convert_output_format.py. Our researcher here, and I could imagine other researchers, finds this information very helpful as they do various analyses as part of their post-processing procedures.


Issue cloned from Microsoft/CameraTraps, original issue posted by aweaver1fandm on Mar 30, 2023.

agentmorris commented 1 year ago

We don't do this right now, but you're right that since we have to read the images anyway, it wouldn't really slow processing down significantly (I think?), and I can see a number of scenarios where it would be convenient.

One of the reasons we haven't done this is that most MegaDetector users read their MD results into Timelapse, which already reads date/time information from images. If you are planning to use Timelapse, I think you don't need anything extra from the MegaDetector inference scripts.

FYI, we have a separate script (read_exif.py) to fetch all metadata for all images in a folder; I typically combine this after the fact with MegaDetector results.

So you have a couple of paths by which you may not actually need new functionality, but I'll leave this open for now, in fact I'll tag this as "good first issue", this is relatively self-contained.


(Comment originally posted by agentmorris)

agentmorris commented 1 year ago

Oh, and whenever we get around to doing this, capture image height/width also (get this from PIL, not from EXIF). Datetime and any other EXIF metadata we decide to pull should be optional; image height/width should not be optional, it should just... be.

agentmorris commented 1 year ago

Done, thanks @atmorling