WestonV / RJI-Image-Classifier

Machine Learning Image Classifier Designed to Help Journalists and Photographers
MIT License
2 stars 0 forks source link

Adding Classifier Scores to Photo Metadata #9

Closed IneegoMontoya closed 5 years ago

IneegoMontoya commented 5 years ago

Is your feature request related to a problem? Not so much a problem, but a matter of convience for our intended users. Once we assign scores to the photos, those scores are currently stored into the database; which is only hosted on our server. For this to be a truly useful tool to the RJI Institute we need to be able to not only store the scores in the database, but add them to each photo's metadata. This would allow a user to not have to log into our server to get that information, which would allow them to view their pictures by rank on their own systems.

Solution we would like Ideally, once a photo has been uploaded to our system, and run through the classifier, that score is added to the photo's metadata, essentially becoming part of the original photo itself

Describe alternatives Unless the classifier score can be added to the photo metadata, any and all users will need to have access to the database in order to be able to sort their pictures.

Additional Conext

PhotoMetaData

Each digital photo has all kinds of data embedded in it.

IneegoMontoya commented 5 years ago

Progress so far

Turns out there are three or four major metadata schema currently in use today exif: usually added to a photo by the device the photo was taken IPTC: Internationally used by photo journalists XMP: A newer version of IPTC which allows for custom fields

Initially considered attempting to add to an XMP tag through PHP code behind, but found out that without knowing what metadata tags already existed on each photo I would only be able to add a tag as a comment. This solution would technically work, but has the potential to get very messy.

Decided to look for an open source tool which could identify all of the metadata on a photo. Found Darktable and Exiftool. Decided to work with Exiftool as it allows for usage on the command line, and allows for read/write of all metadata on a photo.

To install and be usable for all users you must use the following commands

wget http://owl.phy.queensu.ca/~phil/exiftool/Image-ExifTool-11.38.tar.gz tar -xzf Image-Exiftool-11.38.tar.gz cd Exiftool-11.38 sudo cp -r exiftool lib /usr/local/bin

IneegoMontoya commented 5 years ago

Progress Update

Exiftool works for updating a photo's meta data, but in its default settings, whenever you edit the metadata on a photo, exiftool makes a copy of the original image with the same file name with "_original" appended to the end.

As these photo's are rather large in size, this adds a new problem; storage space. Our current server instance does not have the enough storage to hold duplicates of each and every image. At this time, we cannot foresee a reason to keep copies of the original images and their metadata on our server. Will have to comb through the documentation of Exiftool and see if there is a way to disable this feature.

IneegoMontoya commented 5 years ago

Update

Still combing through documentation about which config file will need to be altered to prevent photo duplication, but have found that you can add the flag "-overwrite_original" when executing from the command line. In theory this could just be coded into the shell script and resolve the issue. Will still continue to attempt to configure this without the need for the extra flag,