swin tiny patch4 window7 224 finetuned eurosat

nielsr

Introduction

The SWIN-TINY-PATCH4-WINDOW7-224-FINETUNED-EUROSAT model is a fine-tuned version of Microsoft's swin-tiny-patch4-window7-224, trained on the image_folder dataset. It is designed for image classification tasks and achieves high accuracy on the evaluation set.

Architecture

This model is based on the Swin Transformer architecture, specifically the swin-tiny-patch4-window7-224 variant. The architecture is optimized for image classification tasks, utilizing a hierarchical Transformer with shifted windows to efficiently capture spatial hierarchies in images.

Training

The model was trained with the following hyperparameters:

  • Learning Rate: 5e-05
  • Train Batch Size: 32
  • Evaluation Batch Size: 32
  • Seed: 42
  • Gradient Accumulation Steps: 4
  • Total Train Batch Size: 128
  • Optimizer: Adam with betas (0.9, 0.999) and epsilon 1e-08
  • Learning Rate Scheduler: Linear with a warmup ratio of 0.1
  • Number of Epochs: 3

Training results showed a final validation loss of 0.0664 and an accuracy of 0.9744.

Guide: Running Locally

  1. Install Dependencies:

    • Ensure you have Python installed.
    • Install the required libraries: transformers, torch, datasets, and tokenizers.
    pip install transformers==4.18.0 torch==1.10.0 datasets==2.0.0 tokenizers==0.11.6
    
  2. Load the Model:

    • Use the transformers library to load the model.
    from transformers import AutoModelForImageClassification, AutoTokenizer
    
    model = AutoModelForImageClassification.from_pretrained("nielsr/swin-tiny-patch4-window7-224-finetuned-eurosat")
    
  3. Run Inference:

    • Prepare your data and run inference using the model.
  4. Use Cloud GPUs:

    • For faster computation, consider using cloud-based GPU services such as AWS EC2, Google Cloud Platform, or Azure.

License

This model is licensed under the Apache 2.0 License. This allows for wide usage and modification, provided that proper attribution is given and changes are documented.

More Related APIs in Image Classification