update:添加人脸比对1:1的接口服务

This commit is contained in:
divenswu 2022-03-17 19:44:09 +08:00
parent 2fbb092926
commit 1be896876d

View File

@ -28,11 +28,11 @@ public class FaceCompareServiceImpl implements FaceCompareService {
public FaceCompareRepVo faceCompare(FaceCompareReqVo compareReq) {
FaceInfo faceInfoA = getFaceInfo(compareReq.getFaceScoreThreshold(), compareReq.getImageBase64A());
if(null == faceInfoA){
throw new RuntimeException("image A is not face");
throw new RuntimeException("Image A is not face");
}
FaceInfo faceInfoB = getFaceInfo(compareReq.getFaceScoreThreshold(), compareReq.getImageBase64B());
if(null == faceInfoB){
throw new RuntimeException("image B is not face");
throw new RuntimeException("Image B is not face");
}
//计算余弦相似度
float simVal = Similarity.cosineSimilarity(faceInfoA.embedding.embeds, faceInfoA.embedding.embeds);