Face Thumbnails are sometimes stored with incorrect Size/Position

Started by Tveloso, June 09, 2025, 08:46:11 PM

Previous topic - Next topic

Tveloso

I'm not sure under what conditions this happens, but occasionally I find (within the Confirmed Faces for a person in Face Manager), that several Face Thumbnails do not actually show the person's face, but instead some other part of the image (sometimes quite far away from the face).

This seems to happen with Manual Face Annotations (but I think I might have seen it with real faces as well - although all the current examples I found while checking into this today were for Manual Faces).

When this happens, the Face Annotation as shown in the Viewer looks proper, but the Face Thumbnail, and the region shown in Face Manager's integrated Viewer, are not properly placed.  For example, all six of these Face Thumbnails should look like the third one (enclosing just the person's face), but they instead contain a much larger portion of the image:

    You cannot view this attachment.

If I select the fourth thumbnail, and select Goto->Folder:

    You cannot view this attachment.

...the Face Annotation shown in the Viewer looks proper:

    You cannot view this attachment.

...(so the Face Thumbnail in Face Manager does not agree with the region enclosed by the Face Annotation). 

If I move that Face Annotation slightly, and click the blue checkmark:

    You cannot view this attachment.

...the Face Thumbnail back in Face Manager becomes correct:

    You cannot view this attachment.

This behavior has been present over several IMatch Versions (not just under IMatch 2025), so I have accumulated these "incorrectly Placed and/or Sized" Faces in Face Manager over time.  It's a very small percentage of the Face Thumbnails there, but not an insignificant number.
--Tony

mastodon

I have seen this behavier, too. This was in every version, and not changed (not get worse or better). In Picasa it never happened.

Mario

The only time I have seen this is 

a) IMatch has imported face regions from XMP, and these face regions are wrong
b) The user has changed the dimensions of the image, which invalidates face regions

Do you have steps to reproduce this? A specific image where this happens? Because this should never happen.
When IMatch detects a face, it records the bounding rectangle in relative coordinates in the range 0..1.
The face thumbnail and face fingerprint is produced from that region, too. The Viewer and Quick View Panel use the same rectangle to display the green face box. So it should be right or wrong everywhere.

Please detail the workflow and steps which produce this behavior.
Since I have never seen this before, and until today, no user ever reported this, every detail counts.
Please both of you compare notes, workflows, etc. and maybe we can figure out what exactly you do that causes this. When I can reproduce it, I can fix it.

After creating maybe 300,000 face annotations in my test database, I have never seen this issue.

mastodon

I need some days, and do a test from face tag cleared versions of images, that has this problem.

Mario

Any additional information on this? Maybe some steps I can try to reproduce this?
As I wrote, I've never seen this myself and I don't know how to make this fail in this way. If I can reproduce it, I can fix it.

Tveloso

I checked Face Manager for a person I knew was in a lot of recently processed photos, and did find 3 instances of the incorrectly placed face thumbnails.

Unfortunately it was long enough ago (late last month / early this month) that I don't have a clear enough recollection of how I added those face annotations.  But I'm pretty sure they would have been copied from a prior photo (after having been initially being added to one of those prior photos from the User Gallery). In all three cases, they were manual face annotations.

I'll have more files to index in the next few days, and will try to pay close attention to this, and will report back.
--Tony

Mario

If you copy annotations between images somehow, make sure the images have the same dimensions. Else the face annotations will be placed on the wrong spot. There is no automatic adaption or math when metadata is copied (like XMP regions).

Tveloso

Mario, it does appear that it's when the source and target files have differing pixel dimensions that this happens.  But IMatch does seem to compensate for that, when the Annotations are create in the Viewer.  And it's only the Face Thumbnails that wind up wrong.

I'm guessing that when we copy/paste Face Annotations between files (or probably, also when we add them from the User Gallery), it's the actual pixel dimensions of the Annotations themselves that are being copied (and not those "pixel percentage values" that will ultimately define the XMP Face Region - so no need to do any math at that moment), and IMatch later re-calculates the related "pixel percentage values", per the new File's dimensions.  But it appears that happens only if the newly pasted Annotation is moved/adjusted.  If the Annotation is pasted, and left alone, that re-calc appears to not take place (for creation of the Face Thumbnail), so while the Annotation appears correctly in the Viewer and QuickView Panel, it does not in the Face Thumbnail (or in Face Manager's integrated Viewer).

