Tejaswini2403 commited on
Commit
06d6683
·
1 Parent(s): 64f4123
app/Hackathon_setup/exp_recognition.py CHANGED
@@ -69,10 +69,13 @@ def get_expression(img):
69
 
70
  if face == 0:
71
  face = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY))
72
- else:
73
- face = torch.from_numpy(np.array(face)).to(device) # Convert to a PyTorch tensor and move it to the correct device
74
-
75
  output = face_det_net(face)
 
 
 
 
76
 
77
  # YOUR CODE HERE, return expression using your model
78
 
 
69
 
70
  if face == 0:
71
  face = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY))
72
+
73
+ with torch.no_grad():
 
74
  output = face_det_net(face)
75
+ _, predicted = torch.max(output, 1)
76
+
77
+ predicted_expression = classes[predicted.item()]
78
+
79
 
80
  # YOUR CODE HERE, return expression using your model
81