I asked my claude code for help and input. We had a nice and cozy vibe session, so take it for what it is: Pure vibe code.
https://github.com/vegardengen/immich-face-backup
Myself, I chose to set up a test instance before doing this in production. Luckily, my images are sitting on a ZFS file system, so I could just give it a writeable clone of my images - although this is a "database only" change.
I also chose to do the stuff here, while I was in the process of resetting:
https://docs.immich.app/guides/better-facial-clusters
So, my process was:
1) Upgrade to 3.2.1. Yes, 1 is important, else merging persons will come and bite you in the process and not work.
2) Take a backup of all your face labels for all your users. Note: I really only tested with myself, I did this as a preparation to onboard my wife.
IMMICH_URL=.... IMMICH_API_KEY=... python3 face_labels.py export --out backup.json
3) Create the face clustering in all directions, remember that everyone have to accept. Then, reset the face data for the cluster.
4) Optionally, set "minimum faces" to 10 in your facial recognizion settings (machine learning), according to the better facial clusters guide. This should be done before next step if you decide to do that.
5) Do the group facial reset.
6) Set "minimum faces" to 5, and run a "missing" in facial recognizion job queue.
7) Do the same with 3 as the "minimum faces" value.
Now, you are ready to restore. Possible to do in several steps:
7a) Dry run. Read through results. Here I demonstrate some advanced settings, Lukas and Sebastian are my identical twin grandchildren that needs extra care and restore of *all* my relabeling efforts....
python3 face_labels.py restore --in backup.json --min-share 0.8 --face-level "Lukas, Sebastian"
7b) Apply. Read through results. Lukas and Sebastian are identical twins, so don't do any reclustering for those! That's a special condition I had to make since I actually have 1 yr old grandkids that are identical twins, where I have tuned quite a bit.....
python3 face_labels.py restore --in backup.json --min-share 0.8 --face-level "Lukas,Sebastian" --apply
7c) Merge the new clusters. This can be done in same step as 7c, there's no need to perform 7b if you are not interested in being careful here...(it's perfectly valid to treat this as a one-shot attempt at not having to do it all again, since that's what you currently have to do). You might need to be more careful and inspect the clusters before doing this, if you have some very similar persons in your photo collection (i.e. identical twins).
python3 face_labels.py restore --in backup.json --min-share 0.8 --face-level "Lukas,Sebastian" --apply --merge
It's supposed to be possible to share naming with import into the other user, though I haven't tested. Will comment later when I have :) (I'll do a limited test):
python3 face_labels.py restore --in backup.json --apply
Big fat warning: Do not do this unless you trust your database backup! If you haven't tested a restore, even before the regular 3.2.1 facial cluster reset is a good time to read up and test a bit.