Downloads · 30 days
14
37% of all-time downloads
hsilvosa/safecast-radiation-spatial-regressor
safecast-radiation-spatial-regressor is a tabular regression model from hsilvosa. Use it for the tabular regression task on the model card, and read the license before you ship it in a product. The card lists the license as cc0-1.0.
This repository provides SpatialHarmonicNet, a continuous spatial neural regression model that predicts environmental ambient radiation levels in microsieverts per hour (uSv/h) anywhere on Earth from geographic coordi…
Downloads · 30 days
14
37% of all-time downloads
All-time downloads
38
Public
Parameters
395K
11.8 MB on disk
Likes
0
Public
Click a slice to open those files.
.joblib7 MB · 59%
From the Hugging Face model README
This repository provides SpatialHarmonicNet, a continuous spatial neural regression model that predicts environmental ambient radiation levels in microsieverts per hour (uSv/h) anywhere on Earth from geographic coordinates (latitude, longitude) and performs real-time radioactive anomaly detection.
The model is trained on crowdsourced radiation sensor measurements from the Safecast Historical Dataset, which spans over 265 million measurements collected worldwide from 2011 to 2026.
SpatialHarmonicNet is designed specifically for spherical planetary coordinates:
Evaluation performed on a holdout spatial test split (stratified across global 0.1-degree spatial grid cells):
| Metric | SpatialHarmonicNet (PyTorch) |
|---|---|
| R2 Score (log-scale) | 0.0785 |
| RMSE (uSv/h) | 3.11636 uSv/h |
| MAE (uSv/h) | 0.67873 uSv/h |
| 95% Confidence Interval Coverage (PICP) | 94.3% |
| Location | Category | Expected / Measured Baseline | Anomaly Trigger (at 5.0 uSv/h) |
|---|---|---|---|
| Chernobyl Reactor 4 Shelter | Nuclear Exclusion Zone | Elevated | ANOMALY_HIGH / CRITICAL |
| Pripyat Red Forest | Nuclear Exclusion Zone | Elevated | ANOMALY_HIGH / CRITICAL |
| Fukushima Daiichi | Nuclear Exclusion Zone | Elevated | ANOMALY_HIGH / CRITICAL |
| Tokyo Metropolitan Area | Urban Background | ~0.05 - 0.08 uSv/h | ANOMALY_CRITICAL (Z > 12) |
| Paris, France | Urban Background | ~0.06 - 0.09 uSv/h | ANOMALY_CRITICAL (Z > 12) |
| New York City, USA | Urban Background | ~0.07 - 0.10 uSv/h | ANOMALY_CRITICAL (Z > 12) |
| Denver, USA (Mile-High) | Elevated Cosmic Background | ~0.12 - 0.16 uSv/h | ANOMALY_CRITICAL (Z > 10) |
pip install torch safetensors numpy pandas scipy
import json
import torch
from safetensors.torch import load_file
from radiation_map.models.spatial_net import SpatialHarmonicNet
from radiation_map.models.anomaly_detector import RadiationAnomalyDetector
# 1. Initialize model
model = SpatialHarmonicNet(num_frequencies=32, max_frequency_log=4.5, hidden_dims=(256, 256, 128, 64))
state_dict = load_file("model.safetensors")
model.load_state_dict(state_dict)
model.eval()
# 2. Predict baseline radiation at a coordinate
# Coordinates for Tokyo (35.6895 N, 139.6917 E)
pred = model.predict_radiation(latitudes=35.6895, longitudes=139.6917)
print(f"Predicted baseline: {pred['radiation_usv']:.4f} uSv/h")
print(f"95% Confidence Interval: [{pred['ci_lower_usv']:.4f}, {pred['ci_upper_usv']:.4f}] uSv/h")
# 3. Real-time Anomaly Detection
detector = RadiationAnomalyDetector(model)
result = detector.detect(
latitude=35.6895,
longitude=139.6917,
observed_value=2.50, # hypothetical spike in uSv/h
unit="usv"
)
print(f"Severity: {result.severity.value}")
print(f"Z-score: {result.z_score:.2f}")
print(f"Fold increase: {result.fold_increase:.1f}x")
print(f"Description: {result.description}")
import numpy as np
import onnxruntime as ort
session = ort.InferenceSession("spatial_regressor.onnx")
# Project lat/lon to 3D Cartesian coordinates
lat, lon = np.radians(35.6895), np.radians(139.6917)
xyz = np.array([[np.cos(lat)*np.cos(lon), np.cos(lat)*np.sin(lon), np.sin(lat)]], dtype=np.float32)
inputs = {"coords_cartesian": xyz}
mu_log, log_var = session.run(None, inputs)
# Inverse log transform to get uSv/h
pred_usv = np.expm1(mu_log[0][0]) / 10.0
print(f"ONNX Predicted uSv/h: {pred_usv:.4f}")
@misc{safecast_spatial_radiation,
author = {Safecast Contributors and Project Authors},
title = {Global Radiation Anomaly Map and Spatial Regressor},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/models}}
}