Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,7 @@ class AttendanceSystem:
|
|
| 33 |
os.makedirs("data/faces", exist_ok=True)
|
| 34 |
|
| 35 |
self.load_data()
|
| 36 |
-
|
| 37 |
def load_data(self):
|
| 38 |
"""Load all stored data"""
|
| 39 |
try:
|
|
@@ -90,7 +90,7 @@ class AttendanceSystem:
|
|
| 90 |
|
| 91 |
try:
|
| 92 |
# Verify the image contains a face
|
| 93 |
-
face_analysis = DeepFace.analyze(img_path=image, actions=['emotion'], enforce_detection=True)
|
| 94 |
|
| 95 |
# Get face embedding
|
| 96 |
embedding = DeepFace.represent(img_path=image, model_name='Facenet')[0]['embedding']
|
|
@@ -189,7 +189,7 @@ class AttendanceSystem:
|
|
| 189 |
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 190 |
|
| 191 |
# Find faces in the frame
|
| 192 |
-
face_objs = DeepFace.extract_faces(img_path=rgb_frame, target_size=(160, 160), enforce_detection=False)
|
| 193 |
|
| 194 |
current_time = time.time()
|
| 195 |
|
|
|
|
| 33 |
os.makedirs("data/faces", exist_ok=True)
|
| 34 |
|
| 35 |
self.load_data()
|
| 36 |
+
|
| 37 |
def load_data(self):
|
| 38 |
"""Load all stored data"""
|
| 39 |
try:
|
|
|
|
| 90 |
|
| 91 |
try:
|
| 92 |
# Verify the image contains a face
|
| 93 |
+
face_analysis = DeepFace.analyze(img_path=image, actions=['emotion'], enforce_detection=True, detector_backend='opencv')
|
| 94 |
|
| 95 |
# Get face embedding
|
| 96 |
embedding = DeepFace.represent(img_path=image, model_name='Facenet')[0]['embedding']
|
|
|
|
| 189 |
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 190 |
|
| 191 |
# Find faces in the frame
|
| 192 |
+
face_objs = DeepFace.extract_faces(img_path=rgb_frame, target_size=(160, 160), enforce_detection=False, detector_backend='opencv')
|
| 193 |
|
| 194 |
current_time = time.time()
|
| 195 |
|