Код: Выделить всё
import glob, os, cv2
from keras_facenet import FaceNet
embedder = FaceNet()
detections = embedder.extract("me.jpg", threshold=0.95)
me_emb = detections[0]['embedding']
for f in glob.glob("photos/*.jpg"):
print(f)
img = cv2.imread(f)
detections, crops = embedder.crop(img, threshold=0.95)
if detections == []:
continue
for j, emb in enumerate(embedder.embeddings(images=crops)):
dist = embedder.compute_distance(emb, me_emb)
if dist < 0.7:
print(f"hey, found in {f=} with {dist=}")
Подробнее здесь: https://stackoverflow.com/questions/792 ... a-corpus-o
Мобильная версия