jeffliulab commited on
Commit
a4812c4
·
verified ·
1 Parent(s): 6b1a558

Update model card: add ViT, full 6-model benchmarks, architecture diagrams

Browse files
Files changed (1) hide show
  1. README.md +71 -14
README.md CHANGED
@@ -4,8 +4,11 @@ language:
4
  - en
5
  tags:
6
  - weather-forecasting
 
7
  - cnn
8
  - resnet
 
 
9
  - pytorch
10
  - meteorology
11
  - hrrr
@@ -14,25 +17,45 @@ pipeline_tag: other
14
 
15
  # Weather Forecasting Models — Tufts CS137
16
 
17
- Deep learning models for 24-hour weather prediction at Tufts University (Jumbo Statue, Medford MA), trained on NOAA HRRR 3 km reanalysis data.
 
 
18
 
19
  ## Models
20
 
21
- | Model | File | Parameters | Test AUC (Rain) | TMP RMSE |
22
- |-------|------|-----------|----------------|----------|
23
- | **CNN Baseline** | `checkpoints/cnn_baseline.pt` | 11.3M | 0.738 | 4.00 K |
24
- | **ResNet-18** | `checkpoints/resnet18.pt` | 11.2M | 0.768 | 3.54 K |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  ## Input
27
 
28
- - **Format**: 42-channel spatial grid (450 x 449 pixels)
29
  - **Resolution**: 3 km (HRRR Lambert Conformal projection)
30
- - **Region**: US Northeast / New England (~1350 km x 1350 km)
31
- - **Channels**: Surface weather variables (temperature, humidity, wind, precipitation, radiation) + atmospheric variables at multiple pressure levels (CAPE, dew point, geopotential height, temperature, U/V wind, cloud cover, moisture)
32
 
33
  ## Output
34
 
35
- 6 continuous values predicted 24 hours ahead at a single target point:
36
 
37
  | Variable | Unit |
38
  |----------|------|