It's probably a lot more complex than this, but a test I performed seems to support that theory.  I started with three files containing a face drawing.  File-1 was 1920x1080, and Files 2 and 3 were both 600x1920 (in fact, they were duplicates of each other - and IMatch detected File-3 as a dupe of File-2 when the three files were indexed):

You cannot view this attachment.

In the Viewer
You cannot view this attachment.
I sent the three files to the Viewer, and in File-1, pressed F6 (IMatch actually detected that as a face).  I then adjusted the size and position of the Annotation and clicked the blue check mark, then Assigned a Person by pressing F2.  Then I pressed Ctrl+C and moved on to the next file (via the right arrow).

In File-2, I pressed Ctrl+V, and the Annotation was placed with the correct size and shape, and in a pretty good position.  I would have adjusted the position slightly, but intentionally did not do so, and proceeded to the next file (right arrow).

In File-3, I again pressed Ctrl+V, and the Annotation was placed exactly as it was in File-2.  This time I moved it slightly, clicked the blue check mark, and exited the Viewer.

In the QuickView Panel
You cannot view this attachment.
The resulting Face Annotations appeared to be nearly identical, both in the Viewer (where they were originally created), and in the QuickView Panel.

In Face Manager
You cannot view this attachment.
But in Face Manager, the Face Thumbmail for File-2 had and incorrect shape, and did not match the Face Annotation (or the other two Face Thumbnails).  This was even more pronounced in Face Manager's integrated Viewer:

You cannot view this attachment.

So it appears that this condition is created when we paste an Annotation between files with differing pixel dimensions, and do not adjust it at all.
--Tony

Mario


QuoteSo it appears that this condition is created when we paste an Annotation between files with differing pixel dimensions, and do not adjust it at all.
I'll have a look for the next release.

Maybe it just keeps the existing face thumbnail and does only create a new one when you move the face annotation. Or something, don't know yet. 

Mario

I've worked on that almost the full day. I can see that, under some circumstances yet unknown, the FM display is different. But I don't know why yet.

The relative and absolute annotation coordinates are identical after pasting, the face rectangle is the same, the face thumbnail is the same.

Even pasting into a smaller image shows correct numbers, the paste operation scales the annotation based on the size difference between the source and target file automatically.

Must be something really stupid or really complex.

A lot of math is involved, platform break Windows/browser etc. But the face numbers the browser gets are correct but somehow the rectangle drawn by the canvas is off still.

Will work on this some more over the next days. Damn, so much time lost.

Mario

I think I've got it. At least I cannot reproduce it anymore with my samples especially created for this purpose. 
It was caused by IMatch somewhat enlarging the rectangle of the pasted face to improve recognition rate. Seems to have backfired in unexpected ways. It also explains why it fixes itself when you minimally drag the face annotation, even by just one pixel.

I'll mark this as fixed and you give it a try when the next release comes out in a couple of weeks. If you can still reproduce it, I need to dig in again. This took me a long time to encircle and dig into. Geez.

Tveloso

Thank you so much Mario.

I'm sorry this wound up consuming so much time...(for what is really a pretty minor issue).  But I'm glad we'll have "clean Face Thumbnails" going forward.

Thanks again.
--Tony

Tveloso

I can confirm that I am no longer able reproduce the issue under IMatch 2025.5.2.  Thank you so much Mario!

(might there be a way to identify the older Face Thumbnails that have this condition?)...
--Tony

Mario

Quote from: Tveloso on July 30, 2025, 09:50:08 PMI can confirm that I am no longer able reproduce the issue under IMatch 2025.5.2.  Thank you so much Mario!

(might there be a way to identify the older Face Thumbnails that have this condition?)...
Thanks for checking.
Since this was a "random" issue, I would not know a way to find these faces where it occasionally failed.