Jerry Hill commited on
Commit
fe128fc
·
2 Parent(s): 5988ab2cc85241

Merge branch 'main' of https://huggingface.co/datasets/rocket-wave/hf-video-scoring into main

Browse files
Files changed (1) hide show
  1. SPEED_OPTIMIZATIONS.md +0 -110
SPEED_OPTIMIZATIONS.md DELETED
@@ -1,110 +0,0 @@
1
- # NFL Play Detection Speed Optimizations
2
-
3
- ## 🚀 Current Performance (Medium Model - Optimal Quality)
4
-
5
- ### Speed Test Results:
6
- - **Average per clip**: 16.67s
7
- - **Throughput**: 3.6 clips/minute
8
- - **Video classification**: 2.22s
9
- - **Audio transcription**: 13.09s
10
- - **Play state analysis**: <0.001s
11
-
12
- ### Processing Time Estimates:
13
- - **10 clips**: ~2.8 minutes
14
- - **50 clips**: ~13.9 minutes
15
- - **100 clips**: ~27.8 minutes
16
- - **1 hour of footage (1800 clips)**: ~8.3 hours
17
-
18
- ## 🎯 Optimizations Implemented
19
-
20
- ### 1. **Model Selection**
21
- - **Whisper-Medium**: 3GB model for optimal NFL broadcast transcription
22
- - **Trade-off**: Slower than base model but essential for complex broadcast audio
23
- - **Recommendation**: Medium model is required for accurate NFL commentary transcription
24
-
25
- ### 2. **Speed-Optimized Parameters**
26
- ```python
27
- # Audio transcription optimizations
28
- generate_kwargs={
29
- "language": "en", # Skip language detection
30
- "task": "transcribe", # No translation
31
- "temperature": 0.0, # Deterministic (fastest)
32
- "do_sample": False, # Greedy decoding
33
- "num_beams": 1, # Single beam search
34
- }
35
- ```
36
-
37
- ### 3. **Video Processing Optimizations**
38
- - Disabled debug logging for production speed
39
- - Optimized preprocessing pipeline
40
- - Efficient tensor operations
41
-
42
- ### 4. **Enhanced Play Detection**
43
- - **Play State Classification**: Categorizes clips as `play_active`, `play_action`, `non_play`, or `unknown`
44
- - **Sequence Analysis**: Detects play boundaries across multiple clips
45
- - **NFL-Specific Logic**: Custom weights for football-related actions
46
-
47
- ## 📊 Play Detection Accuracy Improvements
48
-
49
- ### New Play State Categories:
50
- 1. **`play_active`**: Active football plays (passing, kicking)
51
- 2. **`play_action`**: Football-related actions (catching, throwing)
52
- 3. **`non_play`**: Non-game activities (applauding, marching)
53
- 4. **`unknown`**: Low confidence or unclear state
54
-
55
- ### Sequence Boundary Detection:
56
- - **Play Start**: Transition from `non_play` → `play_active/action`
57
- - **Play End**: Transition from `play_active/action` → `non_play`
58
- - **Confidence Thresholds**: Configurable confidence levels
59
-
60
- ## 🔧 Further Optimization Options
61
-
62
- ### For Even Faster Processing:
63
- 1. **Disable Audio Transcription**: ~7x faster (video only, ~2.2s per clip)
64
- 2. **Use Whisper-Base**: ~4x faster but much lower accuracy for broadcasts
65
- 3. **GPU Acceleration**: Use CUDA if available
66
- 4. **Model Quantization**: INT8 quantized models
67
- 5. **Batch Processing**: Process multiple clips simultaneously
68
-
69
- ### For Better Accuracy:
70
- 1. **Whisper-Large**: Highest accuracy but even slower
71
- 2. **Custom Fine-tuning**: Train on NFL-specific data
72
- 3. **Ensemble Methods**: Combine multiple models
73
- 4. **Temporal Context**: Use longer sequences
74
-
75
- ## 🎬 Usage Examples
76
-
77
- ### Speed Testing:
78
- ```bash
79
- python speed_test.py
80
- ```
81
-
82
- ### Fast Batch Processing:
83
- ```bash
84
- python run_all_clips.py
85
- ```
86
-
87
- ### Single Clip with Play Analysis:
88
- ```bash
89
- python inference.py data/segment_001.mov
90
- ```
91
-
92
- ## 📈 Performance Tuning Tips
93
-
94
- 1. **For Real-time**: Consider video-only processing (~2.2s per clip)
95
- 2. **For Batch Processing**: Current 16.67s/clip provides excellent transcription quality
96
- 3. **For Large Datasets**: Consider parallel processing or overnight batch jobs
97
- 4. **Memory Usage**: ~6GB RAM with Whisper-Medium
98
-
99
- ## 🏈 Play Detection Features
100
-
101
- ### Intelligent Football Analysis:
102
- - Recognizes 80+ NFL terms (teams, positions, plays)
103
- - Corrects common speech recognition errors
104
- - Provides confidence scores for decisions
105
- - Generates comprehensive play analysis reports
106
-
107
- ### Output Files:
108
- - `classification.json`: Video classification results
109
- - `transcripts.json`: Audio transcription results
110
- - `play_analysis.json`: Play state and boundary analysis