-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml
More file actions
250 lines (220 loc) · 6.96 KB
/
Copy pathconfig.yaml
File metadata and controls
250 lines (220 loc) · 6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# Eaglearn MediaPipe Configuration
# All settings are tunable for performance/accuracy trade-offs
mediapipe:
# Model Selection
model_complexity: 0 # 0=Lite (fastest), 1=Full, 2=Heavy
# Pose Detection Settings
pose:
static_image_mode: false
model_complexity: 0 # Lite model
smooth_landmarks: false # Disable for speed
min_detection_confidence: 0.5
min_tracking_confidence: 0.5
enable_segmentation: false
# Face Detection Settings
face_detection:
model_selection: 0 # 0=short range (faster), 1=full range
min_detection_confidence: 0.3 # Lower for speed
# Face Mesh Settings
face_mesh:
static_image_mode: false
max_num_faces: 1
refine_landmarks: true # Enable iris tracking
min_detection_confidence: 0.3
min_tracking_confidence: 0.3
# Performance Tuning
performance:
# Frame Processing
frame_skip_mode: adaptive # 'fixed' | 'adaptive'
frame_skip_base: 3 # Process every Nth frame (fixed mode)
# Adaptive Frame Skipping (when mode=adaptive)
adaptive_quality:
enabled: true
target_fps: 25 # Target FPS to maintain
min_skip: 1 # Minimum frames to skip
max_skip: 7 # Maximum frames to skip
fps_low_threshold: 20 # When to increase skipping
fps_high_threshold: 30 # When to decrease skipping
# GPU Acceleration (OpenCV CUDA + TensorFlow GPU)
gpu_acceleration:
enabled: true
fallback_to_cpu: true # Fallback if GPU not available
# TensorFlow GPU Settings (for DeepFace emotion detection)
tensorflow:
# Enable memory growth (prevent OOM errors)
memory_growth: true
# Optional: Limit GPU memory (MB) - uncomment to enable
# memory_limit: 2048 # 2GB limit
# Log device placement for debugging
log_device_placement: false
# Selective Processing (optimization)
selective_face_mesh:
enabled: true
stability_threshold: 0.8 # Only process when face stable
confidence_threshold: 0.7 # Minimum confidence
vlm:
enabled: false
model_name: HuggingFaceTB/SmolVLM-500M-Instruct
async_load: true
warmup: true
min_fps_to_run: 12
min_free_vram_mb: 512
analysis_cooldown_seconds: 5
cooldown_on_skip_seconds: 5
readiness_retry:
enabled: true
initial_seconds: 10
max_seconds: 300
max_attempts_per_hour: 12
lighting:
enabled: false
auto_brightness: true
target_brightness: 0.45
night_mode_threshold: 0.25
dynamic_contrast: true
ui:
quality_preset: balanced
jpeg_quality: 75
smartphone_detection:
enabled: false
model_path: models/smartphone_detector.onnx
threshold: 0.5
interval_frames: 10
visual_feedback: false
# Camera Settings
camera:
width: 640
height: 480
fps: 30
backend: dshow # 'dshow' (Windows), 'default', 'v4l2' (Linux)
use_live_capture: false # Enable live capture for streaming
# Focus Algorithm Thresholds
focus:
# Detection Thresholds
head_yaw_threshold: 10 # Degrees
head_pitch_threshold: 8 # Degrees
eye_aspect_ratio_threshold: 0.2 # Eyes open
posture_good_threshold: 80 # Percentage
posture_acceptable_threshold: 60 # Percentage
# Score Weights (must sum to 100)
weights:
face_detection: 30
eye_aspect_ratio: 20
head_pose: 25
body_posture: 15
mouth_aspect_ratio: 10
# Status Thresholds
focused_threshold: 65 # Score >= 65% = focused
distracted_threshold: 45 # Score >= 45% = distracted, otherwise unfocused
score_smoothing_alpha: 0.22
status_hysteresis: 6.0
distracted_hysteresis: 4.0
metric_smoothing_alpha: 0.25
forced_unfocused_score: 30
distraction_penalty_per_event: 0.14
max_distraction_penalty: 0.45
head_pose_low_threshold: 0.45
head_pose_low_penalty: 0.20
gaze_offcenter_penalty: 0.18
attention_score_low_threshold: 75
attention_low_penalty: 0.12
face_mesh_max_age_seconds: 0.8
face_mesh_hard_fail_seconds: 2.5
no_face_mesh_penalty: 0.2
# Eye Tracking Settings
eye_tracking:
screen_width: 1920
screen_height: 1080
gaze_scale_x: 800 # Pixels per gaze unit
gaze_scale_y: 450 # Pixels per gaze unit
sensitivity_threshold: 0.18 # Lower = more sensitive
invert_y: true
distance_compensation_enabled: true
distance_compensation_ratio_min: 0.75
distance_compensation_ratio_max: 1.35
# Gaze Smoothing (reduce jitter)
enable_smoothing: true
smoothing_window: 5 # Number of frames to average (3-7 recommended)
smoothing_method: moving_average # 'moving_average' | 'exponential'
# Emotion Detection Thresholds
emotion:
# Minimum confidence for emotion detection
min_confidence: 0.3
# Yawning Detection
yawning_mar_threshold: 0.6
yawning_duration_threshold: 0.5 # Seconds
# Blink Detection
blink_ear_threshold: 0.21 # Increased from 0.18 (more strict)
blink_debounce_time: 0.20 # Increased from 0.15 (prevent double-count)
normal_blink_rate_min: 12 # Decreased from 15 (wider range)
normal_blink_rate_max: 25 # Increased from 20 (wider range)
# Stress Detection
stress_high_threshold: 0.7
stress_medium_threshold: 0.5
# Angry Detection (STRICT thresholds to reduce false positives)
angry_frown_threshold: 0.012 # Increased from 0.010 (stricter)
angry_eyebrow_furrow_threshold: 0.08 # Max furrow distance
angry_lip_tension_threshold: 0.60 # Increased from 0.55 (stricter)
angry_ear_min: 0.12 # Eyes must be narrowed (lowered from 0.15)
angry_ear_max: 0.18 # But not closed
# Confusion Detection
eyebrow_raise_threshold: 0.08
head_tilt_threshold: 8 # Degrees
# Distraction Detection
distractions:
head_turn_threshold: 20 # Degrees
head_pitch_threshold: 15 # Degrees
posture_poor_threshold: 40 # Percentage
stress_high_threshold: 0.7
confusion_high_threshold: 0.7
validation_min_seconds: 0.9
head_turn_min_seconds: 0.6
gaze_away_min_seconds: 0.6
clear_grace_seconds: 1.2
no_face_min_seconds: 0.6
attention_score_threshold: 55
eye_closed_seconds: 0.6
head_roll_threshold: 18
posture_min_seconds: 1.5
smartphone_min_seconds: 0.4
include_affect_signals: false
affect_min_seconds: 2.0
event_log_cooldown_seconds: 1.0
face_mesh_max_age_seconds: 0.8
# Calibration Settings
calibration:
enabled: true
auto_save: true
calibration_file: user_calibration.json
default_calibration:
gaze_offset_x: 0
gaze_offset_y: 0
scale_factor: 1.0
# Privacy Settings
privacy:
allow_pause: true
local_processing_only: true # No cloud upload
retain_images: false # Don't save frames
# Logging Settings
logging:
level: INFO # DEBUG, INFO, WARNING, ERROR
log_focus_analysis: true # Log detailed focus analysis
log_interval: 30 # Frames between logs
# UI Settings
ui:
show_frame_count: true
show_fps: true
show_focus_percentage: true
show_emotion: true
show_posture: true
visual_feedback:
enabled: true
show_gaze_point: true
show_face_mesh: false # Disabled for performance
face_mesh_alpha: 0.5
face_mesh_smoothing: 0.35
face_mesh_mode: full
face_mesh_stride: 4
face_mesh_triangles_every_n_frames: 3
face_mesh_triangles_max_points: 140
show_skeleton: false # Disabled for performance