π Basketball Analysis System - Setup Complete! β
System Status: READY FOR TESTING
Your basketball analysis system is now fully configured and ready to test with the pre-trained models from the basketball_analysis repository.
β What's Been Set Up
1. Pre-trained Models (All Downloaded & Verified)
- β
player_detector.pt(164.65 MB) - YOLO v11 player detection - β
ball_detector_model.pt(164.67 MB) - YOLO v5 ball detection - β
court_keypoint_detector.pt(398.37 MB) - YOLO v8 court keypoints
2. Dependencies (All Installed)
- β OpenCV 4.13.0
- β NumPy 2.3.5
- β Pandas 3.0.0
- β PyTorch 2.10.0+cpu (CPU version for compatibility)
- β Ultralytics 8.4.9
- β Supervision 0.27.0
- β Transformers 5.0.0
- β Pillow 12.0.0
3. Test Videos Available
- β video_1.mp4 (4.24 MB)
- β video_2.mp4 (6.69 MB)
- β video_3.mp4 (9.06 MB)
- β video_4.mp4 (6.60 MB)
4. Testing Scripts Created
- β
test_system.py- Comprehensive system testing - β
run.sh- Convenient bash wrapper - β
TESTING_GUIDE.md- Detailed testing guide - β
QUICK_REFERENCE.md- Quick command reference
π Quick Start - Test the System Now!
Option 1: Using the Convenience Script (Easiest)
# Navigate to back-end directory
cd /home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end
# Run analysis on first test video
./run.sh input_videos/video_1.mp4
Option 2: Using Python Directly
# Navigate to back-end directory
cd /home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end
# Activate virtual environment
source venv/bin/activate
# Run analysis
python main.py input_videos/video_1.mp4
Option 3: Using the Test Script
cd /home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end
source venv/bin/activate
# Run full test
python test_system.py
π What the Analysis Does
The system performs comprehensive basketball video analysis:
- Player Detection & Tracking - Identifies and tracks all players
- Ball Detection & Tracking - Tracks basketball with smooth interpolation
- Court Keypoint Detection - Identifies court lines and zones
- Team Assignment - Classifies players by jersey color
- Ball Possession - Determines who has the ball
- Pass Detection - Identifies passes between players
- Interception Detection - Detects intercepted passes
- Tactical View - Creates top-down mini-map
- Speed & Distance - Calculates player movement metrics
Output Features
The analyzed video will include:
- Player bounding boxes (color-coded by team)
- Ball tracking visualization
- Court keypoint overlays
- Team ball control statistics
- Pass and interception markers
- Tactical view (mini-map)
- Player speed and distance metrics
- Frame numbers
β±οΈ Expected Processing Time
First Run (No Cached Data)
- CPU Only: ~5-15 minutes per minute of video
- The system will create "stubs" (cached intermediate results)
Subsequent Runs (With Cached Data)
- Much Faster: Reuses cached player/ball detections
- Only recomputes final visualization
Performance Tips
- Start with short clips (10-30 seconds) for faster testing
- Keep the
stubs/directory for faster re-runs - Delete
stubs/to force fresh analysis
π Output Location
Analyzed videos will be saved to:
/home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end/output_videos/
Default output filename: output_video.avi (or custom name if specified)
π₯ Adding Your Own Test Videos
Place basketball video files in:
/home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end/input_videos/Supported formats:
.mp4,.aviRecommended video characteristics:
- Resolution: 720p or 1080p
- Frame rate: 30fps or higher
- Clear view of basketball court
- Good lighting
- Stable camera angle
Run analysis:
./run.sh input_videos/your_video.mp4
π System Verification
All checks passed β :
- All dependencies installed
- All models present and loading correctly
- Test videos available
- Directory structure set up
- Virtual environment configured
π Documentation
- TESTING_GUIDE.md - Comprehensive testing guide with troubleshooting
- QUICK_REFERENCE.md - Quick command reference
- test_system.py - Automated system testing
- run.sh - Convenience script for running analysis
π Troubleshooting
If you encounter issues:
Ensure virtual environment is activated:
source venv/bin/activateCheck system status:
python test_system.py --check-onlyView detailed logs: Check console output for error messages
Clear cache and retry:
rm -rf stubs/ python main.py input_videos/video_1.mp4
π Notes
CPU vs GPU: Currently using PyTorch CPU version for compatibility
- Processing will be slower than GPU but fully functional
- If you have CUDA-capable GPU and want to use it, you can reinstall PyTorch with CUDA support
Stub Caching: The system caches intermediate results in
stubs/- First run: Slower (creates cache)
- Subsequent runs: Much faster (uses cache)
- Delete
stubs/to force fresh analysis
Video Quality: Better quality input videos = better detection results
- Clear court view
- Good lighting
- Stable camera
- Visible players and ball
π― Next Steps
1. Test the System (NOW!)
cd /home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end
./run.sh input_videos/video_1.mp4
2. Review Output
- Check
output_videos/for the analyzed video - Verify all analysis features are working
- Test with different input videos
3. Integration Planning
Once testing is successful:
- Integrate with FastAPI backend
- Add video upload endpoints
- Implement async processing
- Store results in Supabase
- Connect to frontend
π Ready to Go!
Your system is fully prepared and ready for testing. Run your first analysis now:
cd /home/okidi6/Documents/Personalised-AI-Basketball-Skill-Analysis-System./back-end
./run.sh input_videos/video_1.mp4
Good luck with your testing! π
π Support Resources
- TESTING_GUIDE.md - Detailed testing instructions
- QUICK_REFERENCE.md - Command reference
- Original Repository: https://github.com/abdullahtarek/basketball_analysis
- System Check:
python test_system.py --check-only
System Status: β READY FOR TESTING
Last Verified: 2026-02-01 13:16 UTC
All Systems: β GO!