Where can I find raw data for Apple photo's face recognition

I've been using Mac's photos to recognize faces in my pictures. I'm interested in seeing some basic stats such as the occurrences and co-occurrences of people and how they change over time. Is there a place where the raw data are stored so that I can write codes to perform analysis?


In Mojave and earlier: Photos library (right click) > Show package contents > Resources > Media > Face. The sub-folders within the Face folder contains thumbnails of all faces. Additional data about them can be found in Database > photos.db but you'll need DB Browser for sqlite or similar program. Face related data is in a table named RKFace, several other tables named RKFace..., and elsewhere.

In Catalina and later, use the same approach as above but the folder names are different. You'll be querying Database > photos.sqlite, and looking at tables such as ZDETECTEDFACE, ZFACECROP, and basically any other with "face" in it.

Be very careful not to modify, delete or move anything when you open Photos library.photoslibrary.


~/Pictures/Photos\ Library.photoslibrary

Use show package contents in right click menu. They will be separated using dates. In some folders, there are thumbnails of faces cropped out. You can write some simple scripts to traverse the folders and arrange them separately. Making a backup of the library is a good idea before running scripts.