Computer Science Project
London BSc Computer Systems Engineering
London South Bank University
DABTTB (Dynamic Analysis of Ball Trajectory in Table Tennis) is an advanced AI-powered system for real-time table tennis ball tracking and analysis. This project combines computer vision, machine learning, and physics-based validation to provide accurate ball detection, trajectory analysis, and anomaly detection in table tennis videos.
- 3D Trajectory Cube: Revolutionary interactive 3D ball path visualization
- Multi-Dimensional Analysis: X, Y, and Time dimensions with depth perception
- Color-Coded Confidence: Plasma colormap showing detection reliability
- Professional Dashboard: 7-panel enhanced analytics layout
- Academic Presentation: University-branded professional output
- YOLO Object Detection: State-of-the-art ball detection with high accuracy
- Gemma 3N Multimodal AI: Advanced multimodal analysis capabilities
- Real-time Processing: Efficient video analysis with GPU acceleration
- CUDA Acceleration: NVIDIA GPU support for real-time performance
- Interactive 3D Trajectory: Revolutionary cube visualization with trajectory paths
- Physics-Based Validation: Realistic ball movement analysis
- Anomaly Detection: Identification of unrealistic or outlier detections
- Performance Metrics: Comprehensive analysis statistics
- Data Quality Pipeline: Automated cleaning and validation
- Integrated Quality Pipeline: Automated outlier detection and cleaning
- Single Ball Enforcement: Physics-compliant detection (one ball at a time)
- Confidence Analysis: Detection confidence pattern validation
- Movement Validation: Realistic ball movement constraints
- Quality Reporting: Before/after statistics and metrics
- 7-Panel Analytics Layout: Professional comprehensive dashboard
- Real-time 3D Visualization: Interactive trajectory cube
- Export Capabilities: Data export in multiple formats
- Visual Reports: Enhanced trajectory and statistics visualization
- University Branding: Academic presentation ready
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend UI β β AI Service β β Database β
β (React/HTML) βββββΊβ (FastAPI) βββββΊβ (DuckDB) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
β β β
ββββββΌβββββ βββββΌββββ ββββββΌβββββ
β Upload β β YOLO β β Video β
β Videos β β Model β β Metadataβ
βββββββββββ βββββββββ βββββββββββ
β
ββββββΌβββββ
β Gemma β
β 3N AI β
βββββββββββ
- Docker and Docker Compose
- NVIDIA GPU with CUDA support (recommended)
- Python 3.8+ (for local development)
- Git LFS (for large model files)
Important: This project uses large AI models that need to be downloaded separately:
The Gemma 3N model is not included in the repository due to size constraints. Download it from HuggingFace:
# Create model directory
mkdir -p ai-service/model_files/gemma-3n-E4B
# Download from HuggingFace (requires huggingface-hub)
pip install huggingface-hub
huggingface-cli download google/gemma-3n-2b-it --local-dir ai-service/model_files/gemma-3n-E4BAlternative: Visit HuggingFace Gemma 3N and download manually to ai-service/model_files/gemma-3n-E4B/
YOLO models are automatically downloaded by Ultralytics on first run. No manual setup required.
-
Clone the repository:
git clone <repository-url> cd DABTTB
-
Download required models (see Model Setup above)
-
Build and run with Docker Compose:
docker-compose up --build
-
Access the application:
- Frontend: http://localhost:3005
- API Documentation: http://localhost:8005/docs
- Upload Video: Use the web interface to upload a table tennis video
- Analysis: The system automatically runs Gemma-Enhanced Detection with advanced AI analysis
- View Results: Access comprehensive analytics including 3D trajectory visualization
- Export Data: Download analysis results and visualizations
DABTTB/
βββ ai-service/ # Core AI service
β βββ core/ # Configuration and utilities
β βββ services/ # AI services (models, analysis)
β βββ breakthrough/ # Advanced detection system
β βββ main.py # FastAPI application
βββ frontend/ # Web interface
β βββ public/ # Static assets
β βββ src/ # React components (if applicable)
βββ docs/ # Documentation
βββ docker-compose.yml # Container orchestration
βββ Dockerfile # Container definition
βββ README.md # This file
- YOLO11: Object detection for ball identification
- Gemma 3N: Multimodal AI for advanced analysis
- Custom Physics Engine: Ball trajectory validation
- Video Upload: Secure file upload and validation
- Frame Extraction: Efficient video processing
- Ball Detection: AI-powered object detection
- Trajectory Analysis: Physics-based movement validation
- Anomaly Detection: Outlier identification and cleaning
- Results Storage: Persistent data storage in DuckDB
- Static Position Detection: Identifies unrealistic stationary balls
- Confidence Uniformity Analysis: Detects artificial confidence patterns
- Movement Validation: Ensures realistic ball physics
- Single Ball Enforcement: Maintains physical constraints
- Before Optimization: 100% detection rate (unrealistic)
- After Optimization: 21.4% detection rate (realistic)
- Outlier Reduction: 78.6% improvement in data quality
- GPU Acceleration: NVIDIA CUDA support
- Memory Optimization: Dynamic VRAM allocation
- Real-time Processing: Efficient video analysis
- Database Performance: Optimized DuckDB queries
POST /analyze- Video analysisPOST /detect- Object detectionGET /health- Health checkGET /metrics- Performance metrics
GET /analytics/summary- Analysis summaryGET /analytics/detections- Detection dataPOST /analytics/export- Data export
POST /analyze/breakthrough- Advanced detectionPOST /breakthrough/validate- Validation system
# Run test suite
python -m pytest tests/
# Run specific test categories
python -m pytest tests/test_detection.py
python -m pytest tests/test_analytics.py- Upload test videos through the web interface
- Verify detection accuracy and trajectory analysis
- Test anomaly detection and data cleaning features
The interactive analytics dashboard provides:
- Real-time Visualization: Live trajectory mapping
- Statistical Analysis: Comprehensive detection metrics
- Data Export: CSV and JSON export capabilities
- Performance Monitoring: System health and metrics
# AI Service Configuration
AI_SERVICE_PORT=8005
MODEL_PATH=/app/models
DEVICE=cuda
# Database Configuration
DB_PATH=/app/results/dabttb.duckdb
# Frontend Configuration
FRONTEND_PORT=3000
API_URL=http://localhost:8005- GPU Support: NVIDIA runtime enabled
- Volume Mounts: Persistent data storage
- Network Configuration: Service communication
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is part of a Computer Science degree program at London South Bank University. All rights reserved.
Institution: London South Bank University
Program: BSc Computer Systems Engineering
Project Type: Computer Science Final Year Project
Focus Areas: Computer Vision, Machine Learning, Data Analysis
- London South Bank University Computer Science Department
- YOLO11 and Ultralytics team for object detection models
- Google for Gemma 3N multimodal AI capabilities
- FastAPI and modern web development communities
Β© 2025 DABTTB AI Service - Computer Science Project
London BSc Computer Systems Engineering
London South Bank University