Update app.py
Browse files
app.py
CHANGED
@@ -148,7 +148,7 @@ def image_inference(image):
|
|
148 |
|
149 |
|
150 |
if sum(image.shape) == 0:
|
151 |
-
return { 'ErrorFound': 'ImageNotFound' }
|
152 |
# Convert into grayscale
|
153 |
# gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
154 |
# Detect faces
|
@@ -157,7 +157,7 @@ def image_inference(image):
|
|
157 |
# Draw rectangle around the faces
|
158 |
# rawfaces = postProcessed( rawfaces, image.shape[:2] )
|
159 |
|
160 |
-
rawfaces = face_recognition.face_locations( image , model="
|
161 |
faces = [ image[top:bottom, left:right].copy() for (top, left, bottom, right) in rawfaces ]
|
162 |
# faces = [ image[x:w+x, y:h+y].copy() for (x, y, w, h) in rawfaces ]
|
163 |
faces = [ Image.fromarray(x, mode = 'RGB') for x in faces ]
|
@@ -191,7 +191,7 @@ def video_inference(video_path):
|
|
191 |
except:
|
192 |
break
|
193 |
# rawfaces = postProcessed( rawfaces, image.shape[:2] )
|
194 |
-
rawfaces = face_recognition.face_locations( image , model="
|
195 |
# Draw rectangle around the faces
|
196 |
# https://stackoverflow.com/questions/15589517/how-to-crop-an-image-in-opencv-using-python for fliping axis
|
197 |
global_facesCo.append( rawfaces )
|
|
|
148 |
|
149 |
|
150 |
if sum(image.shape) == 0:
|
151 |
+
return image, { 'ErrorFound': 'ImageNotFound' }
|
152 |
# Convert into grayscale
|
153 |
# gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
154 |
# Detect faces
|
|
|
157 |
# Draw rectangle around the faces
|
158 |
# rawfaces = postProcessed( rawfaces, image.shape[:2] )
|
159 |
|
160 |
+
rawfaces = face_recognition.face_locations( image , model="hog")
|
161 |
faces = [ image[top:bottom, left:right].copy() for (top, left, bottom, right) in rawfaces ]
|
162 |
# faces = [ image[x:w+x, y:h+y].copy() for (x, y, w, h) in rawfaces ]
|
163 |
faces = [ Image.fromarray(x, mode = 'RGB') for x in faces ]
|
|
|
191 |
except:
|
192 |
break
|
193 |
# rawfaces = postProcessed( rawfaces, image.shape[:2] )
|
194 |
+
rawfaces = face_recognition.face_locations( image , model="hog")
|
195 |
# Draw rectangle around the faces
|
196 |
# https://stackoverflow.com/questions/15589517/how-to-crop-an-image-in-opencv-using-python for fliping axis
|
197 |
global_facesCo.append( rawfaces )
|