Phone galleries, family archives, a photographer's backlog: where are all the photos of this person? Here is how to group photos by face in Python: detect every face, match it in a face repository, and sort the library into one album per person. No model to download, no dlib to compile.
Every number below comes from a live run on 24 photos from two outings, a camping trip and a beach picnic.
Want to sort your own library? Get a key for the Face Analyzer API .
Step 1: create a face repository
import io import os import shutil import requests from concurrent.futures import ThreadPoolExecutor from PIL import Image , ImageOps
BASE = " https://faceanalyzer-ai.p.rapidapi.com " HEADERS = { " x-rapidapi-host " : " faceanalyzer-ai.p.rapidapi.com " , " x-rapidapi-key " : " YOUR_API_KEY " , } LIBRARY = " my-photo-library " MIN_SIMILARITY = 90
r = requests . post ( f " { BASE } /create-facial-repository " , headers = HEADERS , data = { " repository_id " : LIBRARY }, ) print ( r .…