Downloads · 30 days
15
19% of all-time downloads
krylox/resnet50-eurosat-onnx
resnet50-eurosat-onnx is a image classification model from krylox. Use it when you need a label for an image. It is set up for onnx. The card lists the license as mit.
ONNX export of cm93/resnet50-eurosat, a ResNet-50 model fine-tuned on the EuroSAT satellite imagery dataset for land-use and land-cover (LULC) classification.
Downloads · 30 days
15
19% of all-time downloads
All-time downloads
79
Public
Repo size
94 MB
Likes
0
Public
Click a slice to open those files.
.onnx94 MB · 100%
From the Hugging Face model README
ONNX export of cm93/resnet50-eurosat, a ResNet-50 model fine-tuned on the EuroSAT satellite imagery dataset for land-use and land-cover (LULC) classification.
| Property | Value |
|---|---|
| Architecture | ResNet-50 (ImageNet-1k pretrained) |
| Task | Image Classification |
| Classes | 10 |
| Format | ONNX |
| Source model | cm93/resnet50-eurosat |
| Source library | timm |
| License | MIT |
| Index | Label |
|---|---|
| 0 | AnnualCrop |
| 1 | Forest |
| 2 | HerbaceousVegetation |
| 3 | Highway |
| 4 | Industrial |
| 5 | Pasture |
| 6 | PermanentCrop |
| 7 | Residential |
| 8 | River |
| 9 | SeaLake |
Note: Index order reflects
id2labelfrom the source model config. Always load it viaAutoConfig.from_pretrained("cm93/resnet50-eurosat")rather than assuming alphabetical order.
Evaluated on the cm93/eurosat test split. Preprocessing applied using the source model's TimmWrapperImageProcessor via AutoImageProcessor.from_pretrained("cm93/resnet50-eurosat").
| Metric | Score |
|---|---|
| Accuracy | 0.9670 |
| Precision (macro) | 0.9662 |
| Recall (macro) | 0.9669 |
| F1 (macro) | 0.9662 |
Source model reported metrics (from cm93/resnet50-eurosat):
| Split | Accuracy | F1 |
|---|---|---|
| Train | 0.9756 | — |
| Validation | 0.9830 | — |
| Test | 0.9807 | 0.9807 |
pip install onnxruntime huggingface_hub transformers
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoImageProcessor, AutoConfig
from PIL import Image
# Load ONNX session
model_path = hf_hub_download("krylox/resnet50-eurosat-onnx", filename="model.onnx")
session = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
# Load processor and label map from the source model
processor = AutoImageProcessor.from_pretrained("cm93/resnet50-eurosat")
id2label = AutoConfig.from_pretrained("cm93/resnet50-eurosat").id2label
# Preprocess and infer
image = Image.open("your_image.jpg").convert("RGB")
pixel_values = processor(images=image, return_tensors="pt")["pixel_values"].numpy().astype(np.float32)
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
logits = session.run([output_name], {input_name: pixel_values})[0]
predicted_label = id2label[int(np.argmax(logits, axis=1)[0])]
print(f"Predicted class: {predicted_label}")
Important: Use
AutoImageProcessor.from_pretrained("cm93/resnet50-eurosat")for preprocessing — the source model usesTimmWrapperImageProcessor, which may differ from standard ImageNet normalization. Using hardcoded stats will degrade accuracy significantly.
| Parameter | Value |
|---|---|
| Base weights | ResNet-50 pretrained on ImageNet-1k |
| Optimizer | AdamW (β₁=0.9, β₂=0.999) |
| Learning rate | 3e-5 |
| Weight decay | 0.01 |
| Batch size | 64 |
| Scheduler | PolynomialLR |
| Loss | CrossEntropyLoss |
| Epochs | 20 |
| Augmentation | RandomHorizontalFlip, RandomVerticalFlip |
| Preprocessing | Resize → CenterCrop → Normalize |
The source model was trained on EuroSAT, which contains 27,000 labeled, geo-referenced Sentinel-2 satellite image patches (JPEG, 64×64 px) across 10 LULC classes.