

# vit-base-oxford-iiit-pets

This model was trained to classify cats and dogs and define it's breed using transfer learning method. It 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.2068
- Accuracy: 0.9350

## Model description

Since [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224) was used as the base model, the final classification layer was modified to predict 37 classes of cats and dogs from the dataset.

## Intended uses & limitations

This model is designed for educational purposes, enabling the classification of cats and dogs and the identification of their breeds. It currently supports 37 distinct breeds, offering a starting point for various learning and experimentation scenarios. Beyond its educational use, the model can serve as a foundation for further development, such as expanding its classification capabilities to include additional breeds, other animal species, or even entirely different tasks. With fine-tuning, this model could be adapted to broader applications in animal recognition, wildlife monitoring, and pet identification systems.

## Training and evaluation data
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0003
- train_batch_size: 16
- 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: 10
### Training results
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:--------:|
| 0.3625        | 1.0   | 370  | 0.2933          | 0.9269   |
| 0.2002        | 2.0   | 740  | 0.2221          | 0.9432   |
| 0.1511        | 3.0   | 1110 | 0.2057          | 0.9418   |
| 0.1253        | 4.0   | 1480 | 0.1876          | 0.9418   |
| 0.1236        | 5.0   | 1850 | 0.1825          | 0.9432   |
| 0.1078        | 6.0   | 2220 | 0.1785          | 0.9418   |
| 0.078         | 7.0   | 2590 | 0.1809          | 0.9364   |
| 0.0798        | 8.0   | 2960 | 0.1785          | 0.9378   |
| 0.0811        | 9.0   | 3330 | 0.1774          | 0.9364   |
| 0.0736        | 10.0  | 3700 | 0.1769          | 0.9391   |
### Evaluation results
| Metric                   | Value                |
|--------------------------|----------------------|
| Evaluation Loss          | 0.2202              |
| Evaluation Accuracy      | 92.56%              |
| Evaluation Runtime (s)   | 7.39                |
| Samples Per Second       | 100.04              |
| Steps Per Second         | 12.59               |
| Epoch                    | 10                  |
### Framework versions
- Transformers 4.46.3
- Pytorch 2.0.1+cu117
- Datasets 3.1.0
- Tokenizers 0.20.3
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