resnet3d-18-tornet / README.md
deepguess's picture
Upload README.md with huggingface_hub
9b0c678 verified
---
license: cc-by-4.0
tags:
- pytorch
- tornado-detection
- weather
- radar
- nexrad
- 3d-cnn
- video-classification
- severe-weather
- dual-pol
datasets:
- deepguess/tornet-temporal
pipeline_tag: video-classification
---
# ResNet3D-18 for Tornado Detection
A 3D convolutional neural network trained on temporal dual-polarimetric NEXRAD radar sequences for tornado detection and prediction.
## Model Description
This model uses a **ResNet3D-18** backbone (3D adaptation of ResNet-18) with a **dual-head architecture**:
- **Detection head**: Classifies whether a tornado is currently occurring in the radar sequence
- **Prediction head**: Classifies whether a tornado will occur, using only pre-tornado frames
The model processes **8 consecutive radar volume scans** (~40 minutes of data) with **24 dual-polarimetric channels** across a **128x128 km storm-centered grid**.
### Architecture Details
| Parameter | Value |
|-----------|-------|
| Backbone | ResNet3D-18 (BasicBlock, layers=[2,2,2,2]) |
| Parameters | 33.3M |
| Input shape | (B, 24, 8, 128, 128) -- channels, time, height, width |
| Output shape | (B, 4) -- [det_class0, det_class1, pred_class0, pred_class1] |
| Channels | 24 (6 dual-pol products x 4 elevation angles) |
| Temporal frames | 8 |
| Spatial resolution | 1 km/pixel, 128x128 grid |
### Channel Layout
| Channels | Product | Description |
|----------|---------|-------------|
| 0-3 | REF | Reflectivity at 0.5, 0.9, 1.3, 1.8 deg |
| 4-7 | VEL | Radial velocity |
| 8-11 | SW | Spectrum width |
| 12-15 | ZDR | Differential reflectivity |
| 16-19 | CC | Correlation coefficient |
| 20-23 | KDP | Specific differential phase |
## Performance
### Validation Set (2022, 2,117 events)
| Head | AUC | CSI | F1 |
|------|-----|-----|-----|
| Detection | 0.927 | 0.652 | 0.789 |
| Prediction | 0.993 | 0.883 | 0.938 |
| **Combined** | **0.960** | -- | -- |
### Test Set (3,685 events)
| Head | AUC | CSI | F1 | Precision | Recall |
|------|-----|-----|-----|-----------|--------|
| Detection | 0.896 | 0.540 | 0.702 | 0.602 | 0.841 |
| Prediction | 0.988 | 0.856 | 0.922 | 0.958 | 0.889 |
| **Combined** | **0.942** | -- | -- | -- | -- |
Per-category prediction accuracy: TOR 88.9%, WRN 96.8%, NUL 99.1%
### Comparison with Literature
| Model | Year | Frames | Channels | AUC |
|-------|------|--------|----------|-----|
| TorNet (MIT Lincoln Lab) | 2024 | 1 | 12 | ~0.88 |
| **This model** | **2026** | **8** | **24** | **0.942** |
## Training Details
| Parameter | Value |
|-----------|-------|
| Dataset | [tornet-temporal](https://huggingface.co/datasets/deepguess/tornet-temporal) (24,862 events) |
| Train split | 2013-2021 (~19,061 events) |
| Optimizer | AdamW (lr=1e-3, weight_decay=0.01) |
| Scheduler | Cosine annealing with 3-epoch linear warmup |
| Batch size | 256 |
| Epochs | 20 |
| Mixed precision | FP16 (AMP) with FP32 classification heads |
| GPU | NVIDIA H100 NVL (96GB) |
| Training time | ~4 hours |
## Usage
```python
import torch
import numpy as np
from model_resnet3d import DualHeadResNet3D # from this repo
# Load model
model = DualHeadResNet3D(in_channels=24, arch="resnet18")
state = torch.load("best.pt", map_location="cpu")
model.load_state_dict(state["model_state_dict"])
model.eval()
# Load a radar sequence
event = np.load("tornet_EVENTID_TOR/sequence.npz")
data = event["data"][:8] # first 8 frames, shape (8, 24, 128, 128)
x = torch.from_numpy(data).float().unsqueeze(0) # (1, 8, 24, 128, 128)
x = x.permute(0, 2, 1, 3, 4) # (1, 24, 8, 128, 128) -- channels first
with torch.no_grad():
out = model(x) # (1, 4)
det_prob = torch.softmax(out[:, :2], dim=1)[:, 1] # detection probability
pred_prob = torch.softmax(out[:, 2:], dim=1)[:, 1] # prediction probability
print(f"Detection probability: {det_prob.item():.3f}")
print(f"Prediction probability: {pred_prob.item():.3f}")
```
## Real-World Deployment
### How to use this in an operational setting
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).
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.
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.
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?"
5. **Thresholding**: Use a probability threshold of ~0.66 (optimized for CSI on the test set) to generate tornado warnings. At this threshold:
- **Precision 95.8%**: When the model warns, it's almost always right
- **Recall 88.9%**: Catches ~89% of actual tornadoes
- **Lead time**: The prediction head uses pre-tornado frames, providing inherent lead time
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.
### Limitations
- Trained on CONUS NEXRAD data only (2013-2022). May not generalize to other radar networks or non-US storm environments.
- Requires all 24 dual-pol channels. Single-pol radars are not supported (see 12-channel ablation for degraded single-pol performance).
- Storm-centered input assumes a working storm tracker upstream.
- 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.
- NUL (null) training samples are drawn from tornado-day radar scans only. The model has not been tested on truly quiescent weather.
## Citation
```bibtex
@model{resnet3d-18-tornet,
title={ResNet3D-18 for Temporal Radar Tornado Detection},
author={DeepGuess},
year={2026},
url={https://huggingface.co/deepguess/resnet3d-18-tornet},
}
```