Spaces:
Runtime error
Runtime error
Commit
·
0e9fe08
1
Parent(s):
aa7cca8
Update RetinaFace.py
Browse files- RetinaFace.py +1 -16
RetinaFace.py
CHANGED
|
@@ -36,22 +36,7 @@ def build_model():
|
|
| 36 |
return model
|
| 37 |
|
| 38 |
def get_image(img_path):
|
| 39 |
-
|
| 40 |
-
if not os.path.isfile(img_path):
|
| 41 |
-
raise ValueError("Input image file path (", img_path, ") does not exist.")
|
| 42 |
-
img = cv2.imread(img_path)
|
| 43 |
-
|
| 44 |
-
elif isinstance(img_path, np.ndarray): # Use given NumPy array
|
| 45 |
-
img = img_path.copy()
|
| 46 |
-
|
| 47 |
-
else:
|
| 48 |
-
raise ValueError("Invalid image input. Only file paths or a NumPy array accepted.")
|
| 49 |
-
|
| 50 |
-
# Validate image shape
|
| 51 |
-
if len(img.shape) != 3 or np.prod(img.shape) == 0:
|
| 52 |
-
raise ValueError("Input image needs to have 3 channels at must not be empty.")
|
| 53 |
-
|
| 54 |
-
return img
|
| 55 |
|
| 56 |
def detect_faces(img_path, threshold=0.9, model = None, allow_upscaling = True):
|
| 57 |
"""
|
|
|
|
| 36 |
return model
|
| 37 |
|
| 38 |
def get_image(img_path):
|
| 39 |
+
return img_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
def detect_faces(img_path, threshold=0.9, model = None, allow_upscaling = True):
|
| 42 |
"""
|