Identify images with duplicate names in XMP-mwg-rs:RegionName

Started by jroos, September 11, 2024, 10:27:26 AM

Previous topic - Next topic

jroos

Yes, I'm still using Picasa for face tagging. Unfortunately, it sometimes recognizes the same face twice. The result is images with duplicate RegionNames.

I'm wondering if there is a way to identify files with duplicate names in the RegionNames tag?

I don't want to do any manipulation, just identification.

StarGeek

You could use the config file from this post. You would just check for the existence of the tag and not copy anything.

exiftool -config /path/to/ExifTool-RemoveRegionInfoDuplicates.config -if "$RemoveRegionInfoDuplicates" -Filename /path/to/files/

Note that this doesn't list what the duplicate names are, just that they exist.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

jroos

This works well for one file. Is there a way to get it to list the files in a directory that failed? Right now it just says how many.

jroos

I spoke too soon. It's flagging files that don't have duplicate names. Maybe it's getting a hit because there is a common last name? But the full names are different.

StarGeek

That's what I get for not testing things. Adding the -struct option should make it work.

Also, this command was for Windows CMD (not Powershell). If on Mac/Linux, change the double quotes into single quotes.

Example
C:\>exiftool -G1 -a -s -RegionName Y:\!temp\x\y
======== Y:/!temp/x/y/Duplicated names.jpg
[XMP-mwg-rs]    RegionName                      : Indiana Jones, Marion Ravenwood, Indiana Jones, Marion Ravenwood
======== Y:/!temp/x/y/NoDuplicates.jpg
[XMP-mwg-rs]    RegionName                      : Indiana Jones, Marion Ravenwood
    1 directories scanned
    2 image files read

C:\>exiftool -config RemoveRegionInfoDuplicates.config  -G1 -a -s -struct -if "$RemoveRegionInfoDuplicates" -Filename Y:\!temp\x\y
======== Y:/!temp/x/y/Duplicated names.jpg
[System]        FileName                        : Duplicated names.jpg
    1 directories scanned
    1 files failed condition
    1 image files read
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

jroos

I'm still getting an incorrect failed condition result with that command. For reference, the tag looks like this:

Region Name                     : John Jacob Smith, Adam Robert Smith

StarGeek

Quote from: jroos on September 11, 2024, 11:18:15 AMI'm still getting an incorrect failed condition result with that command. For reference, the tag looks like this:

Region Name                    : John Jacob Smith, Adam Robert Smith

I'm not sure I understand. There are no duplicates in that tag, so a failed result would be correct.

It works correctly here
C:\>exiftool -P -overwrite_original -RegionName="John Jacob Smith" -RegionName="Adam Robert Smith" "Y:/!temp/x/y/Duplicated names.jpg"
    1 image files updated

C:\>exiftool -G1 -a -s -RegionName y:\!temp\Test4.jpg
[XMP-mwg-rs]    RegionName                      : John Jacob Smith, Adam Robert Smith

C:\>exiftool -config RemoveRegionInfoDuplicates.config  -G1 -a -s -struct -if "$RemoveRegionInfoDuplicates" -Filename Y:\!temp\x\y
    1 directories scanned
    2 files failed condition
    0 image files read
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Bah, easier way which I should have though of in the first place

C:\>exiftool -G1 -a -s -RegionName  Y:\!temp\x\y\
======== Y:/!temp/x/y/Duplicated names.jpg
[XMP-mwg-rs]    RegionName                      : John Jacob Smith, Adam Robert Smith, Indiana Jones, Marion Ravenwood, Indiana Jones, Marion Ravenwood
======== Y:/!temp/x/y/NoDuplicates.jpg
[XMP-mwg-rs]    RegionName                      : Indiana Jones, Marion Ravenwood
    1 directories scanned
    2 image files read

C:\>exiftool -G1 -a -s -if "$RegionName ne ${RegionName;NoDups}" -filename Y:\!temp\x\y
======== Y:/!temp/x/y/Duplicated names.jpg
[System]        FileName                        : Duplicated names.jpg
    1 directories scanned
    1 files failed condition
    1 image files read
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

jroos

This got me on the right track. For the record, here is what works for me:

exiftool.exe" -G1 -a -s -if "${RegionName;s/,?\s*Ignored,?\s*//g} ne ${RegionName;s/,?\s*Ignored,?\s*//g;NoDups}" -r FOLDER
In Picasa I actually tag faces I want to ignore with the name "Ignored" so they don't get re-recognized if I have to reset the database. Unfortunately, many images end up with multiple "Ignored" tags. So I strip "Ignored" tags before doing the dedup comparison.

Thank you very much for your help.