@@ -43,6 +66,24 @@ Deep learning models for 24-hour weather prediction at Tufts University (Jumbo S
43
  | Surface Gust | m/s |
44
  | 1hr Precipitation | mm |
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  ## Checkpoint Format
47
 
48
  ```python
@@ -64,25 +105,41 @@ Deep learning models for 24-hour weather prediction at Tufts University (Jumbo S
64
  import torch
65
  from models import create_model
66
 
67
- ckpt = torch.load("checkpoints/cnn_baseline.pt", map_location="cpu")
 
68
  model = create_model(ckpt["args"]["model"], n_input_channels=42, n_targets=6)
69
  model.load_state_dict(ckpt["model"])
70
  model.eval()
 
 
 
 
 
 
 
 
71
  ```
72
 
73
  ## Training Data
74
 
75
  [HRRR (High-Resolution Rapid Refresh)](https://rapidrefresh.noaa.gov/hrrr/) — NOAA's 3 km hourly weather analysis.
76
 
77
- - **Training**: 2018-2019 (~17,500 samples)
78
- - **Validation**: 2020 (~8,700 samples)
79
- - **Test**: 2021 (~8,700 samples)
 
 
80
 
81
  ## Live Demo
82
 
83
- Try the model in real-time: [Tufts Weather Forecast Space](https://huggingface.co/spaces/jeffliulab/weather_predict)
 
 
 
 
84
 
85
  ## Links
86
 
87
  - [GitHub Repository](https://github.com/jeffliulab/real_time_weather_forecasting)
 
88
  - Course: Tufts CS 137 — Deep Neural Networks, Spring 2026
 
4
  - en
5
  tags:
6
  - weather-forecasting
7
+ - deep-learning
8
  - cnn
9
  - resnet
10
+ - vision-transformer
11
+ - convnext
12
  - pytorch
13
  - meteorology
14
  - hrrr
 
17
 
18
  # Weather Forecasting Models — Tufts CS137
19
 
20
+ Deep learning models for **24-hour weather prediction** at Tufts University (Jumbo Statue, Medford MA), trained on NOAA HRRR 3 km reanalysis data.
21
+
22
+ 6 architectures trained and compared: CNN Baseline, ResNet-18, ConvNeXt-Tiny, Multi-frame CNN, 3D CNN, and **Vision Transformer (ViT)**.
23
 
24
  ## Models
25
 
26
+ | Model | File | Params | Architecture | TMP RMSE (K) | Rain AUC |
27
+ |-------|------|--------|-------------|-------------|----------|
28
+ | **WeatherViT** | `vit/best.pt` | 7.4M | 6-layer Transformer, 15×15 patches, 900 tokens | 4.06 | **0.776** |
29
+ | **ResNet-18** | `checkpoints/resnet18.pt` | 11.2M | Modified torchvision ResNet-18 | **3.54** | 0.768 |
30
+ | **CNN Baseline** | `checkpoints/cnn_baseline.pt` | 11.3M | 6 ResBlocks, progressive downsample | 4.00 | 0.738 |
31
+
32
+ ### Full Test Results (2021)
33
+
34
+ | Model | TMP (K) | RH (%) | UGRD (m/s) | VGRD (m/s) | GUST (m/s) | APCP>2mm (mm) | AUC |
35
+ |-------|---------|--------|------------|------------|------------|--------------|-----|
36
+ | **ViT** | 4.06 | 16.45 | 2.59 | **2.21** | **3.57** | **4.50** | **0.776** |
37
+ | **ResNet-18** | **3.54** | **15.68** | 2.70 | 2.34 | 3.60 | 4.53 | 0.768 |
38
+ | CNN Baseline | 4.00 | 15.89 | **2.56** | 2.23 | 3.58 | 4.56 | 0.738 |
39
+ | ConvNeXt-Tiny | 3.66 | 15.85 | 2.54 | 2.17 | 3.65 | 4.55 | 0.692 |
40
+ | CNN 3D | 4.76 | 17.44 | 2.61 | 2.32 | 3.58 | 4.75 | 0.668 |
41
+ | Multi-frame CNN | 4.55 | 18.41 | 2.62 | 2.45 | 3.62 | 4.76 | 0.652 |
42
+ | *Persistence* | *4.86* | *23.01* | *3.73* | *2.89* | *4.87* | *4.62* | *0.506* |
43
+
44
+ **Key findings:**
45
+ - **ViT** achieves the best rain detection AUC (0.776), precipitation RMSE, wind gust, and V-wind
46
+ - **ResNet-18** leads in temperature (3.54 K) and humidity (15.68%) accuracy
47
+ - All models significantly outperform the persistence baseline
48
 
49
  ## Input
50
 
51
+ - **Format**: 42-channel spatial grid (450 × 449 pixels)
52
  - **Resolution**: 3 km (HRRR Lambert Conformal projection)
53
+ - **Region**: US Northeast / New England (~1350 km × 1350 km)
54
+ - **Channels**: Surface variables (temperature, humidity, wind, precipitation, radiation) + atmospheric variables at multiple pressure levels (CAPE, dew point, geopotential height, temperature, U/V wind, cloud cover, moisture)
55
 
56
  ## Output
57
 
58
+ 6 continuous values predicted **24 hours ahead** at a single target point:
59
 
60
  | Variable | Unit |
61
  |----------|------|
 
66
  | Surface Gust | m/s |
67
  | 1hr Precipitation | mm |
68
 
69
+ ## Architecture Highlights
70
+
71
+ **WeatherViT** (new)
72
+ ```
73
+ Input (B,42,450,449) → pad→450×450 → PatchEmbed(15×15, 900 patches)
74
+ → [CLS]+PosEmbed → 6×TransformerBlock(8 heads, dim=256) → CLS → FC → (B,6)
75
+ ```
76
+
77
+ **CNN Baseline**
78
+ ```
79
+ Input (B,42,450,449) → Stem(42→64, 7×7, s=2) → 6×ResBlock → GAP → FC → (B,6)
80
+ ```
81
+
82
+ **ResNet-18**
83
+ ```
84
+ Input (B,42,450,449) → Modified torchvision ResNet-18 (42-ch input) → FC → (B,6)
85
+ ```
86
+
87
  ## Checkpoint Format
88
 
89
  ```python
 
105
  import torch
106
  from models import create_model
107
 
108
+ # Load any model (cnn_baseline, resnet18, vit, convnext_tiny, cnn_3d, cnn_multi_frame)
109
+ ckpt = torch.load("vit/best.pt", map_location="cpu", weights_only=False)
110
  model = create_model(ckpt["args"]["model"], n_input_channels=42, n_targets=6)
111
  model.load_state_dict(ckpt["model"])
112
  model.eval()
113
+
114
+ # Inference
115
+ x = torch.randn(1, 42, 450, 449) # (batch, channels, height, width)
116
+ norm = ckpt["norm_stats"]
117
+ x = (x - norm["input_mean"]) / (norm["input_std"] + 1e-7)
118
+ with torch.no_grad():
119
+ pred = model(x) # (1, 6)
120
+ pred = pred * norm["target_std"] + norm["target_mean"] # denormalize
121
  ```
122
 
123
  ## Training Data
124
 
125
  [HRRR (High-Resolution Rapid Refresh)](https://rapidrefresh.noaa.gov/hrrr/) — NOAA's 3 km hourly weather analysis.
126
 
127
+ | Split | Period | Samples |
128
+ |-------|--------|---------|
129
+ | Training | 2018–2019 | ~17,500 |
130
+ | Validation | 2020 | ~8,700 |
131
+ | Test | 2021 | ~8,700 |
132
 
133
  ## Live Demo
134
 
135
+ Try the models in real-time with live HRRR data: **[Tufts Weather Forecast Space](https://huggingface.co/spaces/jeffliulab/weather_predict)**
136
+
137
+ The demo fetches real-time HRRR analysis from NOAA, runs inference, and displays:
138
+ - Current input field maps (temperature, precipitation, wind, humidity)
139
+ - 24-hour forecast at the Jumbo Statue target point
140
 
141
  ## Links
142
 
143
  - [GitHub Repository](https://github.com/jeffliulab/real_time_weather_forecasting)
144
+ - [Live Demo](https://huggingface.co/spaces/jeffliulab/weather_predict)
145
  - Course: Tufts CS 137 — Deep Neural Networks, Spring 2026