search for multiple same keywords in same photo

Status
Not open for further replies.

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
Lightroom Version
11.4.1
Operating System
  1. Windows 10
i have a number of photos with family pictures on the wall, therefore end up with more than one of the same keyword (face tag) in the same photo. wonder if theres a way to search for this

thanks
 
Joined
Jun 20, 2009
Messages
19,672
Location
Houston, TX USA
Lightroom Experience
Power User
Lightroom Version
Cloud Service
i have a number of photos with family pictures on the wall, therefore end up with more than one of the same keyword (face tag) in the same photo. wonder if theres a way to search for this

thanks

I believer that a keyword can only be assigned once to an individual photo. In a hierarchial Keyword structure, you can have multiple instance of the keyword, each with a different parent.

Can you describe better what your issue is?


Sent from my iPad using Tapatalk
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
I believer that a keyword can only be assigned once to an individual photo. In a hierarchial Keyword structure, you can have multiple instance of the keyword, each with a different parent.

Can you describe better what your issue is?


Sent from my iPad using Tapatalk
Sometimes, I get two people tagged with the same keyword, usually has a tick for confirmation. Sometimes this happens with people and sometimes with pictures on the wall of the person in the photo. So thought it would be nice as a double check, without opening every photo, to search for multiple instances of the same keyword in the same photo, but fully expect that not to be possible….thank you

P.S. The keyword in question is in the same parent.
 
Joined
Jun 20, 2009
Messages
19,672
Location
Houston, TX USA
Lightroom Experience
Power User
Lightroom Version
Cloud Service
I've not tested this but I suspect that your keyword field will contain only one keyword. However there will be multiple face detection regions in the image and more than one of these will be associated with the same person keyword. I can think of no quick means to identify face detecting regions in images that contain the same keyword.
Remember there are three tables in the Lightroom catalog database that make the unique connections. The master table is the image table where all imported images are managed, the Keyword table where all of the keywords are managed including the "people" keywords. And finally, the Face Region Table where all of the face regions are stored. The Face region table contains references to both the image table and the keyword table. I don't think it is possible to filter on the person table other than the Person View.
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
I've not tested this but I suspect that your keyword field will contain only one keyword. However there will be multiple face detection regions in the image and more than one of these will be associated with the same person keyword. I can think of no quick means to identify face detecting regions in images that contain the same keyword.
Remember there are three tables in the Lightroom catalog database that make the unique connections. The master table is the image table where all imported images are managed, the Keyword table where all of the keywords are managed including the "people" keywords. And finally, the Face Region Table where all of the face regions are stored. The Face region table contains references to both the image table and the keyword table. I don't think it is possible to filter on the person table other than the Person View.
Thanks
 
Joined
Apr 3, 2012
Messages
2,009
Location
Bay Area, California, USA
Lightroom Experience
Power User
Lightroom Version
Classic
You can use the Any Filter plugin to search for photos that have two or more face rectangles assigned the same name.

Define the following search query:
1660925105960.png


where you've copy/pasted the following into the "code" field:

Code:
(function ()
    local names = {}
    for _, face in ipairs (Faces) do
        names [face.Name] = (names [face.Name] or 0) + 1
        if names [face.Name] > 1 then return true end
        end
    Debug.lognpp (Faces, names)
    return false
    end)()

Be sure to select all the photos you're searching and do Metadata > Save Metadata To File first -- otherwise Any Filter won't be able to read the face data.
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
You can use the Any Filter plugin to search for photos that have two or more face rectangles assigned the same name.

Define the following search query:
View attachment 19152

where you've copy/pasted the following into the "code" field:

Code:
(function ()
    local names = {}
    for _, face in ipairs (Faces) do
        names [face.Name] = (names [face.Name] or 0) + 1
        if names [face.Name] > 1 then return true end
        end
    Debug.lognpp (Faces, names)
    return false
    end)()

Be sure to select all the photos you're searching and do Metadata > Save Metadata To File first -- otherwise Any Filter won't be able to read the face data.
Thank you, sounds interesting, so i still need the code you gave, its part of the plugin ?
 
Joined
Apr 3, 2012
Messages
2,009
Location
Bay Area, California, USA
Lightroom Experience
Power User
Lightroom Version
Classic
In Any Filter's Search command, click New to define a new search query (similar to a smart collection). Then fill out the fields as shown in the screenshot above, copying/pasting the code I provided into the "code" field of the query.

(Any Filter lets you do a huge number of things without any special code at all, but when the occasional specialized request appears, the Code query lets me provide quick solutions with a minimum of programming.)
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
I did leave a space before the final two brackets, but after I took the screenshot,
(function ))
I guess I’m doing something wrong, just can’t see what ‍:humble:
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
Hi
so you actually paste the code into the box showing CODE, as the code was in the main window, I assumed it should be pasted there, my mistake, will try again later, thanks.
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
I followed the Video,I must still be doing something wrong, when i paste the code into the code box the only text that pastes is the (function ()
 

Attachments

  • help.jpg
    help.jpg
    32.7 KB · Views: 19

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
Hello
I am so sorry, must be an age thing, I watched the video several times, and still didn’t twig that. just saving all the catalog metadata to the files, when that’s finished I will give it a whirl. It’s most likely straight forward for you to write these routines, bit I can’t see how I would work it out myself, I’ve done some programming in the past, but this is confusing, he great to find all the duplicate keywords in the same photo, strangely enough, when I re check some of the photos, for icture editing, I have noticed some keywords in photos, that shouldn’t be there, it’s possible I did it in a moment of madness, but there’s been a few, hope it’s not a bug that randomly moves keywords around, that would really defeat me.

thanks again
 

Reddwarf4ever

Active Member
Joined
Aug 2, 2022
Messages
250
Still cant get this to work, if I look at johns images and mine, the panels are different, wonder if we are using different variations of LR, have emailed John, hopefully can sort this asap
 
Joined
Apr 3, 2012
Messages
2,009
Location
Bay Area, California, USA
Lightroom Experience
Power User
Lightroom Version
Classic
This turned out to be bug introduced in recent LR versions on Windows -- LR discards multiple lines pasted into a one-line-high text box:
https://community.adobe.com/t5/ligh...uncates-multi-line-pasted-text/idc-p/13251751

The workaround is to copy/paste the code with all line breaks removed (ugh):
(function () local names = {} for _, face in ipairs (Faces) do if face.Name ~= "" and names [face.Name] then return true end names [face.Name] = true end Debug.lognpp (Faces, names) return false end)()
 

dekhatha

New Member
Joined
Oct 10, 2022
Messages
2
In Any Filter's Search command, click New to define a new search query (similar to a smart collection). Then fill out the fields as shown in the screenshot above, copying/pasting the code I provided into the "code" field of the query.
 
Joined
Apr 3, 2012
Messages
2,009
Location
Bay Area, California, USA
Lightroom Experience
Power User
Lightroom Version
Classic
An update on the Any Filter plugin solution posted above: I released a new version of Any Filter that reads the face information directly from the catalog (rather than using the Exiftool utility), and queries about faces now run much, much faster, and you don't need to do Metadata > Save Metadata To File beforehand.
 
Status
Not open for further replies.
Top