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 |
+
license: cc-by-4.0
|
| 3 |
+
tags:
|
| 4 |
+
- pytorch
|
| 5 |
+
- tornado-detection
|
| 6 |
+
- weather
|
| 7 |
+
- radar
|
| 8 |
+
- nexrad
|
| 9 |
+
- 3d-cnn
|
| 10 |
+
- video-classification
|
| 11 |
+
- severe-weather
|
| 12 |
+
- dual-pol
|
| 13 |
+
datasets:
|
| 14 |
+
- deepguess/tornet-temporal
|
| 15 |
+
pipeline_tag: video-classification
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# ResNet3D-18 for Tornado Detection
|
| 19 |
+
|
| 20 |
+
A 3D convolutional neural network trained on temporal dual-polarimetric NEXRAD radar sequences for tornado detection and prediction.
|
| 21 |
+
|
| 22 |
+
## Model Description
|
| 23 |
+
|
| 24 |
+
This model uses a **ResNet3D-18** backbone (3D adaptation of ResNet-18) with a **dual-head architecture**:
|
| 25 |
+
|
| 26 |
+
- **Detection head**: Classifies whether a tornado is currently occurring in the radar sequence
|
| 27 |
+
- **Prediction head**: Classifies whether a tornado will occur, using only pre-tornado frames
|
| 28 |
+
|
| 29 |
+
The model processes **8 consecutive radar volume scans** (~40 minutes of data) with **24 dual-polarimetric channels** across a **128x128 km storm-centered grid**.
|
| 30 |
+
|
| 31 |
+
### Architecture Details
|
| 32 |
+
|
| 33 |
+
| Parameter | Value |
|
| 34 |
+
|-----------|-------|
|
| 35 |
+
| Backbone | ResNet3D-18 (BasicBlock, layers=[2,2,2,2]) |
|
| 36 |
+
| Parameters | 33.3M |
|
| 37 |
+
| Input shape | (B, 24, 8, 128, 128) -- channels, time, height, width |
|
| 38 |
+
| Output shape | (B, 4) -- [det_class0, det_class1, pred_class0, pred_class1] |
|
| 39 |
+
| Channels | 24 (6 dual-pol products x 4 elevation angles) |
|
| 40 |
+
| Temporal frames | 8 |
|
| 41 |
+
| Spatial resolution | 1 km/pixel, 128x128 grid |
|
| 42 |
+
|
| 43 |
+
### Channel Layout
|
| 44 |
+
|
| 45 |
+
| Channels | Product | Description |
|
| 46 |
+
|----------|---------|-------------|
|
| 47 |
+
| 0-3 | REF | Reflectivity at 0.5, 0.9, 1.3, 1.8 deg |
|
| 48 |
+
| 4-7 | VEL | Radial velocity |
|
| 49 |
+
| 8-11 | SW | Spectrum width |
|
| 50 |
+
| 12-15 | ZDR | Differential reflectivity |
|
| 51 |
+
| 16-19 | CC | Correlation coefficient |
|
| 52 |
+
| 20-23 | KDP | Specific differential phase |
|
| 53 |
+
|
| 54 |
+
## Performance
|
| 55 |
+
|
| 56 |
+
### Validation Set (2022, 2,117 events)
|
| 57 |
+
|
| 58 |
+
| Head | AUC | CSI | F1 |
|
| 59 |
+
|------|-----|-----|-----|
|
| 60 |
+
| Detection | 0.927 | 0.652 | 0.789 |
|
| 61 |
+
| Prediction | 0.993 | 0.883 | 0.938 |
|
| 62 |
+
| **Combined** | **0.960** | -- | -- |
|
| 63 |
+
|
| 64 |
+
### Test Set (3,685 events)
|
| 65 |
+
|
| 66 |
+
| Head | AUC | CSI | F1 | Precision | Recall |
|
| 67 |
+
|------|-----|-----|-----|-----------|--------|
|
| 68 |
+
| Detection | 0.896 | 0.540 | 0.702 | 0.602 | 0.841 |
|
| 69 |
+
| Prediction | 0.988 | 0.856 | 0.922 | 0.958 | 0.889 |
|
| 70 |
+
| **Combined** | **0.942** | -- | -- | -- | -- |
|
| 71 |
+
|
| 72 |
+
Per-category prediction accuracy: TOR 88.9%, WRN 96.8%, NUL 99.1%
|
| 73 |
+
|
| 74 |
+
### Comparison with Literature
|
| 75 |
+
|
| 76 |
+
| Model | Year | Frames | Channels | AUC |
|
| 77 |
+
|-------|------|--------|----------|-----|
|
| 78 |
+
| TorNet (MIT Lincoln Lab) | 2024 | 1 | 12 | ~0.88 |
|
| 79 |
+
| **This model** | **2026** | **8** | **24** | **0.942** |
|
| 80 |
+
|
| 81 |
+
## Training Details
|
| 82 |
+
|
| 83 |
+
| Parameter | Value |
|
| 84 |
+
|-----------|-------|
|
| 85 |
+
| Dataset | [tornet-temporal](https://huggingface.co/datasets/deepguess/tornet-temporal) (24,862 events) |
|
| 86 |
+
| Train split | 2013-2021 (~19,061 events) |
|
| 87 |
+
| Optimizer | AdamW (lr=1e-3, weight_decay=0.01) |
|
| 88 |
+
| Scheduler | Cosine annealing with 3-epoch linear warmup |
|
| 89 |
+
| Batch size | 256 |
|
| 90 |
+
| Epochs | 20 |
|
| 91 |
+
| Mixed precision | FP16 (AMP) with FP32 classification heads |
|
| 92 |
+
| GPU | NVIDIA H100 NVL (96GB) |
|
| 93 |
+
| Training time | ~4 hours |
|
| 94 |
+
|
| 95 |
+
## Usage
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
import torch
|
| 99 |
+
import numpy as np
|
| 100 |
+
from model_resnet3d import DualHeadResNet3D # from this repo
|
| 101 |
+
|
| 102 |
+
# Load model
|
| 103 |
+
model = DualHeadResNet3D(in_channels=24, arch="resnet18")
|
| 104 |
+
state = torch.load("best.pt", map_location="cpu")
|
| 105 |
+
model.load_state_dict(state["model_state_dict"])
|
| 106 |
+
model.eval()
|
| 107 |
+
|
| 108 |
+
# Load a radar sequence
|
| 109 |
+
event = np.load("tornet_EVENTID_TOR/sequence.npz")
|
| 110 |
+
data = event["data"][:8] # first 8 frames, shape (8, 24, 128, 128)
|
| 111 |
+
x = torch.from_numpy(data).float().unsqueeze(0) # (1, 8, 24, 128, 128)
|
| 112 |
+
x = x.permute(0, 2, 1, 3, 4) # (1, 24, 8, 128, 128) -- channels first
|
| 113 |
+
|
| 114 |
+
with torch.no_grad():
|
| 115 |
+
out = model(x) # (1, 4)
|
| 116 |
+
det_prob = torch.softmax(out[:, :2], dim=1)[:, 1] # detection probability
|
| 117 |
+
pred_prob = torch.softmax(out[:, 2:], dim=1)[:, 1] # prediction probability
|
| 118 |
+
|
| 119 |
+
print(f"Detection probability: {det_prob.item():.3f}")
|
| 120 |
+
print(f"Prediction probability: {pred_prob.item():.3f}")
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
## Real-World Deployment
|
| 124 |
+
|
| 125 |
+
### How to use this in an operational setting
|
| 126 |
+
|
| 127 |
+
1. **Data ingestion**: Ingest real-time NEXRAD Level-II data from the [Unidata IDD](https://www.unidata.ucar.edu/projects/idd/) or [AWS NEXRAD archive](https://registry.opendata.aws/noaa-nexrad/). Extract the 6 dual-pol products (REF, VEL, SW, ZDR, CC, KDP) at 4 elevation angles (0.5, 0.9, 1.3, 1.8 deg).
|
| 128 |
+
|
| 129 |
+
2. **Storm tracking**: Use an existing storm tracker (e.g., [TINT](https://github.com/openradar/TINT), SCIT, or a simple reflectivity centroid tracker) to identify storm cells and extract 128x128 km storm-centered patches.
|
| 130 |
+
|
| 131 |
+
3. **Temporal buffering**: Maintain a rolling buffer of the last 8 radar volume scans (~40 minutes) for each tracked storm cell. New scans arrive every ~4-5 minutes.
|
| 132 |
+
|
| 133 |
+
4. **Inference**: Run the model on each storm cell's 8-frame sequence. The **prediction head** output is most useful operationally -- it answers "will this storm produce a tornado?"
|
| 134 |
+
|
| 135 |
+
5. **Thresholding**: Use a probability threshold of ~0.66 (optimized for CSI on the test set) to generate tornado warnings. At this threshold:
|
| 136 |
+
- **Precision 95.8%**: When the model warns, it's almost always right
|
| 137 |
+
- **Recall 88.9%**: Catches ~89% of actual tornadoes
|
| 138 |
+
- **Lead time**: The prediction head uses pre-tornado frames, providing inherent lead time
|
| 139 |
+
|
| 140 |
+
6. **Integration**: Feed predictions into NWS warning decision support systems or automated alerting pipelines. The model runs in <50ms on a modern GPU, well within real-time requirements.
|
| 141 |
+
|
| 142 |
+
### Limitations
|
| 143 |
+
|
| 144 |
+
- Trained on CONUS NEXRAD data only (2013-2022). May not generalize to other radar networks or non-US storm environments.
|
| 145 |
+
- Requires all 24 dual-pol channels. Single-pol radars are not supported (see 12-channel ablation for degraded single-pol performance).
|
| 146 |
+
- Storm-centered input assumes a working storm tracker upstream.
|
| 147 |
+
- The detection head (AUC 0.896) is weaker than the prediction head (AUC 0.988). Active tornado signatures may be more variable than pre-tornado mesocyclone patterns.
|
| 148 |
+
- NUL (null) training samples are drawn from tornado-day radar scans only. The model has not been tested on truly quiescent weather.
|
| 149 |
+
|
| 150 |
+
## Citation
|
| 151 |
+
|
| 152 |
+
```bibtex
|
| 153 |
+
@model{resnet3d-18-tornet,
|
| 154 |
+
title={ResNet3D-18 for Temporal Radar Tornado Detection},
|
| 155 |
+
author={DeepGuess},
|
| 156 |
+
year={2026},
|
| 157 |
+
url={https://huggingface.co/deepguess/resnet3d-18-tornet},
|
| 158 |
+
}
|
| 159 |
+
```
|