jatinbittu13 commited on
Commit
d8e6044
1 Parent(s): 68277c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -41,13 +41,13 @@ def verify(model, detection_threshold, verification_threshold):
41
  # Build results array
42
  results = []
43
  ver_images= []
44
- for file in os.listdir(os.path.join('application_data', 'verification_images')):
45
  if file[len(file)-4:] == '.jpg':
46
  ver_images.append(file)
47
  ver_images_len= len(ver_images)
48
  for image in ver_images:
49
- input_img = preprocess(os.path.join('application_data', 'input_image', 'input_image.jpg'))
50
- validation_img = preprocess(os.path.join('application_data', 'verification_images', image))
51
  # Make Predictions
52
  result = model.predict(list(np.expand_dims([input_img, validation_img], axis=1)))
53
  results.append(result)
@@ -64,11 +64,11 @@ def verify(model, detection_threshold, verification_threshold):
64
 
65
  def take_ver_images (image):
66
  count =0
67
- cv2.imwrite(os.path.join('application_data', 'verification_images', '{}.jpg'.format(uuid.uuid1())), image)
68
  count+=1
69
  return '{} Image Collected!'.format(count)
70
  def verify_identity (image):
71
- cv2.imwrite(os.path.join('application_data', 'input_image', 'input_image.jpg'), image)
72
  detection,verification,verified,ver_images_len = verify(siamese_model, 0.8, 0.7)
73
  # return {'Detections': int(detection),'Confidence': float(verification),'Verified': bool(verified)}
74
  return 'Detected {} out of {} samples'.format(detection,ver_images_len),float(verification),'Verified' if verified else 'Not Verified'
 
41
  # Build results array
42
  results = []
43
  ver_images= []
44
+ for file in os.listdir(os.path.join('')):
45
  if file[len(file)-4:] == '.jpg':
46
  ver_images.append(file)
47
  ver_images_len= len(ver_images)
48
  for image in ver_images:
49
+ input_img = preprocess(os.path.join('input_image.jpg'))
50
+ validation_img = preprocess(os.path.join('', image))
51
  # Make Predictions
52
  result = model.predict(list(np.expand_dims([input_img, validation_img], axis=1)))
53
  results.append(result)
 
64
 
65
  def take_ver_images (image):
66
  count =0
67
+ cv2.imwrite(os.path.join('{}.jpg'.format(uuid.uuid1())), image)
68
  count+=1
69
  return '{} Image Collected!'.format(count)
70
  def verify_identity (image):
71
+ cv2.imwrite(os.path.join('input_image.jpg'), image)
72
  detection,verification,verified,ver_images_len = verify(siamese_model, 0.8, 0.7)
73
  # return {'Detections': int(detection),'Confidence': float(verification),'Verified': bool(verified)}
74
  return 'Detected {} out of {} samples'.format(detection,ver_images_len),float(verification),'Verified' if verified else 'Not Verified'