A comprehensive full-stack machine learning application featuring pose detection, exercise analysis, and performance scoring. The system uses models registered in MLflow for expert score prediction, weakest link classification, and real-time squat form analysis through pose estimation.
Note: For an in-depth explanation of our system architecture, coding conventions, testing strategies, API design, security practices, and development workflow, please refer to our GitLab Wiki (out dated):
Design-and-Coding-Rules-Summary
# 1. Start MLflow Server
mlflow server --host 127.0.0.1 --port 4800
# 2. Set up Backend
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python src/app.py
# 3. Set up Frontend
cd frontend
npm install
npm run build
npm run previewVisit:
- Frontend: http://localhost:4173
- Backend: http://localhost:5000
- MLflow UI: http://127.0.0.1:4800
- Python 3.11
- Key dependencies (all included in
requirements.txt):- FastAPI 0.115.8
- MLflow 2.20.3
- uvicorn 0.34.0
- python-multipart 0.0.20
- TensorFlow 2.19.0
- Keras 3.9.2
- pandas 2.2.3
- joblib 1.4.2
- aiofiles 23.2.1
- Node.js 22.13.1
- npm 10.9.2
- Vue.js 3.5.13
- Key dependencies:
- @tensorflow/tfjs 4.13.0
- @tensorflow-models/pose-detection 1.0.0
- three.js 0.176.0
- axios 1.7.9
- pinia 2.3.1
The MLflow server needs to be running before starting the application:
mlflow server --host 127.0.0.1 --port 4800Configuration in config.py:
MLFLOW_URI = "http://127.0.0.1:4800"
EXPERT_SCORE_CHAMPION = "models:/ChampionModel@expert_score_champion"
WEAKEST_LINK_CHAMPION = "models:/ChampionModel@weakest_link_champion"
POSE_TRANSFORMER_URI = "models:/PoseCoordinateTransformer@coordinate_transformer_champion"
DEPTH_ESTIMATOR_URI = "models:/PoseDepthEstimator@depth_estimator_champion"
SEQUENCE_DETECTOR_URI = "models:/SquatSequenceDetector@sequence_detector_champion"
FORM_CLASSIFIER_URI = "models:/SquatFormClassifier@form_classifier_champion"
PERFORMANCE_SCORER_URI = "models:/SquatPerformanceScorer@performance_scorer_champion"- Create and activate virtual environment:
cd backend python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Start the FastAPI server:
uvicorn main:app --host 0.0.0.0 --port 5000
- Install dependencies:
cd frontend npm install - Start development server:
npm run dev # Development mode # or npm run build && npm run preview # Production mode
Project_in_data_intensive/
βββ backend/ # FastAPI backend application
β βββ src/ # Source code
β β βββ app.py # Main application entry point
β β βββ config.py # Configuration and model URIs
β β βββ controllers/ # API route controllers
β β βββ services/ # Business logic services
β β βββ schemas/ # Pydantic data models
β β βββ utils/ # Utility functions and scalers
β β βββ tests/ # Unit and integration tests
β βββ requirements.txt # Python dependencies
β βββ pyproject.toml # Project configuration
βββ frontend/ # Vue.js frontend application
β βββ src/ # Source code
β β βββ components/ # Vue components
β β βββ views/ # Page views
β β βββ services/ # API services
β β βββ router/ # Application routing
β βββ public/ # Static assets and 3D models
β βββ package.json # Node.js dependencies
βββ ML/ # Machine learning experiments
β βββ classification/ # Classification models notebooks
β βββ linearregression/ # Regression models notebooks
β βββ deeplearning/ # Deep learning models notebooks
βββ reports/ # Assignment reports
βββ training_data/ # Pose data storage
Set MLflow tracking URI in your notebooks:
import mlflow
mlflow.set_tracking_uri("http://127.0.0.1:4800")- MLflow UI should be accessible at
http://127.0.0.1:4800 - Backend API should be accessible at
http://localhost:5000 - Frontend should be accessible at
http://localhost:4173(production) orhttp://localhost:5173(development)
The backend provides the following main endpoints:
- POST
/api/v1/expert-score/predict- Expert score prediction - POST
/api/v1/weakest-link/predict- Weakest link classification - POST
/api/v1/pose/upload- Pose data upload and analysis - GET
/api/v1/pose/sessions- List pose analysis sessions - GET
/api/v1/pose/sessions/{session_id}/feedback- Get comprehensive feedback
The backend follows a service-oriented architecture with the following key services:
-
Core ML Services
LinearRegressionService: Expert score predictionsClassificationService: Weakest link classification
-
Pose Analysis Pipeline
KeypointStorageService: Pose data persistenceFeatureEngineeringService: Biomechanical feature extractionExerciseDetectionService: Squat sequence identificationPose2Dto3DService: 2D to 3D coordinate transformationSquatFormClassificationService: Form quality assessmentSquatPerformanceScoringService: Performance quantificationSquatFeedbackService: Comprehensive feedback generationPoseOrchestratorService: Central coordination hub
-
Controllers
RegressionController: Handles regression prediction requestsClassificationController: Manages classification requestsPoseController: Orchestrates pose analysis workflows
-
Port Conflicts
- Ensure ports 4800, 5000, and 4173 are available.
- Check for other services using these ports.
-
MLflow Connection Issues
- Verify the MLflow server is running.
- Check URI configuration in
config.py. - Ensure consistent URIs across all components.
-
Backend Issues
- Verify all dependencies are installed.
- Check Python version compatibility.
- Ensure the virtual environment is activated.
-
Frontend Issues
- Clear npm cache if needed:
npm cache clean --force Remove-Item -Recurse -Force node_modules npm install
- Check URI configuration in
config.js.
- Clear npm cache if needed:
-
Model Loading Issues
-
Pose Detection Issues
- Verify TensorFlow.js models are properly loaded
- Check camera permissions in browser
- Ensure sufficient lighting for pose detection
- MLflow Server: Must remain running during development.
- Backend Dependency: Ensure the virtual environment is activated before running commands.
- Frontend: If issues arise, clear the npm cache or reinstall dependencies.
- For additional details on coding standards, linters and development workflow, please check our GitLab Wiki:
Design-and-Coding-Rules-Summary
For detailed guidelines on commit message conventions, branch naming, and versioning, please refer to our GitLab Wiki:
Design-and-Coding-Rules-Summary