

# Pokemon-classification-1stGen

This model is a fine-tuned version of [google/vit-base-patch16-224-in21k](https://huggingface.co/google/vit-base-patch16-224-in21k) on the [Dusduo/1stGen-Pokemon-Images](https://huggingface.co/datasets/Dusduo/1stGen-Pokemon-Images) dataset.
It has been trained to discriminate between the pokemons from the [1st Generation](https://en.wikipedia.org/wiki/List_of_generation_I_Pok%C3%A9mon).
It achieves the following results on the evaluation set:
- Loss: 0.4182
- F1: 0.9272

A demonstration of the model application is [hosted on Spaces](https://huggingface.co/spaces/Dusduo/GottaClassifyEmAll).
Feel free to check it out!


## Model description

Transformer-based vision model for pokemon image classification.

## Intended uses & limitations

This model is intended to classify between pokemons from the 1st Generation. Therefore, when provided with images of pokemon from posterior generation, the model outputs won't be usable as such.
Moreover, the model was not designed to handle non pokemon images as well as images presenting several entities. 
However, an additional layer can help mitigate the risk of wrongly classifying non pokemon images by analyzing the spread of the output (the confusion of the model), such a layer can be found in my implementation, available [here](https://github.com/A-Duss/GottaClassifyEmAll).

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 6.56462271373806e-05
- train_batch_size: 4
- eval_batch_size: 16
- seed: 42
- gradient_accumulation_steps: 4
- total_train_batch_size: 16
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 7

### Training results

| Training Loss | Epoch | Step | Validation Loss | F1     |
|:-------------:|:-----:|:----:|:---------------:|:------:|
| 4.3698        | 1.0   | 527  | 3.2781          | 0.5784 |
| 2.3225        | 2.0   | 1055 | 1.6644          | 0.7368 |
| 1.1907        | 3.0   | 1582 | 0.9749          | 0.8475 |
| 0.6947        | 4.0   | 2110 | 0.6765          | 0.8939 |
| 0.4827        | 5.0   | 2637 | 0.5290          | 0.9171 |
| 0.3515        | 6.0   | 3165 | 0.4530          | 0.9195 |
| 0.3074        | 6.99  | 3689 | 0.4182          | 0.9272 |


### Framework versions

- Transformers 4.35.2
- Pytorch 2.2.0.dev20231126+cu118
- Datasets 2.15.0
- Tokenizers 0.15.0

abra aerodactyl butterfree ponyta porygon primeape psyduck raichu rapidash raticate rattata rhydon rhyhorn caterpie sandshrew sandslash scyther seadra seaking seel shellder slowbro slowpoke snorlax chansey spearow squirtle starmie staryu tangela tauros tentacool tentacruel vaporeon venomoth charizard venonat venusaur victreebel vileplume voltorb vulpix wartortle weedle weepinbell weezing charmander wigglytuff zapdos zubat charmeleon clefable clefairy cloyster cubone alakazam dewgong diglett ditto dodrio doduo dragonair dragonite dratini drowzee dugtrio arbok eevee ekans electabuzz electrode exeggcute exeggutor farfetchd fearow flareon gastly arcanine gengar geodude gloom golbat goldeen golduck graveler grimer growlithe gyarados articuno haunter hitmonchan hitmonlee horsea hypno ivysaur jigglypuff jolteon jynx kabutops beedrill kadabra kakuna kangaskhan kingler koffing lapras lickitung machamp machoke machop bellsprout magikarp magmar magnemite magneton mankey marowak meowth metapod mew mewtwo blastoise moltres mr. mime mrmime nidoking nidoqueen nidorina nidorino ninetales oddish omanyte bulbasaur omastar parasect pidgeot pidgeotto pidgey pikachu pinsir poliwag poliwhirl poliwrath