Re-Run Lightroom Face Detection

To my knowledge as of today there is no official way to re-run face-detection in Adobe Lightroom (LR), neither for a complete catalogue nor for a single folder. You may find you want this option if for example you deleted a whole bunch of already recognised face-areas and now regret you did so. The following works for me.

First make a backup of your catalogue.

Then get the SQLite Browser (http://sqlitebrowser.org/). You will need it to edit the LR catalogue file. Install it, run it and open a database. Use your catalogue as database. Lightroom must be closed while you do this.

You will see, a LR catalogue is a relational database, it contains a lot of tables. With some experience you’ll be able to guess how these work together. A lot you can do here – a lot you can damage! If you try what I describe here and it fails, don’t come to me for complaining. This is definitely not officially supported, no warranty, at your own risk.

There is one table that can help you if you want to re-run the face-detection: Adobe_libraryImageFaceProcessHistory. It contains information about what happened with the images already, the last status of face-detection, face-recognition and indexing as well as whether you touched the image after detection, for example to confirm the find by adding a name.

The table is pretty useless without additional information. It contains a ID for each image it has data for, which you can use to link to the relevant information in other tables like this:

select Folder.pathFromRoot, File.baseName, File.extension, Hist.*
from  Adobe_libraryImageFaceProcessHistory AS Hist
inner join Adobe_images AS Img ON Hist.image = Img.id_local
inner join AgLibraryFile AS File on  Img.rootFile = File.id_local
inner join AgLibraryFolder AS Folder on File.folder = Folder.id_local

As you have the folder path in the query, you can also use it to filter for photos in a particular folder (including subfolders if you use a wildcard ‘%’). Like this:

select Hist.*
 from  Adobe_libraryImageFaceProcessHistory AS Hist
 inner join Adobe_images AS Img ON Hist.image = Img.id_local
 inner join AgLibraryFile AS File on  Img.rootFile = File.id_local
 inner join AgLibraryFolder AS Folder on File.folder = Folder.id_local
 where Folder.pathFromRoot LIKE 'Photos/2015/2015-04-25/%'

Now, with this you can selectively delete the face detection history entries for photos in a particular folder. Before you do, make sure you have really made that backup.

delete from Adobe_libraryImageFaceProcessHistory
 Where id_local in (
 select Hist.id_local
 from  Adobe_libraryImageFaceProcessHistory AS Hist
 inner join Adobe_images AS Img ON Hist.image = Img.id_local
 inner join AgLibraryFile AS File on  Img.rootFile = File.id_local
 inner join AgLibraryFolder AS Folder on File.folder = Folder.id_local
 where Folder.pathFromRoot LIKE 'Photos/2015/2015-04-25/')

Now, close the database and open Lightroom. Go to the folder and switch to people-view. The detection runs again.

This does not delete already detected face-areas or keyword assignments.

Let me know if this worked for you in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.