Open kiashann opened 8 months ago
I want to use R100 model for face recognition which I downloaded from here. I test different models and the output of similarity is shown in comment I used two images from different person. Is it correct way to compare to faces? Is there any other method to do that? Why did the compare function didn't work? @nttstar
import insightface import cv2 import numpy as np from numpy.linalg import norm
def compare(feat1, feat2):
distance = np.dot(feat2, feat1) / norm(feat2) * norm(feat1)
return distance
img1 = cv2.imread(r"20240127_120414.png")
img2 = cv2.imread(r"IMG_20240205_140538.jpg")
handler = insightface.model_zoo.get_model(r"D:\face recognition\code\insightface\models\ms1mv2_r50.onnx") #40
handler.prepare(ctx_id=-1)
f1 = handler.get_feat(img1) f2 = handler.get_feat(img2)
out = handler.compute_sim(f1, f2) print(out)
Thanks for sharing. I'm surprised there's no documentation showing this usage.
Please help! How I can use this library for face recognition on my own images. I have known and unknown folder with images. I saw below code but I could not find the complete example to use this library. Could you please provide a complete code or example for me.
import cv2 import numpy as np import insightface from insightface.app import FaceAnalysis from insightface.data import get_image as ins_get_image
handler = insightface.model_zoo.get_model('your_recognition_model.onnx') handler.prepare(ctx_id=0)
@yingfeng