Edit model card

ResNet-50 EuroSat RGB Classifier

Model Details

Model Description: This project implements a ResNet-50 model (pre-trained on ImageNet 1k) for classifying images from the EuroSat RGB dataset across 10 Land Use and Land Cover (LULC) classes.

Model type: ResNet-50

Finetuned from model: Pre-trained ResNet-50 on ImageNet 1k

Model Sources:

Uses

Direct Use: Classification of images in the EuroSat RGB dataset into 10 LULC classes.

How to Get Started with the Model

import torch
from datasets import load_dataset
from transformers import AutoImageProcessor, AutoModelForImageClassification

# Eurosat-RGB data
eurosat = load_dataset("cm93/eurosat")
image = eurosat["test"][2]["image"]

processor = AutoImageProcessor.from_pretrained("cm93/resnet-50-eurosat")
model = AutoModelForImageClassification.from_pretrained("cm93/resnet-50-eurosat", trust_remote_code=True)

processed_image = processor(image, return_tensors="pt")
processed_image = processed_image.pixel_values

with torch.no_grad():
    prediction = model(processed_image)['logits'].argmax(1).item()
print(model.config.id2label[prediction])
>>> Residential

Training Details

  • Base Model: ResNet-50
  • Pre-training Dataset: ImageNet 1k
  • Target Dataset: EuroSat RGB
  • Transfer Learning Method:
    • Phase 1: Feature Extraction: Used the pre-trained ResNet-50 convolutional base to extract features from EuroSat RGB images, replacing and training only the final classification layer.
    • Phase 2: Fine-tuning: Fine-tuned the entire model with a lower learning rate to optimize performance on the EuroSat dataset.
  • Image Dimensions: 64x64 pixels
  • Optimizer: Adam
  • Learning Rate: 1e-3
  • Sheduler : ReduceLROnPlateau on validation loss
  • Early Stoping patience : 5 epochs
  • Batch Size: 64
  • Epochs:
    • Feature Extraction: 10 epochs
    • Fine-tuning: 20 epochs
  • Loss Function: Cross-entropy loss

Metrics

These resuls were achieved within 7 epochs in fine tuning.

Metric Training Set Validation Set Test Set
Overall Accuracy 99.55% 98.74% 98.70%
Avg Loss 0.015223 0.041319 0.044116
Downloads last month
49
Safetensors
Model size
23.6M params
Tensor type
F32
·
Inference API
Drag image file here or click to browse from your device
Inference API (serverless) does not yet support model repos that contain custom code.

Dataset used to train cm93/resnet-50-eurosat