Commit Β·
485063f
1
Parent(s): b404794
Update
Browse files- app/app_utils.py +1 -2
- config.toml +1 -0
- result.mp4 +0 -0
app/app_utils.py
CHANGED
|
@@ -17,7 +17,6 @@ from app.face_utils import get_box, display_info
|
|
| 17 |
from app.config import DICT_EMO, config_data
|
| 18 |
from app.plot import statistics_plot
|
| 19 |
|
| 20 |
-
|
| 21 |
mp_face_mesh = mp.solutions.face_mesh
|
| 22 |
|
| 23 |
|
|
@@ -91,7 +90,7 @@ def preprocess_video_and_predict(video):
|
|
| 91 |
startX, startY, endX, endY = get_box(fl, w, h)
|
| 92 |
cur_face = frame_copy[startY:endY, startX: endX]
|
| 93 |
|
| 94 |
-
if (count_frame-1)%
|
| 95 |
cur_face_copy = pth_processing(Image.fromarray(cur_face)).to(config_data.DEVICE)
|
| 96 |
features = torch.nn.functional.relu(pth_model_static.extract_features(cur_face_copy)).cpu().detach().numpy()
|
| 97 |
|
|
|
|
| 17 |
from app.config import DICT_EMO, config_data
|
| 18 |
from app.plot import statistics_plot
|
| 19 |
|
|
|
|
| 20 |
mp_face_mesh = mp.solutions.face_mesh
|
| 21 |
|
| 22 |
|
|
|
|
| 90 |
startX, startY, endX, endY = get_box(fl, w, h)
|
| 91 |
cur_face = frame_copy[startY:endY, startX: endX]
|
| 92 |
|
| 93 |
+
if (count_frame-1)%config_data.FRAME_DOWNSAMPLING == 0:
|
| 94 |
cur_face_copy = pth_processing(Image.fromarray(cur_face)).to(config_data.DEVICE)
|
| 95 |
features = torch.nn.functional.relu(pth_model_static.extract_features(cur_face_copy)).cpu().detach().numpy()
|
| 96 |
|
config.toml
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
APP_VERSION = "0.2.0"
|
| 2 |
DEVICE = "cpu"
|
|
|
|
| 3 |
|
| 4 |
[model_static]
|
| 5 |
url = "https://huggingface.co/ElenaRyumina/face_emotion_recognition/resolve/main/FER_static_ResNet50_AffectNet.pth"
|
|
|
|
| 1 |
APP_VERSION = "0.2.0"
|
| 2 |
DEVICE = "cpu"
|
| 3 |
+
FRAME_DOWNSAMPLING = 5
|
| 4 |
|
| 5 |
[model_static]
|
| 6 |
url = "https://huggingface.co/ElenaRyumina/face_emotion_recognition/resolve/main/FER_static_ResNet50_AffectNet.pth"
|
result.mp4
CHANGED
|
Binary files a/result.mp4 and b/result.mp4 differ
|
|
|