Downloads · 30 days
0
polarimetric/sam-rfi
sam-rfi is a machine learning model from polarimetric. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Automated RFI detection for radio astronomy using Meta's Segment Anything Model 2 (SAM2), fi ne tuned on radio visibility data.
Downloads · 30 days
0
Access
Public
Updated Dec 30, 2025
Repo size
12 GB
Likes
2
Public
Click a slice to open those files.
.pth12 GB · 100%
From the Hugging Face model README
Automated RFI detection for radio astronomy using Meta's Segment Anything Model 2 (SAM2), fi ne tuned on radio visibility data.
SAM-RFI adapts SAM2's powerful segmentation capabilities to identify and flag Radio Frequenc y Interference (RFI) in radio astronomy measurement sets. The models are trained on physics- based synthetic RFI data and can detect various interference patterns including narrowband c arriers, broadband interference, and transient events.
Key Features:
samrfi CLIAll models are trained with vision encoder + mask decoder fine-tuning on radio astronomy data.
| Size | Best Train Loss | Best Val Loss | Learning Rate | Batch Size |
|---|---|---|---|---|
| tiny | 0.0708 | 0.0724 | 1e-06 | 8 |
| small | 0.0810 | 0.0764 | 1e-06 | 8 |
| base_plus | 0.0708 | 0.0740 | 1e-06 | 8 |
| large | 0.0708 | 0.0770 | 1e-06 | 8 |
pip install samrfi[gpu]
# Use any model size: tiny, small, base_plus, large
samrfi predict \
--model polarimetic/sam-rfi/large \
--input observation.ms
For deep cleaning, use 2-3 iterations to progressively find fainter RFI:
samrfi predict \
--model polarimetic/sam-rfi/large \
--input observation.ms \
--iterations 3
from samrfi.inference import RFIPredictor
# Initialize predictor (auto-downloads model)
predictor = RFIPredictor(
model_path="polarimetic/sam-rfi/large",
device="cuda"
)
# Single-pass prediction
flags = predictor.predict_ms("observation.ms")
# Iterative prediction (3 passes)
flags = predictor.predict_iterative("observation.ms", num_iterations=3)
The vision encoder and mask decoder are trained on radio astronomy data, adapting SAM2's vis ual features to recognize RFI patterns in visibility waterfalls.
Radio visibility data is converted to 3-channel RGB-like features:
All channels normalized with ImageNet statistics for SAM2 compatibility.
Typical validation metrics:
Performance varies by RFI type, severity, and model size. Iterative prediction (2-3 passes) improves detection of faint RFI.
# Fast testing with tiny model
samrfi predict --model polarimetic/sam-rfi/tiny --input obs.ms
# Balanced performance with base_plus
samrfi predict --model polarimetic/sam-rfi/base_plus --input obs.ms --iterations 2
# Best performance with large model
samrfi predict --model polarimetic/sam-rfi/large --input obs.ms --iterations 3
from samrfi.inference import RFIPredictor
# Conservative flagging (fewer false positives)
predictor = RFIPredictor("polarimetic/sam-rfi/large", device="cuda")
flags = predictor.predict_ms("obs.ms") # Single pass
# Aggressive deep cleaning (more thorough)
flags = predictor.predict_iterative("obs.ms", num_iterations=3)
SAM-RFI works directly with CASA measurement sets:
from samrfi.inference import RFIPredictor
# Flag RFI in measurement set
predictor = RFIPredictor("polarimetic/sam-rfi/large", device="cuda")
flags = predictor.predict_ms("observation.ms")
# Flags are automatically written to MS FLAG column
# Continue with CASA calibration pipeline...
A paper describing SAM-RFI is in preparation. If you use these models, please cite:
@software{samrfi2024,
author = {polarimetic},
title = {SAM-RFI: Radio Frequency Interference Detection with SAM2},
year = {2024},
url = {https://github.com/preshanth/SAM-RFI},
note = {Models available at https://huggingface.co/polarimetic/sam-rfi}
}
Training compute provided by the [National AI Research Resource (NAIRR)](https://nairrpilot. org/) Pilot via Jetstream-2 at Indiana University.
MIT License - See repository for details.
Generated with SAM-RFI • Models: tiny, small, base_plus, large