anishxagrawal Adit-jain commited on
Commit
1e0f95f
·
verified ·
0 Parent(s):

Duplicate from Adit-jain/Soccana_player_ball_detection_v1

Browse files

Co-authored-by: Adit Jain <Adit-jain@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text
60
+ V1/coco_train_annotations/_annotations.coco.json filter=lfs diff=lfs merge=lfs -text
61
+ V1/labels/test.cache filter=lfs diff=lfs merge=lfs -text
62
+ V1/labels/train.cache filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ task_categories:
3
+ - object-detection
4
+ language:
5
+ - en
6
+ tags:
7
+ - soccer
8
+ - football
9
+ - player
10
+ - referee
11
+ - detection
12
+ - ball
13
+ - ultralytics
14
+ - yolov11
15
+ - tracking
16
+ pretty_name: Soccana_prb_v1
17
+ size_categories:
18
+ - 10K<n<100K
19
+ ---
20
+
21
+ # ⚽ Soccer Object Detection Dataset (25K Subset from 1M+ Images)
22
+
23
+ ---
24
+
25
+ ## Index
26
+
27
+ 1. [Dataset Overview](#dataset-overview)
28
+ 2. [Folder Structure](#folder-structure)
29
+ 3. [Dataset Preparation](#dataset-preparation)
30
+ 4. [Data Utils](#data-utils)
31
+ 5. [Samples](#samples)
32
+
33
+ ## Dataset Overview
34
+
35
+ This dataset is a curated subset (25,000 images) from a larger soccer vision dataset containing over **1 million images** (50+ GB). The data was collected and augmented from multiple **open-source sources**, including the **SoccerNet dataset**, video game renders, and publicly available match footage.
36
+
37
+ It is optimized for **object detection tasks**, especially focusing on soccer-related entities such as **players**, **referees**, and the **ball**, including various augmentation types like background-only and noisy scenes.
38
+
39
+
40
+ - ✅ 25,000 images (~1.5GB)
41
+ - ✅ Annotations for 3 object classes:
42
+ - `player`
43
+ - `referee`
44
+ - `ball`
45
+ - ✅ Data format:
46
+ - **Ultralytics YOLO format** (default)
47
+ - **COCO JSON format** (included in separate folders)
48
+ - ✅ Resolution variety:
49
+ - `160x160`
50
+ - `320x320`
51
+ - `640x640`
52
+ - `1280x1080` (Full HD)
53
+ - The dataset includes frames for various scenarios, such as:
54
+ - Occlusions
55
+ - Close up shots
56
+ - Behind the goalpost scenes
57
+ - Camera overlay scenes
58
+ - Low and High angle shots
59
+ - Low resolution shots
60
+ - ### Classes
61
+ | Class ID | Label |
62
+ | -------- | ------- |
63
+ | 0 | Player |
64
+ | 1 | Referee |
65
+ | 2 | Ball |
66
+
67
+ In all, the dataset provides a apt starting point for an all rounder football object detection model.
68
+
69
+ ---
70
+
71
+ ## 🗂️ Folder Structure
72
+
73
+ ```
74
+ V1/
75
+ ├── images/
76
+ │ ├── train/
77
+ │ └── test/
78
+ ├── labels/ # YOLO TXT labels
79
+ │ ├── train/
80
+ │ └── test/
81
+ ├── coco_test_annotations/ # COCO format labels (train.json, val.json)
82
+ ├── coco_train_annotations/ # COCO format labels (train.json, val.json)
83
+ ├── data.yaml # Ultralytics YOLOv8-compatible YAML
84
+ └── samples/ # Dataset samples
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Dataset Preparation
90
+
91
+ ### Processing Pipeline Architecture
92
+
93
+ ```
94
+ Raw COCO Datasets
95
+
96
+ SAHI Slicing (160/320/640/1280)
97
+
98
+ Image Limit and Filtering
99
+
100
+ Class Name Standardization
101
+
102
+ COCO to YOLO Conversion
103
+
104
+ Final Training Dataset
105
+ ```
106
+
107
+ ### Raw COCO Datasets:
108
+ The following datasets were used for the raw images
109
+ 1. **[Soccer Player Tracker](https://universe.roboflow.com/sac-wjhag/soccer-player-tracker)** (`spt_v2`)
110
+ 2. **[Football Detection Test](https://universe.roboflow.com/projet-m2/test-fooball-detection-bis)** (`tbd_v2`)
111
+ 3. **[VA Project](https://universe.roboflow.com/vaa/va_project-mp2xn)** (`v2_temp`)
112
+ 4. **[Player Detection GKLRL](https://universe.roboflow.com/wisd-ckexz/player-detection-gklrl)** (`v12`)
113
+ 5. **[Football EITPT](https://universe.roboflow.com/va-sah7v/football-eitpt)** (`v5_temp`)
114
+ 6. **[Detect Players DGXZ0](https://universe.roboflow.com/nikhil-chapre-xgndf/detect-players-dgxz0)** (`v3`)
115
+ 7. **[Football Player Detection KUCAB](https://universe.roboflow.com/augmented-startups/football-player-detection-kucab)** (`v7`)
116
+ 8. **[Football Players Detection 3ZVBC](https://universe.roboflow.com/roboflow-jvuqo/football-players-detection-3zvbc)**
117
+
118
+
119
+ ### SAHI slicing
120
+ SAHI (Slicing Aided Hyper Inference) is implemented to handle the multi-scale nature of soccer scenes:
121
+
122
+ **Why SAHI for Soccer?**
123
+ - **Crowded Scenes**: Penalty area situations with multiple overlapping players
124
+ - **Scale Variation**: Players appear at different sizes based on camera distance
125
+ - **Small Object Detection**: Ball detection in wide-angle shots
126
+ - **Context Preservation**: Maintains spatial relationships through overlapping
127
+
128
+ ```python
129
+ slice_sizes = [160, 320, 640, 1280] # Multiple scale processing
130
+ overlap_ratio = 0.2 # 20% overlap between patches
131
+ ```
132
+
133
+ - **160x160 patches**: Optimized for small player detection and crowded scenes
134
+ - **320x320 patches**: Balanced approach for medium-distance shots
135
+ - **640x640 patches**: Preserves context for tactical analysis and large-scale scenes
136
+ - **640x640 patches**: For best results in HD context
137
+
138
+
139
+ ### Image Limit and Filtering
140
+ Due to SAHI, the resulting dataset had 1M+ images, and more than 30GB of data. Image filtering was applied from each dataset
141
+ ```python
142
+ # Per-dataset image limits for balanced training
143
+ image_limits = {
144
+ "spt_v2": 30, "spt_v2_sahi_160": 30, "spt_v2_sahi_320": 40,
145
+ "tbd_v2": -1, "v2_temp": 300, "v2_temp_sahi_160": 300,
146
+ "v2_temp_sahi_320": 400, "v3": 500, "v3_sahi_160": 500,
147
+ "v3_sahi_320": 1000, "v3_sahi_640": 500, "v5_temp": 500,
148
+ "v7": 500, "v7_sahi_160": 500, "v7_sahi_320": 1000,
149
+ "v7_sahi_640": 500, "v12": 200, "v12_sahi_160": 300,
150
+ "v12_sahi_320": 500, "v12_sahi_640": 300,
151
+ }
152
+ ```
153
+
154
+
155
+ ### Class name standardization
156
+ Every dataset had different classes, hence three common classes were taken out from each sub dataset
157
+ - **Player Variants**: Maps 'Player', 'Team-A', 'Team-H', 'football player', 'goalkeeper', 'Gardien', 'Joueur' → Class 0
158
+ - **Ball Variants**: Maps 'ball', 'Ball', 'Ballon', 'football' → Class 1
159
+ - **Referee Variants**: Maps 'referee', 'Referee', 'Arbitre' → Class 2
160
+
161
+
162
+ ### COCO to YOLO
163
+ the final COCO format dataset was converted to YOLO format fro ultralytics pipeline. Both the formats can be found in the zip file.
164
+
165
+ ---
166
+
167
+ ## Data Utils
168
+
169
+ ### **Processing Scripts Location**
170
+
171
+ All dataset processing utilities are available in the **Data_utils** directory:
172
+
173
+ **🔗 Repository Link**: [https://github.com/Adit-jain/Soccer_Analysis/tree/main/Data_utils](https://github.com/Adit-jain/Soccer_Analysis/tree/main/Data_utils)
174
+
175
+ ### **Key Utilities**
176
+
177
+ #### **External_Detections/**
178
+ - **`slice_images.py`**: SAHI-based multi-scale slicing
179
+ - **`merge_datasets.py`**: Multi-dataset integration with class mapping
180
+ - **`coco_to_yolo.py`**: Format conversion with coordinate normalization
181
+ - **`create_data_yaml.py`**: YOLO training configuration generation
182
+ - **`visualize_coco_dataset.py`**: Quality control and visualization
183
+
184
+ #### **SoccerNet_Detections/**
185
+ - **`get_soccernet_data.py`**: SoccerNet dataset downloading
186
+ - **`data_preprocessing.py`**: MOT to YOLO conversion pipeline
187
+
188
+ ---
189
+
190
+
191
+ ## Samples
192
+ <p align="center">
193
+ <img src="samples/Figure_1.png" width="800"/>
194
+ <img src="samples/Figure_2.png" width="800"/>
195
+ <img src="samples/Figure_3.png" width="800"/>
196
+ </p>
197
+
198
+ <p align="center">
199
+ <img src="samples/Figure_4.png" width="800"/>
200
+ <img src="samples/Figure_5.png" width="800"/>
201
+ <img src="samples/Figure_6.png" width="800"/>
202
+ </p>
203
+
204
+ <p align="center">
205
+ <img src="samples/Figure_7.png" width="800"/>
206
+ <img src="samples/Figure_8.png" width="800"/>
207
+ <img src="samples/Figure_9.png" width="800"/>
208
+ </p>
209
+
210
+ <p align="center">
211
+ <img src="samples/Figure_10.png" width="800"/>
212
+ </p>
V1.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58f28e4c75b440f2ce67a239b9e44121976f55ae612a9eb8c07dcefb107dc1b6
3
+ size 1341080234
samples/Figure_1.png ADDED

Git LFS Details

  • SHA256: c47adc9b1e4014212ca4882de264e179fe5d28a045b920573842f45bbbf6f49c
  • Pointer size: 131 Bytes
  • Size of remote file: 408 kB
samples/Figure_10.png ADDED

Git LFS Details

  • SHA256: 4ab98f335fc7672e495ac6d477869a75c8bdee012e10c79551c57608c4cd5284
  • Pointer size: 131 Bytes
  • Size of remote file: 407 kB
samples/Figure_2.png ADDED

Git LFS Details

  • SHA256: f8317fbd992ec1cc672535e7f33f3745de5e42e1cb509634558ef5b9bfffd509
  • Pointer size: 131 Bytes
  • Size of remote file: 445 kB
samples/Figure_3.png ADDED

Git LFS Details

  • SHA256: ba900f0f9264a54af73ea8e8b46877e8ff87aacf8734e041e3cca219e8b695e2
  • Pointer size: 131 Bytes
  • Size of remote file: 241 kB
samples/Figure_4.png ADDED

Git LFS Details

  • SHA256: 70fc049f0bd8ced91376bc9c842517d76f39ac0943162f9391ee501164df9cfd
  • Pointer size: 131 Bytes
  • Size of remote file: 468 kB
samples/Figure_5.png ADDED

Git LFS Details

  • SHA256: 6de05e86bfd8696acaf82850c3e74894a102876f7fc898745f15007599924bdb
  • Pointer size: 130 Bytes
  • Size of remote file: 53.6 kB
samples/Figure_6.png ADDED

Git LFS Details

  • SHA256: 09ce9f99ee56e0a73d222184a7b791d5e276423766d08ddf3d436172e3de618f
  • Pointer size: 131 Bytes
  • Size of remote file: 285 kB
samples/Figure_7.png ADDED

Git LFS Details

  • SHA256: 2ac4690265ec39d5bb0ca98e3bbe7f74d63d7b74d9c6a8e89b736f47a3aa2dd8
  • Pointer size: 131 Bytes
  • Size of remote file: 472 kB
samples/Figure_8.png ADDED

Git LFS Details

  • SHA256: c9c2ce6354ff04bf2f830816996741bb272379334d57c52a7dff2247303bb37f
  • Pointer size: 130 Bytes
  • Size of remote file: 49.5 kB
samples/Figure_9.png ADDED

Git LFS Details

  • SHA256: 7b0490781265c33761a076b47b8402c5919b65d41b939d906925b243319b298a
  • Pointer size: 131 Bytes
  • Size of remote file: 594 kB