How to read face annotations from sidecar files?

Started by ChicagoGhost, October 24, 2024, 04:38:11 AM

Previous topic - Next topic

ChicagoGhost

For RAW photos (CR2).  I write face annotations to XMP sidecar files. After starting IMatch, I can see the folder under "Recently updated folders" (in the "Media and Folders" view). However, the face annotations are not shown.
If I write directly to the original image files (RAW or JPG), the face annotations are shown without any problem.

In Metadata2 settings, for CR2 files, I already set "XMP sidecar file" to "Force XMP sidecar file".

ChicagoGhost

Got it!
I need to use ctrl-shift-f5, and choose "force update". Then the faces will appear!

Mario

QuoteIn Metadata2 settings, for CR2 files, I already set "XMP sidecar file" to "Force XMP sidecar file".
Don't.
IMatch automatically uses XMP sidecar files. But CR2 files also contain EXIF data and may contain GPS data. Your settings cause the EXIF data in XMP and the EXIF data in the RAW to become out-of-sync. Same for GPS. This will bite you some day.

QuoteFor RAW photos (CR2).  I write face annotations to XMP sidecar files.
When the last modified on disk timestamps of the XMP sidecar file changes, IMatch automatically re-imports it, re-reading the metadata. Which should automatically bring in new XMP face regions. Except, the file already has face regions.
See Working with XMP Face Regions In that case you have to force a metadata reload to replace the existing face annotations, as you found out.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ChicagoGhost

Quote from: Mario on October 24, 2024, 09:29:30 AM
QuoteIn Metadata2 settings, for CR2 files, I already set "XMP sidecar file" to "Force XMP sidecar file".
Don't.
IMatch automatically uses XMP sidecar files. But CR2 files also contain EXIF data and may contain GPS data. Your settings cause the EXIF data in XMP and the EXIF data in the RAW to become out-of-sync. Same for GPS. This will bite you some day.

QuoteFor RAW photos (CR2).  I write face annotations to XMP sidecar files.
When the last modified on disk timestamps of the XMP sidecar file changes, IMatch automatically re-imports it, re-reading the metadata. Which should automatically bring in new XMP face regions. Except, the file already has face regions.
See Working with XMP Face Regions In that case you have to force a metadata reload to replace the existing face annotations, as you found out.

Eh...
The reason I set "Force XMP sidecar file" is I want to make no changes to the original RAW photos. All modifications are saved in the sidecar file, just like in Lightroom. What should I do to achieve that?

I don't think the RAW photos have existing face annotations. Or maybe I am wrong because I don't fully understand what a face annotation is. I mean the photo doesn't have a box around the face. After importing the sidecar file, it does show a box. And I use the "Exif command processor" and search for "region", but I can't find anything in the original photo.
There was no sidecar file for the original photo. Then, I added one (with the face annotation). Then, I open IMatch, the face annotation is not loaded. So, the sidecar file's last modified timestamp didn't "change", because there was no this file before.

Mario

#4
QuoteEh...
The reason I set "Force XMP sidecar file" is I want to make no changes to the original RAW photos.
This is a recipe for trouble. XMP mirrors native EXIF, GPS, IIM3 IPTC data etc. that is stored in the RAW. When you add/change timestamps, GPS coordinates etc. and you let IMatch only write back to the XMP, you end up with two sources of truth. The native metadata embedded in the RAW (which is actually a TIFF file) and the XMP sidecar is out-of-sync.

If you later have to force IMatch to re-read the metadata, the embedded native metadata will override the secondary copy of the data in the XMP file.

The "Don't change a RAW file" was some fearful policy 10 or 15 years ago, when people did not knew better. RAW files are TIFF files, just with a TIFF "heap" that contains the RAW sensor data.


QuoteSo, the sidecar file's last modified timestamp didn't "change", because there was no this file before.
You create an XMP sidecar file in an external application, right?

Does IMatch show the folder as modified (blue rescan icon)?
What happens if you select the file and fore a rescan using Shift+Ctrl+F5 in a File Window and then using the "Force Update" option?

Update:

I've had a look. When a folder is rescanned, IMatch first checks if the image file "last modified" timestamp has changed. If so, the file is enqueued for processing.
It then checks if the file uses XMP in sidecar files. If that is the case, it compares the last modified timestamp on disk of the XMP file with the last metadata imported timestamp for the file in the database. If the timestamp is newer, the XMP file is re-imported.

This behavior is because, for many applications out there, the "last modified" timestamp of the XMP file can be newer than the timestamp of the associated image files. Because the XMP is written later.
If IMatch would just look at the last modified timestamp of the XMP on disk, it would always find it "newer" than the image and thus would re-import it every time the folder is rescanned. Which would be bad.

Other means to detect modifications like looking at certain time stamps or digests in the XMP did not work, since many applications don't bother to write them correctly.

So, the XMP will be re-imported if the file timestamp on disk is later than the last metadata import of the associated image.

When I use that and copy a modified XMP file into a folder containing a RAW file without a sidecar file (your case), IMatch re-imports the XMP and also the face regions contained in the XMP.
I've used IMatch 2025 for my tests, since IMatch 2023 is code freeze and I currently have no running 2023 version.

Try the "force update" and if that works, it should work right out of the box in IMatch 2025.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook