pytorch tensorboard vit image-classification dataset:chest xrays transformers generated_from_trainer license:apache-2.0 model-index
---
license: apache-2.0
tags:
- image-classification
- generated_from_trainer
datasets:
- chest xrays
widget:
- src: https://drive.google.com/uc?id=1yqnhD4Wjt4Y_NGLtijTGGaaw9GL497kQ
  example_title: PNEUMONIA
- src: https://drive.google.com/uc?id=1xjcIEDb8kuSd4wF44gCEgsc0PfRvs53m
  example_title: NORMAL

metrics:
- accuracy
model-index:
- name: vit-base-xray-pneumonia
  results: []
---

<!-- 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-xray-pneumonia

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 [chest-xray-pneumonia](https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia) dataset.
It achieves the following results on the evaluation set:
- Loss: 0.3387
- Accuracy: 0.9006

## Model description

More information needed

## Intended uses & limitations

More information needed

## Training and evaluation data

More information needed

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 0.0002
- train_batch_size: 16
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 10

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:--------:|
| 0.1233        | 0.31  | 100  | 1.1662          | 0.6651   |
| 0.0868        | 0.61  | 200  | 0.3387          | 0.9006   |
| 0.1387        | 0.92  | 300  | 0.5297          | 0.8237   |
| 0.1264        | 1.23  | 400  | 0.4566          | 0.8590   |
| 0.0829        | 1.53  | 500  | 0.6832          | 0.8285   |
| 0.0734        | 1.84  | 600  | 0.4886          | 0.8157   |
| 0.0132        | 2.15  | 700  | 1.3639          | 0.7292   |
| 0.0877        | 2.45  | 800  | 0.5258          | 0.8846   |
| 0.0516        | 2.76  | 900  | 0.8772          | 0.8013   |
| 0.0637        | 3.07  | 1000 | 0.4947          | 0.8558   |
| 0.0022        | 3.37  | 1100 | 1.0062          | 0.8045   |
| 0.0555        | 3.68  | 1200 | 0.7822          | 0.8285   |
| 0.0405        | 3.99  | 1300 | 1.9288          | 0.6779   |
| 0.0012        | 4.29  | 1400 | 1.2153          | 0.7981   |
| 0.0034        | 4.6   | 1500 | 1.8931          | 0.7308   |
| 0.0339        | 4.91  | 1600 | 0.9071          | 0.8590   |
| 0.0013        | 5.21  | 1700 | 1.6266          | 0.7580   |
| 0.0373        | 5.52  | 1800 | 1.5252          | 0.7676   |
| 0.001         | 5.83  | 1900 | 1.2748          | 0.7869   |
| 0.0005        | 6.13  | 2000 | 1.2103          | 0.8061   |
| 0.0004        | 6.44  | 2100 | 1.3133          | 0.7981   |
| 0.0004        | 6.75  | 2200 | 1.2200          | 0.8045   |
| 0.0004        | 7.06  | 2300 | 1.2834          | 0.7933   |
| 0.0004        | 7.36  | 2400 | 1.3080          | 0.7949   |
| 0.0003        | 7.67  | 2500 | 1.3814          | 0.7917   |
| 0.0004        | 7.98  | 2600 | 1.2853          | 0.7965   |
| 0.0003        | 8.28  | 2700 | 1.3644          | 0.7933   |
| 0.0003        | 8.59  | 2800 | 1.3137          | 0.8013   |
| 0.0003        | 8.9   | 2900 | 1.3507          | 0.7997   |
| 0.0003        | 9.2   | 3000 | 1.3751          | 0.7997   |
| 0.0003        | 9.51  | 3100 | 1.3884          | 0.7981   |
| 0.0003        | 9.82  | 3200 | 1.3831          | 0.7997   |

## Example Images


#### Pneumonia Chest X-Ray

![Pneumonia](https://drive.google.com/uc?id=1yqnhD4Wjt4Y_NGLtijTGGaaw9GL497kQ)

#### Normal Chest X-Ray


![Normal](https://drive.google.com/uc?id=1xjcIEDb8kuSd4wF44gCEgsc0PfRvs53m)

### Framework versions

- Transformers 4.17.0
- Pytorch 1.10.0+cu111
- Datasets 1.18.4
- Tokenizers 0.11.6
