Menu

Group Photos by Face in Python: One Album per Person
📰

Group Photos by Face in Python: One Album per Person

DEV Community: computervision·AI Engine·about 1 hour ago
#Z0gX6d6a
Reading 0:00
15s threshold

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 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.