Update app.py
Browse files
app.py
CHANGED
@@ -139,9 +139,9 @@ model_name = 'resnet100.onnx'
|
|
139 |
# Load ONNX model
|
140 |
model = get_model(ctx , model_name)
|
141 |
|
142 |
-
def inference(
|
143 |
# Load first image
|
144 |
-
img1 = cv2.imread(
|
145 |
|
146 |
# Preprocess first image
|
147 |
pre1 = get_input(detector,img1)
|
@@ -150,7 +150,7 @@ def inference(img1,img2):
|
|
150 |
out1 = get_feature(model,pre1)
|
151 |
|
152 |
# Load second image
|
153 |
-
img2 = cv2.imread(
|
154 |
|
155 |
# Preprocess second image
|
156 |
pre2 = get_input(detector,img2)
|
@@ -165,4 +165,6 @@ def inference(img1,img2):
|
|
165 |
# Print predictions
|
166 |
return 'Distance = %f' %(dist),'Similarity = %f' %(sim)
|
167 |
|
168 |
-
|
|
|
|
|
|
139 |
# Load ONNX model
|
140 |
model = get_model(ctx , model_name)
|
141 |
|
142 |
+
def inference(first,second):
|
143 |
# Load first image
|
144 |
+
img1 = cv2.imread(first)
|
145 |
|
146 |
# Preprocess first image
|
147 |
pre1 = get_input(detector,img1)
|
|
|
150 |
out1 = get_feature(model,pre1)
|
151 |
|
152 |
# Load second image
|
153 |
+
img2 = cv2.imread(second)
|
154 |
|
155 |
# Preprocess second image
|
156 |
pre2 = get_input(detector,img2)
|
|
|
165 |
# Print predictions
|
166 |
return 'Distance = %f' %(dist),'Similarity = %f' %(sim)
|
167 |
|
168 |
+
title="ArcFace"
|
169 |
+
description="ArcFace is a CNN based model for face recognition which learns discriminative features of faces and produces embeddings for input face images. To enhance the discriminative power of softmax loss, a novel supervisor signal called additive angular margin (ArcFace) is used here as an additive term in the softmax loss. ArcFace can use a variety of CNN networks as its backend, each having different accuracy and performance."
|
170 |
+
gr.Interface(inference,[gr.inputs.Image(type="filepath"),gr.inputs.Image(type="filepath")],["text","text"],title=title,description=description).launch(enable_queue=True)
|