
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# vit-base-oxford-iiit-pets

This model is a fine-tuned version of [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224) on the pcuenq/oxford-pets dataset.
It achieves the following results on the evaluation set:
- Loss: 0.2039
- Accuracy: 0.9269

## Model description
## Transfer-Learned ViT Model 

This model was trained using transfer learning based on the ViT model `google/vit-base-patch16-224`.

### 🔧 Training Setup
- Dataset: Oxford-IIIT Pets
- Epochs: 7  
- Batch Size: 8  
- Learning Rate: 2e-4

### Performance on Test Set

- **Accuracy:** 0.9269  
- **Precision:** 0.9273  
- **Recall:** 0.9269

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 0.0002
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 7

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:--------:|
| 0.3448        | 1.0   | 739  | 0.2690          | 0.9418   |
| 0.2359        | 2.0   | 1478 | 0.2013          | 0.9378   |
| 0.1621        | 3.0   | 2217 | 0.1807          | 0.9391   |
| 0.1436        | 4.0   | 2956 | 0.1738          | 0.9378   |
| 0.1106        | 5.0   | 3695 | 0.1679          | 0.9445   |
| 0.1319        | 6.0   | 4434 | 0.1616          | 0.9405   |
| 0.1413        | 7.0   | 5173 | 0.1609          | 0.9391   |


### Framework versions

- Transformers 4.50.0
- Pytorch 2.6.0+cu124
- Datasets 3.4.1
- Tokenizers 0.21.1

# Comparison with the zero-shot classification model

## Zero-Shot Evaluation on the Oxford-IIIT Pet Dataset

As part of the evaluation, I compared this transfer-learned model to a zero-shot classification model. The zero-shot model used is:

**Model:** `openai/clip-vit-large-patch14`  
**Task:** zero-shot-image-classification

### Zero-Shot Model Results

On the Oxford-IIIT Pet Dataset, the zero-shot model achieved the following performance:

- **Accuracy:** 0.8800  
- **Precision:** 0.8768  
- **Recall:** 0.8800  

These results were obtained using the test set and evaluated with `sklearn.metrics`.

---


siamese birman shiba inu staffordshire bull terrier basset hound bombay japanese chin chihuahua german shorthaired pomeranian beagle english cocker spaniel american pit bull terrier ragdoll persian egyptian mau miniature pinscher sphynx maine coon keeshond yorkshire terrier havanese leonberger wheaten terrier american bulldog english setter boxer newfoundland bengal samoyed british shorthair great pyrenees abyssinian pug saint bernard russian blue scottish terrier