14

I migrated my rather large Photos library from El Capitan to High Sierra probably around 2-3 months ago. To this day, the Photos app still reports that it hasn't completed its analysis of all the faces.

I am aware that leaving the Photos.app open will pause its analysis so I have left it closed most of the time. As well, I have tracked the CPU time that the process is consuming so I do know that it is doing something.

Is there a way to kick the process into a more aggressive mode? I mean, why does it have to do everything so tenderly in background mode? It is almost like it is trying not to use my disk or CPU at all and quite frankly I've got a desktop with 8 cores, plenty of RAM and such and I wouldn't mind if it burned my CPU for 2-3 days to just get it all done.

To clarify: this is not a matter of a low priority or lack of CPU/RAM as the machine has plenty to spare and is left alone most of the time not doing anything. It is a question of if there is a config/setting that can tell the process to work hard on the problem rather than VERY passively?

Any ideas?

1
  • 1
    I'm also interested in this. I moved to a mac about a year ago and then an iphone a few months ago, and have yet to see any of the faces in my photos be identified. I've been considering downloading all of my old photos and seeing if that helps the face recognition figure things out but would like to avoid that. Commented Aug 14, 2018 at 17:37

3 Answers 3

5

I had the same problem when I migrated all my photo library and here's the way I've found to make Photos analyze my gallery faster:

  • Open Photos.app preferences
  • Open the iCloud tab > click on Download Originals to this Mac
  • Wait for all the photos to download

iCloud preferences in Photo app

The scan should be faster after this, it should scan ~50 000 pictures per day. Unfortunately, if you don't use iCloud or the "Download Originals" option was already clicked I don't think there's any other way to make it go faster.

2
  • 3
    +1 because this is useful to the public. However, I do not use iCloud Photo Library features and in my case it is all local. FWIW, 18 months later and Photos.app is STILL reporting that it hasn't finished despite the machine being powered up and mostly idle for the majority of that time. The best I can guess is that there must be something it is getting hung up on (OR it really is that inefficient!). Ultimately, I was hoping that it would give me an "Unknown faces" type feature so that I could give it a hand with those it can't identify. Unfortunately, it doesn't seem to do anything like that.
    – bjb
    Commented Feb 17, 2020 at 17:30
  • I wonder if there's a bug where, unless you're using the iCloud Photo Library feature, the recognizing of faces simply... won't work. I mean, have you compared # of known faces before & after? Then again, I seem to recall the criteria for smart albums in Photos might not (yet) include 'has face' (as iPhoto did), so, keeping cound of # of items in a smart album whose criteria is 'has face' may not be possible... Sorry for any vague guessing, just trying to help brainstorm & suggest maybe as a workaround, try using iCloud Photo Library. Let us know where it is now, please. Thanks.
    – Ed Mechem
    Commented Aug 10, 2023 at 7:05
3

I just found an interesting issue that photoanalysisd was not making progress on my photo library. First I learned for its message that if the library is in use it will not run. An item that I hadn't thought about was that my screensaver was using my photo library. Also, I still had the old photo stream feature enabled.

After all uses of my photo library being active other than cloud library download, I looked at console log. With the console streaming messages active and searching for photoanalysisd in any. I discovered a message related to photoalaysisd from another background process:

{name: ThermalPolicy, policyWeight: 5.000, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{thermalLevel > 0}]}}

I keep my office at about 25 C. This meant that my CPU run warmer than it was allowed. I am testing with a cooler office and hope it will resolve the issue.

TL;DR: Shut off all uses of your photo library and monitor the console log to see why it might not be allowed to run.

1

The short answer

To make it run face analysis as much as possible, plug in your Mac, and make it not sleep, and it will run in the background.

On MacOS 14.6.1 on an M2 MBP Pro I went to system settings and did Battery > Options > Prevent automatic sleeping on power adapter when the display is off > On and let my Mac sit for a while with Console streaming.

Prevent automatic sleeping on power adapter when the display is off

... but even then it doesn't run very much.

The long answer

How to even figure out if face analysis is running?

This isn't as easy as it should be. I dove into Console.app and the log command to try to detect when face analysis is running. I found that it's controlled by a daemon called dasd. So what the heck is dasd?

Apparently it stands for Duet Activity Scheduler, and is related to Centralized Task Scheduling (CTS), and XPC (which might stand for Cross Process Communication). This blog post How macOS runs background activities seems to provide the best current description, but notes that Apple provides no direct documentation.

When I poked around in the system logs, I found log lines like these:

  • default 16:00:10.538463-0400 dasd '501:com.apple.photoanalysisd.backgroundanalysis:529421' has compatibility score of -1.000000 with 501:com.apple.mediaanalysisd.photos.face:F030F1 (Started at Wed Aug 21 15:58:44 2024). Bailing out. – looks like dasd is deciding that face recognition can't run because some other background photo task is running
  • default 15:12:32.532365-0400 dasd '501:com.apple.mediaanalysisd.photos.face:205587' CurrentScore: 1.000000, ThresholdScore: 0.243348 DecisionToRun:1 – looks like dasd has decided face analysis can run
  • default 15:12:32.655895-0400 dasd STARTING activity 501:com.apple.mediaanalysisd.photos.face:205587 <private>! – face analysis is starting
  • default 15:12:42.098011-0400 dasd Activity 501:com.apple.mediaanalysisd.photos.face:205587 has been running for 0.1573464155197143 minutes – face recognition has been running for 9.4 ish seconds so far
  • and so on

Generally after a few minutes com.apple.mediaanalysisd.photos.face gets shut down and other background tasks run

and then gets cancelled and submits its activity (maybe to iCloud?):

  • default 15:15:22.482486-0400 dasd NO LONGER RUNNING 501:com.apple.mediaanalysisd.photos.face:205587 ...Tasks running in group [<private>] are 0!
  • default 15:15:22.494095-0400 dasd Submitted Activity: 501:com.apple.mediaanalysisd.photos.face:183D88 at priority 5 with interval 7200 (Mon Aug 19 10:42:19 2024 - Mon Aug 19 12:42:19 2024)

Notably it looks like

  • only runs when plugged in and computer is not being used
  • runs at most ever 5-10 minutes, for a few minutes at a time

I haven't figured out yet how to get it to run more, maybe there's an obscure way to configure it.

Additional notes

Console.app is good for playing around, stream the device logs and search for photos.face.

For more serious analysis the log command with predicates is better. E.g.

  • log show --style compact --predicate '(sender == "dasd") && (eventMessage CONTAINS "photos.face")'
  • log show --style compact --predicate '(sender == "dasd") && (eventMessage CONTAINS "photos.face") && (eventMessage CONTAINS "running")' > ~/Downloads/dasd-photos.face-running.log (takes a while to run, puts everything into a file)
2
  • Good answer explaining the powersaving mode and observations of the analysis behavior. I discovered much of the same when researching these questions, but unfortunately still haven't figured out how to influence the scheduling / algorithm to work without interruptions.
    – bjb
    Commented Aug 23 at 20:20
  • 1
    @bjb thanks. In /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist there's a bunch of config lines that look like they could change the scheduling. [eclecticlight.co/2023/07/11/… blog) has some description of parameters for LaunchEvents, maybe Priority would change it. But I think require turning off SIP to change that file. Commented Aug 26 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .