cm93/eurosat
Viewer • Updated • 27k • 70
How to use Haifald/vit-eurosat with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="Haifald/vit-eurosat")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("Haifald/vit-eurosat")
model = AutoModelForImageClassification.from_pretrained("Haifald/vit-eurosat", device_map="auto")This model is a fine-tuned version of google/vit-base-patch16-224 for satellite land-cover classification on the EuroSAT dataset.
google/vit-base-patch16-224The model was evaluated on the held-out EuroSAT test split of 2,700 images.
| Metric | Result |
|---|---|
| Test Accuracy | 98.70% |
| Macro F1 | 98.67% |
For comparison, a fine-tuned ResNet50 trained on the same data split achieved:
| Metric | Result |
|---|---|
| Test Accuracy | 97.41% |
| Macro F1 | 97.36% |
ViT achieved higher classification performance in this experiment, while ResNet50 trained substantially faster.
The pretrained ViT classification head was adapted to the 10 EuroSAT classes and the model was fine-tuned end to end using Hugging Face Transformers.
Training configuration:
5e-50.013from transformers import pipeline
classifier = pipeline(
"image-classification",
model="Haifald/vit-eurosat"
)
predictions = classifier("path_to_image.jpg")
print(predictions)
Full experiment and comparison with ResNet50: GitHub link will be added after the repository is published.
Base model
google/vit-base-patch16-224