Sudipta Nayak commited on
Commit
b71cbe7
·
1 Parent(s): 141091a
app/Hackathon_setup/face_recognition.py CHANGED
@@ -111,4 +111,15 @@ def get_face_class(img1):
111
  ##YOUR CODE HERE, return face class here
112
  ##Hint: you need a classifier finetuned for your classes, it takes o/p of siamese as i/p to it
113
  ##Better Hint: Siamese experiment is covered in one of the labs
114
- return "YET TO BE CODED"
 
 
 
 
 
 
 
 
 
 
 
 
111
  ##YOUR CODE HERE, return face class here
112
  ##Hint: you need a classifier finetuned for your classes, it takes o/p of siamese as i/p to it
113
  ##Better Hint: Siamese experiment is covered in one of the labs
114
+
115
+ feature_net = SiameseNetwork() #Example Network
116
+ feature_net = feature_net.to(device)
117
+ current_path = 'app/Hackathon_setup'
118
+ model = torch.load(current_path + '/siamese_model.t7', map_location=device)
119
+ feature_net.load_state_dict(model['net_dict'])
120
+
121
+ output1 = feature_net.forward_once(det_img1.to(device))
122
+ probabilities = torch.softmax(outputs, dim=1)
123
+ predicted_class = torch.argmax(probabilities, dim=1).item()
124
+
125
+ return predicted_class