tsaddev commited on
Commit
02ddc2f
·
1 Parent(s): 416c572

Update app/Hackathon_setup/face_recognition.py

Browse files
app/Hackathon_setup/face_recognition.py CHANGED
@@ -52,7 +52,8 @@ def detected_face(image):
52
  #5) For loading your model use the current_path+'your model file name', anyhow detailed example is given in comments to the function
53
  #Caution: Don't change the definition or function name; for loading the model use the current_path for path example is given in comments to the function
54
  def get_similarity(img1, img2):
55
- device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 
56
 
57
  det_img1 = detected_face(img1)
58
  det_img2 = detected_face(img2)
@@ -79,7 +80,7 @@ def get_similarity(img1, img2):
79
 
80
  # YOUR CODE HERE, return similarity measure using your model
81
  out1, out2 = siameseNetwork(face1, face2)
82
- euclidean_distance = F.pairwise_distance(out1, out2)
83
 
84
  return euclidean_distance
85
 
 
52
  #5) For loading your model use the current_path+'your model file name', anyhow detailed example is given in comments to the function
53
  #Caution: Don't change the definition or function name; for loading the model use the current_path for path example is given in comments to the function
54
  def get_similarity(img1, img2):
55
+ # device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
56
+ device = torch.device("cpu")
57
 
58
  det_img1 = detected_face(img1)
59
  det_img2 = detected_face(img2)
 
80
 
81
  # YOUR CODE HERE, return similarity measure using your model
82
  out1, out2 = siameseNetwork(face1, face2)
83
+ euclidean_distance = F.pairwise_distance(out1, out2).item()
84
 
85
  return euclidean_distance
86