Apple - What are the required conditions for Photos to start a facial scan?

The conditions are unclear at this time.

Apple does not inform on how photoanalysisd or photolibraryd work. It is something they need to address properly. As far as I know, photoanalysis uses CoreML and Vision to analyse what images contain, not only Faces in People. So if you search for mountain, it should retrieve images of mountains.

When it comes to how this daemon actually work, I've looked at the process and how it responds to different changes in the macOS environment. From a bit of trial, I think I've figured out how to make it work in a somewhat expectable way. To summarise, the following technique (if you will) should help you crawl about 1K images an hour.

Note: this depends on the hardware you are currently running on. You milage may vary.

Prerequisites:

  1. Have photos imported into Photos.app
  2. Have manually marked faces of people you want Photos to recognise.
  3. Make sure you do not have any items in your library that can cause havoc. You can use Smart Filters with Unable to Upload.
  4. Ensure that your power settings are set to never sleep. (Screen saver can still be on).
  5. Plug your Mac to power, it will be running for a while depending on your collection size.

Solution:

Close all apps, reboot your Mac, make sure you untick the "Reopen windows..." before you reboot. We want macOS to return to desktop without any apps loading. Also make sure you have disabled any apps from starting with macOS too: Users & Groups > Your User > Login Items

Then, once rebooted:

  1. Open Activity Monitor.app and search for photoanalysisd. It should not be found (but leave the window open).
  2. Open Photos.app, wait a minute, then close it. You should see photolibraryd and photoanalysisd in Activity Monitor.app now.
  3. Give it a minute or two (or maybe 10), and now you should see photoanalysisd begin to churn through your photos rather quickly.

For the best possible result, make sure you leave the Mac running over night. If you have a lot of images (50000+) you probably need to do this a couple of nights.

A few things to consider.

  • The daemon can take some time to get it going. When I open Safari it starts churning. You can try this if you don't see any activity after 10 minutes.
  • photoanalysisd can hang up some times. If this happens, check if photolibraryd is doing something (check Activity Monitor.app). If this is the case, It is probably pushing updates to the library.
  • It can sometimes help if you leave your iPhone/iPad unplugged. It seems that Photos only work on a single device at one time.
  • If there is no activity for a while and you don't manage to solve it with the above. Reboot and repeat.

The above has worked for me on 12K photos. I've re-imported them twice to confirm. It took me two days total (by making sure it starts and leave it over night).

Enjoy.


Apparently because the library is on an external drive there's a bug that's causing this to happen. I'll keep everyone posted for when there is a fix!