dronefreak commited on
Commit
c36cdb4
·
verified ·
1 Parent(s): 07a114c

Merge dev into main

Browse files
Files changed (7) hide show
  1. .gitattributes +2 -0
  2. README.md +250 -0
  3. assets/demo_banner.mp4 +3 -0
  4. assets/demo_banner_poster.jpg +3 -0
  5. best.pt +3 -0
  6. metrics.json +127 -0
  7. results.csv +17 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/demo_banner.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ assets/demo_banner_poster.jpg filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+
4
+ pipeline_tag: image-classification
5
+
6
+ library_name: timm
7
+
8
+ datasets:
9
+ - dronefreak/BDD100K-Weather-Classification
10
+
11
+ tags:
12
+ - image-classification
13
+ - bdd100k-toolkit
14
+ - timm
15
+ - pytorch
16
+ - computer-vision
17
+ - autonomous-driving
18
+ - self-driving-cars
19
+ - driving-scenes
20
+ - weather-classification
21
+ metrics:
22
+ - accuracy
23
+ - f1
24
+ - precision
25
+ - recall
26
+
27
+ base_model: "timm/efficientformerv2_l.snap_dist_in1k"
28
+
29
+ model-index:
30
+ - name: EfficientFormerV2-L Finetuned on BDD100K Weather Classification
31
+ results:
32
+ - task:
33
+ type: image-classification
34
+ name: Image Classification
35
+ dataset:
36
+ name: BDD100K Weather Classification
37
+ type: dronefreak/BDD100K-Weather-Classification
38
+ metrics:
39
+ - type: accuracy
40
+ value: 83.27
41
+ name: Top-1 accuracy (test split)
42
+ - type: f1
43
+ value: 65.93
44
+ name: Macro F1 (test split)
45
+ - type: precision
46
+ value: 67.12
47
+ name: Macro precision (test split)
48
+ - type: recall
49
+ value: 65.03
50
+ name: Macro recall (test split)
51
+ source:
52
+ url: https://github.com/dronefreak/bdd100k-toolkit
53
+ name: BDD100K-Toolkit
54
+ ---
55
+
56
+ # EfficientFormerV2-L Finetuned on BDD100K Weather Classification
57
+
58
+ <p align="center"><video controls autoplay loop muted playsinline width="900" poster="https://huggingface.co/dronefreak/bdd100k-weather-efficientformerv2_l/resolve/main/assets/demo_banner_poster.jpg" src="https://huggingface.co/dronefreak/bdd100k-weather-efficientformerv2_l/resolve/main/assets/demo_banner.mp4"><img src="https://huggingface.co/dronefreak/bdd100k-weather-efficientformerv2_l/resolve/main/assets/demo_banner_poster.jpg" alt="EfficientFormerV2-L weather predictions on two BDD100K test clips" width="900"></video></p>
59
+
60
+ <br>
61
+
62
+ <!-- ROW 1: Identity & Tech Stack -->
63
+ <div style="display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;">
64
+ <img src="https://img.shields.io/badge/Task-Image_Classification-blue?style=flat-square" alt="Task">
65
+ <img src="https://img.shields.io/badge/Framework-timm-0aa1a7?style=flat-square" alt="Framework">
66
+ <img src="https://img.shields.io/badge/Base_Model-EfficientFormerV2--L-purple?style=flat-square" alt="Base Model">
67
+ </div>
68
+
69
+ <!-- ROW 2: Performance Metrics -->
70
+ <div style="display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;">
71
+ <img src="https://img.shields.io/badge/Macro_F1-65.93%25-success?style=flat-square" alt="Macro F1">
72
+ <img src="https://img.shields.io/badge/Top--1-83.27%25-orange?style=flat-square" alt="Top-1">
73
+ <img src="https://img.shields.io/badge/Params-25.6M-lightgrey?style=flat-square" alt="Params">
74
+ </div>
75
+
76
+ <!-- ROW 3: Metadata -->
77
+ <div style="display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;">
78
+ <img src="https://img.shields.io/badge/License-Apache--2.0-lightgrey?style=flat-square" alt="License">
79
+ <a href="https://github.com/dronefreak/bdd100k-toolkit"><img src="https://img.shields.io/badge/Source-BDD100K--Toolkit-black?style=flat-square" alt="Source"></a>
80
+ </div>
81
+
82
+ Fine-tuned EfficientFormerV2-L image classifier on the **BDD100K Weather Classification** dataset, trained and evaluated as part of [BDD100K-Toolkit](https://github.com/dronefreak/bdd100k-toolkit), a dependency-clean toolkit for preparing BDD100K, training models on it and evaluating them with the same metrics on the same splits.
83
+
84
+ 7-class weather classification (clear / partly cloudy / overcast / rainy / snowy / foggy / unknown) derived from BDD100K's per-image attributes.weather field. Unofficial task; follows the Kaggle dataset of the same name.
85
+
86
+ ---
87
+
88
+ ## Usage
89
+
90
+ ```python
91
+ import timm, torch
92
+ from huggingface_hub import hf_hub_download
93
+ from PIL import Image
94
+ from torchvision import transforms as T
95
+
96
+ ckpt = torch.load(
97
+ hf_hub_download("dronefreak/bdd100k-weather-efficientformerv2_l", "best.pt"), map_location="cpu", weights_only=True
98
+ )
99
+ model = timm.create_model(
100
+ ckpt["model_name"], pretrained=False, num_classes=len(ckpt["class_names"])
101
+ )
102
+ model.load_state_dict(ckpt["state_dict"])
103
+ model.eval()
104
+ prep = T.Compose(
105
+ [T.Resize((ckpt["imgsz"],) * 2), T.ToTensor(), T.Normalize(ckpt["mean"], ckpt["std"])]
106
+ )
107
+ with torch.no_grad():
108
+ probs = model(prep(Image.open("street.jpg").convert("RGB"))[None]).softmax(1)[0]
109
+ print(ckpt["class_names"][probs.argmax()], f"{probs.max():.1%}")
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Results
115
+
116
+ Evaluated on the `test` split (10000 images).
117
+
118
+ | Metric | Value |
119
+ |---|---|
120
+ | Macro F1 | 65.93% |
121
+ | Balanced accuracy | 65.03% |
122
+ | Macro precision | 67.12% |
123
+ | Macro recall | 65.03% |
124
+ | Top-1 accuracy | 83.27% |
125
+ | Top-5 accuracy | 99.78% |
126
+
127
+ ### Per class
128
+
129
+ | Class | Precision | Recall | F1 | Test images |
130
+ |---|---|---|---|---|
131
+ | clear | 91.15% | 92.63% | 91.88% | 5346 |
132
+ | foggy | 0.00% | 0.00% | 0.00% | 13 (few) |
133
+ | overcast | 66.38% | 69.49% | 67.90% | 1239 |
134
+ | partly cloudy | 69.10% | 65.45% | 67.22% | 738 |
135
+ | rainy | 84.83% | 70.46% | 76.98% | 738 |
136
+ | snowy | 86.28% | 79.32% | 82.66% | 769 |
137
+ | unknown | 72.08% | 77.87% | 74.86% | 1157 |
138
+
139
+ This checkpoint classifies none of the test images of `foggy` (13 images) correctly, so treat it as unsupported.
140
+
141
+ ---
142
+
143
+ ## Model Zoo
144
+
145
+ All runs below were evaluated on the same `test` split, sorted by top-1 accuracy.
146
+
147
+ | Model | Top-1 | Macro F1 | Balanced acc | Macro precision |
148
+ |---|---|---|---|---|
149
+ | TinyViT-21M | 83.90% | 68.65% | 67.15% | 74.81% |
150
+ | EfficientViT-B3 | 83.51% | 68.17% | 66.34% | 81.75% |
151
+ | EfficientViT-B2 | 83.46% | 66.07% | 65.04% | 67.54% |
152
+ | **EfficientFormerV2-L** | **83.27%** | **65.93%** | **65.03%** | **67.12%** |
153
+ | RepViT-M1.5 | 83.19% | 67.78% | 65.71% | 81.56% |
154
+ | EfficientViT-L1 | 83.13% | 65.70% | 65.11% | 66.46% |
155
+ | RepViT-M2.3 | 83.02% | 65.46% | 64.33% | 67.02% |
156
+ | ConvNeXt-Atto | 83.00% | 67.44% | 65.25% | 81.38% |
157
+ | EfficientFormerV2-S2 | 82.90% | 65.50% | 64.68% | 66.98% |
158
+ | EfficientViT-B0 | 82.79% | 65.10% | 63.62% | 67.11% |
159
+ | EfficientViT-B1 | 82.67% | 64.95% | 63.59% | 66.83% |
160
+ | MobileNetV4-Conv-Large | 82.20% | 66.62% | 64.68% | 80.26% |
161
+ | ResNet-18 | 82.19% | 64.30% | 62.97% | 66.08% |
162
+ | MobileNetV4-Conv-Small | 82.16% | 66.51% | 64.37% | 80.44% |
163
+ | YOLO26n | 82.04% | 64.09% | 62.46% | 66.57% |
164
+ | YOLO11s | 81.91% | 63.81% | 62.05% | 66.35% |
165
+ | YOLO26s | 81.46% | 65.14% | 62.61% | 69.75% |
166
+ | YOLOv8s | 81.40% | 66.34% | 63.52% | 71.54% |
167
+ | YOLO11n | 81.32% | 62.91% | 61.19% | 65.68% |
168
+ | YOLOv8n | 81.22% | 63.07% | 61.42% | 65.52% |
169
+
170
+ ---
171
+
172
+ ## Training
173
+
174
+ | Setting | Value |
175
+ |---|---|
176
+ | Epochs (max) | 50 |
177
+ | Epochs (trained) | 16 |
178
+ | Best epoch (`best.pt`) | 6 |
179
+ | `best.pt` chosen by | macro_f1 on the valid split |
180
+ | Early stopping patience | 10 |
181
+ | Batch size | 64 |
182
+ | Image size | 224 |
183
+ | Optimizer | auto, resolved to AdamW (peak lr 3e-04) |
184
+ | Weights | EMA |
185
+
186
+ ---
187
+
188
+ ## Dataset
189
+
190
+ [dronefreak/BDD100K-Weather-Classification](https://huggingface.co/datasets/dronefreak/BDD100K-Weather-Classification) holds the prepared splits these models were trained and evaluated on.
191
+
192
+ ---
193
+
194
+ ## Limitations
195
+
196
+ - Unofficial task: labels are BDD100K's per-image attributes, not a benchmark with a public leaderboard, so scores are only comparable with other models evaluated on this split.
197
+ - Not the official test set: `test` here is BDD100K's official validation split (the official test labels are not released) and `valid` is a seeded 15% slice of the official train split.
198
+ - Heavily imbalanced: rare classes have very few test images, so their per-class scores are noisy. Prefer macro F1 over accuracy.
199
+ - Images are US dashcam frames; generalization to other regions or camera setups is untested.
200
+ - BDD100K is released for non-commercial research and education. Check its license before any use of these weights beyond research.
201
+ - `clear`, `partly cloudy` and `overcast` are subjective annotator calls, so expect label noise between neighbouring classes.
202
+
203
+ ---
204
+
205
+ ## License
206
+
207
+ The weights are released under the license in the metadata above. They were trained on BDD100K, which is free for non-commercial research and education; commercial use needs separate permission (see https://www.bdd100k.com/). The prepared dataset on the Hub is tagged `license: other`, and the original BDD100K terms still apply.
208
+
209
+ ---
210
+
211
+ ## Citation
212
+
213
+ ### Model
214
+
215
+ ```bibtex
216
+ @article{li2022rethinking,
217
+ title={Rethinking Vision Transformers for MobileNet Size and Speed},
218
+ author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian},
219
+ journal={arXiv preprint arXiv:2212.08059},
220
+ year={2022}
221
+ }
222
+ ```
223
+
224
+ ### Dataset
225
+
226
+ ```bibtex
227
+ @article{yu2018bdd100k,
228
+ title={BDD100K: A Diverse Driving Dataset for Heterogeneous Multitask Learning},
229
+ author={Yu, Fisher and Chen, Haofeng and Wang, Xin and Xian, Wenqi and Chen, Yingying and Liu, Fangchen and Madhavan, Vashisht and Darrell, Trevor},
230
+ journal={arXiv preprint arXiv:1805.04687},
231
+ year={2018}
232
+ }
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Files
238
+
239
+ - `best.pt`
240
+ - `metrics.json`
241
+ - `results.csv`
242
+ - `assets/demo_banner.mp4`
243
+ - `assets/demo_banner_poster.jpg`
244
+ - `README.md`
245
+
246
+ ---
247
+
248
+ ## Reproduce
249
+
250
+ Trained and evaluated with [BDD100K-Toolkit](https://github.com/dronefreak/bdd100k-toolkit): `bdd100k-evaluate --dataset bdd100k-weather --checkpoint <weights> --data-dir <prepared dir> --split test`.
assets/demo_banner.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e363dce06dfe2a6c1fe1accf477e0f254decde0733e558133eab59bce8ac259d
3
+ size 7926855
assets/demo_banner_poster.jpg ADDED

Git LFS Details

  • SHA256: 99d0a74036804f2530ada995d076db191c8d86eaf05f1a23283b8c2eaa37b2f0
  • Pointer size: 131 Bytes
  • Size of remote file: 126 kB
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e99d4ae6c8544ee5b75783465c327a7ccd2f92bdbf0e8eae936233270806e376
3
+ size 103376093
metrics.json ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "accuracy": 0.8327,
3
+ "balanced_accuracy": 0.6503242813775042,
4
+ "macro_precision": 0.6711687705534296,
5
+ "macro_recall": 0.6503242813775042,
6
+ "macro_f1": 0.6592982465936582,
7
+ "per_class": {
8
+ "clear": {
9
+ "precision": 0.9114669611632615,
10
+ "recall": 0.9263000374111485,
11
+ "f1": 0.9188236385564523,
12
+ "support": 5346
13
+ },
14
+ "foggy": {
15
+ "precision": 0.0,
16
+ "recall": 0.0,
17
+ "f1": 0.0,
18
+ "support": 13
19
+ },
20
+ "overcast": {
21
+ "precision": 0.6638396299151889,
22
+ "recall": 0.6949152542372882,
23
+ "f1": 0.6790220820189274,
24
+ "support": 1239
25
+ },
26
+ "partly cloudy": {
27
+ "precision": 0.6909871244635193,
28
+ "recall": 0.6544715447154471,
29
+ "f1": 0.6722338204592903,
30
+ "support": 738
31
+ },
32
+ "rainy": {
33
+ "precision": 0.8482871125611745,
34
+ "recall": 0.7046070460704607,
35
+ "f1": 0.76980014803849,
36
+ "support": 738
37
+ },
38
+ "snowy": {
39
+ "precision": 0.8628005657708628,
40
+ "recall": 0.7932379713914174,
41
+ "f1": 0.8265582655826559,
42
+ "support": 769
43
+ },
44
+ "unknown": {
45
+ "precision": 0.7208,
46
+ "recall": 0.7787381158167676,
47
+ "f1": 0.7486497714997922,
48
+ "support": 1157
49
+ }
50
+ },
51
+ "top1_accuracy": 0.8327,
52
+ "top5_accuracy": 0.9978,
53
+ "class_names": [
54
+ "clear",
55
+ "foggy",
56
+ "overcast",
57
+ "partly cloudy",
58
+ "rainy",
59
+ "snowy",
60
+ "unknown"
61
+ ],
62
+ "confusion_matrix": [
63
+ [
64
+ 4952,
65
+ 0,
66
+ 93,
67
+ 118,
68
+ 36,
69
+ 50,
70
+ 97
71
+ ],
72
+ [
73
+ 8,
74
+ 0,
75
+ 1,
76
+ 0,
77
+ 3,
78
+ 0,
79
+ 1
80
+ ],
81
+ [
82
+ 62,
83
+ 1,
84
+ 861,
85
+ 85,
86
+ 21,
87
+ 7,
88
+ 202
89
+ ],
90
+ [
91
+ 85,
92
+ 0,
93
+ 154,
94
+ 483,
95
+ 2,
96
+ 6,
97
+ 8
98
+ ],
99
+ [
100
+ 117,
101
+ 0,
102
+ 50,
103
+ 3,
104
+ 520,
105
+ 22,
106
+ 26
107
+ ],
108
+ [
109
+ 95,
110
+ 0,
111
+ 24,
112
+ 6,
113
+ 19,
114
+ 610,
115
+ 15
116
+ ],
117
+ [
118
+ 114,
119
+ 0,
120
+ 114,
121
+ 4,
122
+ 12,
123
+ 12,
124
+ 901
125
+ ]
126
+ ]
127
+ }
results.csv ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch,train_loss,valid_loss,valid_accuracy,valid_balanced_accuracy,valid_macro_f1,monitored_macro_f1,lr,seconds
2
+ 1,0.97208,0.56976,0.81592,0.60686,0.62819,0.62819,3.000e-04,233.5
3
+ 2,0.58313,0.52103,0.82498,0.63578,0.64476,0.64476,2.997e-04,232.8
4
+ 3,0.52444,0.49826,0.82956,0.65017,0.66385,0.66385,2.988e-04,232.8
5
+ 4,0.49029,0.49662,0.83271,0.65103,0.66705,0.66705,2.972e-04,232.9
6
+ 5,0.45996,0.50734,0.83147,0.65109,0.67463,0.67463,2.951e-04,232.8
7
+ 6,0.42315,0.51467,0.83100,0.66130,0.67810,0.67810,2.924e-04,232.7
8
+ 7,0.37145,0.54582,0.82231,0.65392,0.66698,0.66698,2.890e-04,232.8
9
+ 8,0.31658,0.59350,0.82069,0.65022,0.66445,0.66445,2.851e-04,232.9
10
+ 9,0.26390,0.64890,0.81993,0.64817,0.66484,0.66484,2.807e-04,232.8
11
+ 10,0.21873,0.70386,0.81659,0.64360,0.66003,0.66003,2.757e-04,232.9
12
+ 11,0.18370,0.77018,0.81000,0.64325,0.66436,0.66436,2.702e-04,232.8
13
+ 12,0.15502,0.83533,0.81029,0.64437,0.66550,0.66550,2.642e-04,232.7
14
+ 13,0.13500,0.86741,0.80962,0.63231,0.64964,0.64964,2.578e-04,232.8
15
+ 14,0.12043,0.90606,0.81086,0.63947,0.65175,0.65175,2.508e-04,233.4
16
+ 15,0.10627,0.93525,0.81048,0.62955,0.64047,0.64047,2.435e-04,232.9
17
+ 16,0.09638,0.97081,0.81134,0.63698,0.65085,0.65085,2.358e-04,232.9