spuun commited on
Commit
dbc055b
·
verified ·
1 Parent(s): 5862051

fix!: bump ssim, swap to multichannel

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -67,8 +67,8 @@ def compare_face_ssim(img1, img2, face_area):
67
  if face2.dtype != np.float32:
68
  face2 = face2.astype(np.float32) / 255.0
69
 
70
- # Calculate SSIM for each channel and take mean
71
- ssim_value = np.mean([ssim(face1[:,:,i], face2[:,:,i], data_range=1.0) for i in range(3)])
72
  return ssim_value
73
 
74
  def predict_and_compare(image):
@@ -145,7 +145,7 @@ Authentication Report:
145
  Permission denied (publickey,facial).
146
  Connection to husseumi.space closed.
147
  """
148
- return success if ssim_value>=0.89 and predicted_class == 'True' else fail
149
 
150
  finally:
151
  # Cleanup
 
67
  if face2.dtype != np.float32:
68
  face2 = face2.astype(np.float32) / 255.0
69
 
70
+ # Calculate multichannel SSIM
71
+ ssim_value = ssim(face1, face2, data_range=1.0, multichannel=True)
72
  return ssim_value
73
 
74
  def predict_and_compare(image):
 
145
  Permission denied (publickey,facial).
146
  Connection to husseumi.space closed.
147
  """
148
+ return success if ssim_value>=0.96 and predicted_class == 'True' else fail
149
 
150
  finally:
151
  # Cleanup