K-SoftVation Showcase 2025 β Grand Prize (Minister of Science and ICT Award) Real-time human focus analytics system with optimized AI inference serving and WebSocket-based streaming architecture.
| Item | Detail |
|---|---|
| Competition | K-Software Empowerment BootCamp β K-SoftVation Showcase 2025 |
| Prize | Grand Prize (μ 보ν΅μ κΈ°ννκ°μμ₯μ) |
| Team | Queen Never Cry |
| Date | August 28, 2025 |
BrainBuddy is a real-time human focus analytics system that estimates user engagement levels from webcam streams.
The project was designed to address the gap between high offline model performance and unstable real-world webcam inference environments.
The system combines:
- Computer Vision
- Real-time inference serving
- ONNX optimization
- WebSocket streaming
- Data-centric AI pipeline design
| Metric | Result |
|---|---|
| AUC | 0.997 |
| F1-Score | 0.963 |
| Accuracy | 0.9505 |
| Recall | 0.9778 |
| CPU Latency | ~890ms |
| Serving Framework | FastAPI + WebSocket + ONNX Runtime |
- Identified domain gap between AI Hub training data and real-world webcam environments
- Designed a 4-stage automated labeling pipeline using CLIP (ViT-B/32)
- Trained CNN (ResNet18) + Bi-LSTM sequence model
- Built real-time FastAPI + WebSocket serving pipeline
- Solved preprocessing mismatch issues causing unstable production inference
- Optimized deployment using ONNX Runtime
Webcam Stream
β
WebSocket Streaming
β
Preprocessing Pipeline
ββ BGR β RGB Conversion
ββ Face Cropping
ββ ImageNet Normalization
β
Sliding Window Buffer (30 Frames)
β
ONNX Runtime Inference
β
Focus Score (%) + Latency Output
brainbuddy_AI/
β
βββ app/
β βββ main.py
β βββ services/
β βββ preprocessor.py
β βββ inference.py
β
βββ scripts/
β βββ export_onnx.py
β
βββ onnx_model/
β
βββ preprocessing/
β βββ clip1_1.py
β βββ clip1_2.py
β βββ clip1_3.py
β βββ clip1_4.py
β
βββ models/
βββ datasets/
βββ EDA/
β
βββ train.py
βββ real_time.py
βββ requirements.txtModels trained on the AI Hub eye-tracking dataset failed completely in real webcam environments.
Root causes identified:
- unreliable labels
- noisy engagement annotations
- mismatch between training and inference distributions
Examples:
- head-turning labeled as βunfocusedβ
- smartphone viewing labeled as βfocusedβ
| Step | Description | Result |
|---|---|---|
| Step 1 | CLIP zero-shot labeling | 1,464 folders processed |
| Step 2 | Confidence interval filtering | 147 high-confidence samples |
| Step 3 | Linear Probe training | ROC-AUC 0.9806 |
| Step 4 | Full dataset relabeling | Focused 890 / Unfocused 574 |
CNN (ResNet18, ImageNet pretrained)
β
Frame-level feature extraction
β
Bi-LSTM sequence modeling
β
Fully Connected Layer
β
Sigmoid β Focused / Unfocused
During the original competition integration phase, the backend inference pipeline consistently returned:
prob β 0.02As a result, the model always predicted the βunfocusedβ state regardless of input.
Due to time constraints, another model was used for the final competition submission.
After the competition, I independently rebuilt the serving pipeline and identified the root causes.
The issue was caused by preprocessing inconsistency between training and inference environments.
- Missing BGR β RGB conversion
- Missing face cropping pipeline
- Missing ImageNet normalization
These mismatches caused severe inference distribution shift.
Implemented:
- BGR β RGB conversion
- face cropping
- ImageNet normalization
Additional troubleshooting:
- MediaPipe compatibility issues in Python 3.13
- Replaced with OpenCV Haar Cascade pipeline
- Converted PyTorch model to ONNX Runtime
- Embedded sigmoid operation into
ServingWrapper - Configured dynamic batch axes
- ONNX Runtime CPUExecutionProvider
- Real-time latency measurement logic
- Achieved approximately 890ms latency
- Measured using 30-frame sliding window inference
- FastAPI + WebSocket architecture
- 10+ FPS real-time frame streaming
- Sliding window buffering:
collections.deque(maxlen=30)- memory optimization
- stable sequence inference
- reduced redundant processing
| Metric | Score |
|---|---|
| AUC | 0.997 |
| F1-Score | 0.963 |
| Accuracy | 0.9505 |
| Recall | 0.9778 |
| CPU Inference Latency | ~890ms |
pip install -r requirements.txt
python scripts/export_onnx.py
uvicorn app.main:app --reloadConnect WebSocket client to:
ws://localhost:8000/ws
- CLIP-based labeling pipeline
- CNN + Bi-LSTM training pipeline
- FastAPI + WebSocket real-time serving
- ONNX optimization
- Real-time latency optimization
- Personal repository migration
- Docker Compose deployment
- Monitoring & logging
- Architecture visualization
- Production benchmark testing
FastAPI Β· WebSocket Β· ONNX Runtime Β· Docker
PyTorch Β· ResNet18 Β· Bi-LSTM Β· CLIP (ViT-B/32)
scikit-learn Β· UMAP Β· NumPy Β· Pandas
OpenCV Β· Haar Cascade Β· Torchvision
This project taught me that reliable AI systems depend not only on model accuracy, but also on:
- preprocessing consistency
- inference environment alignment
- deployment stability
- real-time serving architecture
- production debugging capability
- latency optimization
Applied AI Engineer focused on:
- real-time AI systems
- AI infrastructure
- human-centered analytics
- deployable ML serving systems