Spaces:
Sleeping
Sleeping
File size: 4,068 Bytes
ef4a6ad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# GATE Motion Analysis - Deployment Guide
## Quick Start Options
### Option 1: Test Locally First (Recommended)
```powershell
# 1. Navigate to deployment folder
cd gradio_deployment
# 2. Install requirements
pip install -r requirements.txt
# 3. Test locally
python app.py
```
### Option 2: Deploy to Hugging Face Spaces
#### Prerequisites
1. Create a Hugging Face account at https://huggingface.co/join
2. Create an access token at https://huggingface.co/settings/tokens
- Select "Write" permissions
- Copy the token (starts with `hf_`)
#### Deployment Steps
```powershell
# 1. Login to Hugging Face (paste your token when prompted)
huggingface-cli login
# 2. Deploy using Gradio
gradio deploy --title "GATE Motion Analysis" --app-file app.py
# 3. Follow the prompts to create your Space
```
## Performance Optimisations Implemented
### ✅ Fixed Issues
- **Emojis Removed**: Clean British English interface
- **Skeleton Overlay**: Proper pose detection with visual feedback
- **GPU Acceleration**: Automatic detection and optimisation
- **Streaming FPS**: Optimised from 10 FPS to 30 FPS
- **Memory Management**: Efficient GPU memory usage
### 🚀 Performance Features
- **Dynamic GPU Detection**: Automatically uses best available hardware
- **YOLOv8 Integration**: GPU-accelerated pose detection
- **MediaPipe Fallback**: CPU compatibility for wider deployment
- **Real-time Streaming**: 30-60 FPS depending on hardware
- **Memory Optimisation**: Reduced buffer sizes for instant feedback
## Hardware Requirements
### Minimum (CPU Only)
- **CPU**: 4+ cores
- **RAM**: 8GB system memory
- **FPS**: ~15 FPS with MediaPipe
### Recommended (GPU)
- **GPU**: CUDA-compatible with 4GB+ VRAM
- **CPU**: 6+ cores
- **RAM**: 16GB system memory
- **FPS**: 60+ FPS with YOLOv8
### Optimal (High-end GPU)
- **GPU**: RTX 3080/4080+ or Tesla V100+
- **VRAM**: 8GB+ dedicated
- **CPU**: 8+ cores
- **RAM**: 32GB system memory
- **FPS**: 120+ FPS with YOLOv8
## Configuration Options
The deployment automatically detects your hardware and optimises settings:
```python
# Automatic configuration based on detected hardware
{
"CPU Only": {
"fps": 15,
"model": "mediapipe",
"threads": 4
},
"GPU Available": {
"fps": 60,
"model": "yolov8s-pose",
"precision": "fp16"
},
"High-end GPU": {
"fps": 120,
"model": "yolov8m-pose",
"precision": "fp16"
}
}
```
## Troubleshooting
### Common Issues
1. **Import Errors**
```bash
pip install -r requirements.txt
```
2. **CUDA Not Available**
- Check GPU drivers
- Install PyTorch with CUDA support
```bash
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
```
3. **Memory Issues**
- Reduce batch size in config.py
- Use smaller model (yolov8n-pose.pt)
4. **Low FPS**
- Check GPU utilisation
- Reduce image resolution
- Use CPU fallback mode
### Performance Monitoring
Monitor your deployment performance:
```python
# Check GPU utilisation
import torch
if torch.cuda.is_available():
print(f"GPU Memory: {torch.cuda.memory_allocated(0)/1e9:.1f}GB")
print(f"GPU Utilisation: {torch.cuda.utilization(0)}%")
```
## Security Considerations
For public deployment:
- API endpoints are disabled
- File access is restricted
- No user authentication required (demo mode)
- HTTPS enabled by default on Hugging Face Spaces
## Next Steps
1. **Test Locally**: Start with local testing to verify functionality
2. **Deploy to Spaces**: Use Gradio deploy for public access
3. **Monitor Performance**: Check logs and usage metrics
4. **Scale if Needed**: Consider dedicated GPU instances for high traffic
## Support
If you encounter issues:
1. Check the deployment logs
2. Verify hardware compatibility
3. Test with reduced settings
4. Contact the development team with specific error messages |