How tuda1921/awakedrive_app_stt works
Project Type and Purpose
• This is a full-stack federated learning system comprising:
• A native Android mobile application (“mobile_app”) that collects brainwave data, performs local inference/training, and communicates with a remote server.
• A Spring Boot-based federated learning server (“federated_server”) that exposes REST endpoints, aggregates model updates, hosts the global model, and schedules federation rounds.
• The overall goal (“Awake Drive”) appears to be real-time brainwave monitoring and adaptive model training via federated learning across mobile clients.
File Structure Analysis
• Top level: two sibling modules:
• federated_server – a Gradle-based Spring Boot service
• mobile_app – a Gradle-based Android application
• federated_server/src/main/java/com/example/federatedserver:
– Controller.java: REST API for model upload/download
– ClassifierNNTrain/Test/AverageWeights.java: ML model training, evaluation, weight aggregation
– ScheduledTasks.java: kicks off federation rounds on schedule
– application.properties: config (port, datasource, scheduling)
• federated_server/src/main/resources/model & dataset:
– Pretrained and client model zips, CSV training/testing data
• mobile_app/app/src/main/java/com/example/brainwave:
– Activities: HomeActivity, AttentionActivity, SleepActivity, ModelsActivity, UpdateActivity, LabeledActivity
– Services/Helpers: AlertService, BluetoothAdapterActivity (connect EEG device), DrawWaveView, TrainModel (local training), LocalDataSet
– Uses libStreamSDK.jar for real-time signal streaming
• mobile_app communicates via HTTP to federated_server; stores models locally; renders UI views in res/layout; applies ProGuard rules.
Key Architecture Insights from README
• Very minimal README, but project name (“Awake Drive”) implies a brainwave-driven application leveraging federated learning.
a. Main Components
1) External EEG Sensor Device (via Bluetooth)
2) Android Mobile App
– Bluetooth Adapter Service
– Signal Processing & Visualization (DrawWaveView)
– Local Dataset & Model Training Module
– HTTP Client Module (REST API consumer)
3) Federated Learning Server
– REST API Controller
– Model Aggregation Engine (ScheduledTasks + ClassifierNNAverageWeights)
– Training/Evaluation Modules (ClassifierNNTrain, ClassifierNNTest)
– Model & Dataset Storage (filesystem resources)
4) Data Store (server’s file system holding CSVs and model zips)
b. Relationships & Data Flows
1) EEG Sensor → Bluetooth Adapter → Signal Processing on App
2) App → Local Training (TrainModel) → Local Model .zip
3) App → HTTP POST to Server’s /upload endpoint (Controller)
4) Server ScheduledTasks → fetches all client updates → uses ClassifierNNAverageWeights → produces new global model
5) Server → makes global model available via /download endpoint
6) Mobile App periodically GETs updated model → replaces local model
c. Architectural Patterns & Principles
• Client-Server separation with clear API contract (REST)
• Federated Learning pattern: decentralized local training + centralized aggregation
• Scheduled batch jobs for periodic aggregation (cron style)
• Modularity: distinct packages for training, testing, aggregation
• Android MV* style: Activities + Services + Views + local storage
d. Technologies & Frameworks
• Backend: Java 17+, Spring Boot, Gradle, Scheduled Tasks
• Frontend: Android SDK, Java, libStreamSDK for signal streaming
• Data formats: CSV for datasets, ZIP for model artifacts
• Communication: HTTP/JSON REST
Final Recommendations
• Be exhaustive: break down the mobile app into Bluetooth interface, UI Activities, local ML modules.
• Federated learning loop explicitly: training → upload → aggregation → distribution.
• Use consistent iconography and layout: client on left, server on right, data store below server, external sensor above client.