Downloads · 30 days
0
kostaspic/AMFITRITE-Sentinel2-HAB-Universal-ResNet18
AMFITRITE-Sentinel2-HAB-Universal-ResNet18 is a image classification model from kostaspic. Use it when you need a label for an image. The card lists the license as apache-2.0.
This model is a lightweight deep learning classifier designed for the detection of Harmful Algal Blooms (HABs) across diverse aquatic environments (both inland and open waters) using Sentinel-2 Level-2A satellite imag…
Downloads · 30 days
0
Access
Public
Updated May 26, 2026
Repo size
44.9 MB
Likes
0
Public
Click a slice to open those files.
.pth44.9 MB · 100%
From the Hugging Face model README
This model is a lightweight deep learning classifier designed for the detection of Harmful Algal Blooms (HABs) across diverse aquatic environments (both inland and open waters) using Sentinel-2 Level-2A satellite imagery. It operates as a binary classifier, determining whether a water surface patch contains a HAB. The model is built on the ResNet-18 architecture, to comply with the strict Size, Weight, and Power (SWaP) constraints of Low Earth Orbit edge devices, such as the Intel Myriad X VPU onboard the CogniSAT-6 satellite. It was initialized with weights pretrained on BigEarthNet v2.0 and fine-tuned as a Universal Foundation Model utilizing both the Inland Water Dataset (IWD) and the Open Water Dataset (OWD).
The universal foundation model was trained on the combined datasets to eliminate the necessity for domain-specific deployments. Additionally, extended tests with domain-specific models tuned for inland and open waters showed that this foundation model performs equally good, or better than each domain-specific tuned model.
High and Moderate samples.Low samples, along with purely clear water, land, and cloud tiles.Utilizes 10 spectral bands from Sentinel-2 in the following order: B02, B03, B04, B05, B06, B07, B08, B8A, B11, B12, matching the configuration of the BigEarthNet v2.0 pretrained weights for Sentinel-2 data.
The model was evaluated on a strictly stratified validation and test set to ensure reliability.
| Metric | Validation Set | Test Set |
|---|---|---|
| F1 Score | 0.880 | 0.880 |
| Accuracy | 0.886 | 0.893 |
| Balanced Acc | 0.880 | 0.892 |
| HAB Accuracy | 0.904 | 0.896 |
| non-HAB Accuracy | 0.857 | 0.889 |
| IW F1 Score | 0.848 | 0.869 |
| IW Accuracy | 0.873 | 0.889 |
| IW Balanced Acc | 0.845 | 0.873 |
| IW HAB Accuracy | 0.895 | 0.893 |
| IW non-HAB Accuracy | 0.776 | 0.832 |
| OW F1 Score | 0.906 | 0.899 |
| OW Accuracy | 0.906 | 0.900 |
| OW Balanced Acc | 0.905 | 0.898 |
| OW HAB Accuracy | 0.882 | 0.857 |
| OW non-HAB Accuracy | 0.930 | 0.939 |
HAB accuracy is the Sensitivity (Recall): (True Positives) / (True Positives + False Negatives)
non-HAB accuracy is the Specificity: (True Negatives) / (True Negatives + False Positives)
To successfully run inference with this model, the input data must meet the following criteria:
B02, B03, B04, B05, B06, B07, B08, B8A, B11, B12.10000.0.(Batch_Size, 10, 256, 256).This model requires the timm library.
pip install torch timm rasterio
import rasterio
import torch
import timm
import numpy as np
import torch.nn.functional as F
# 1. Load Model (Configured for ResNet-18 with 10 input channels)
model = timm.create_model('resnet18', pretrained=False, num_classes=2, in_chans=10)
# Load weights (assuming the file is downloaded locally as 'amfitrite_universal_model.pth'), use huggingface_hub to download directly
state_dict = torch.load("amfitrite_universal_model.pth", map_location='cpu')
model.load_state_dict(state_dict)
model.eval()
def predict_patch(img_tensor):
"""
Args:
img_tensor (torch.Tensor): A tensor of shape (10, Height, Width) containing Sentinel-2 bands.
"""
# 1. Add batch dimension -> Shape: (1, 10, H, W)
img_tensor = img_tensor.unsqueeze(0)
# 2. Force resize to the required 256x256
if img_tensor.shape[-2:] != (256, 256):
img_tensor = F.interpolate(img_tensor, size=(256, 256), mode='bilinear', align_corners=False)
# 3. Normalize Sentinel-2 DN values (0-10000)
img_tensor = img_tensor / 10000.0
# 4. Predict
with torch.no_grad():
output = model(img_tensor)
score = torch.softmax(output, dim=1)[0, 1].item() # Network's score
pred_class = torch.argmax(output, dim=1)
return score, pred_class
# --- Example Usage ---
# Dummy tensor representing a 10-band image that is 256x256 pixels
sample_image = torch.rand(10, 256, 256) * 5000
score, pred_class = predict_patch(sample_image)
print(f"Score: {score:.2}, so class is: {pred_class}")
If you use this model in your research, please cite the following papers for the underlying architecture and pre-training:
1. This Model: Pikounis, K. (2026). Sentinel-2 HAB Detector (RDNet Base). Amfitrite Project.
@misc{pikounis2026hab,
author = {Pikounis, Kostas},
title = {Sentinel-2 HAB Detector (RDNet Base)},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/kostaspic/AMFITRITE-Sentinel2-HAB-RDNet}},
organization = {Amfitrite Project}
}
2. Amfitrite Datasets:
3. BigEarthNet v2.0 (Pretraining Source): K. Clasen, L. Hackel, T. Burgert, G. Sumbul, B. Demir, V. Markl, "reBEN: Refined BigEarthNet Dataset for Remote Sensing Image Analysis", IEEE International Geoscience and Remote Sensing Symposium (IGARSS), 2025.
@inproceedings{clasen2025refinedbigearthnet,
title={{reBEN}: Refined BigEarthNet Dataset for Remote Sensing Image Analysis},
author={Clasen, Kai Norman and Hackel, Leonard and Burgert, Tom and Sumbul, Gencer and Demir, Beg{\"u}m and Markl, Volker},
year={2025},
booktitle={IEEE International Geoscience and Remote Sensing Symposium (IGARSS)},
}