
<!-- 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. -->

# swin-base-patch4-window7-224-in22k-finetuned-brain-tumor-final

This model is a fine-tuned version of [microsoft/swin-base-patch4-window7-224-in22k](https://huggingface.co/microsoft/swin-base-patch4-window7-224-in22k) on the imagefolder dataset.
It achieves the following results on the evaluation set:
- Loss: 0.1577
- Accuracy: 0.9396
- F1 Score: 0.9385
- Precision: 0.9408

## 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: 1e-05
- train_batch_size: 32
- eval_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
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 20

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 Score | Precision |
|:-------------:|:-----:|:----:|:---------------:|:--------:|:--------:|:---------:|
| 1.1562        | 0.99  | 41   | 1.1378          | 0.6378   | 0.6191   | 0.6537    |
| 0.4878        | 1.99  | 82   | 0.6477          | 0.7591   | 0.7499   | 0.7874    |
| 0.2623        | 2.98  | 123  | 0.4410          | 0.8337   | 0.8311   | 0.8488    |
| 0.1985        | 4.0   | 165  | 0.4660          | 0.8144   | 0.8115   | 0.8455    |
| 0.1736        | 4.99  | 206  | 0.3230          | 0.8776   | 0.8760   | 0.8894    |
| 0.124         | 5.99  | 247  | 0.2684          | 0.9026   | 0.9014   | 0.9090    |
| 0.1278        | 6.98  | 288  | 0.2210          | 0.9180   | 0.9166   | 0.9210    |
| 0.0959        | 8.0   | 330  | 0.2151          | 0.9208   | 0.9195   | 0.9260    |
| 0.0849        | 8.99  | 371  | 0.2154          | 0.9220   | 0.9205   | 0.9291    |
| 0.0805        | 9.99  | 412  | 0.2112          | 0.9191   | 0.9179   | 0.9251    |
| 0.0682        | 10.98 | 453  | 0.1563          | 0.9385   | 0.9369   | 0.9402    |
| 0.0624        | 12.0  | 495  | 0.1577          | 0.9396   | 0.9385   | 0.9408    |
| 0.0415        | 12.99 | 536  | 0.1836          | 0.9305   | 0.9294   | 0.9332    |
| 0.0465        | 13.99 | 577  | 0.2145          | 0.9203   | 0.9192   | 0.9252    |
| 0.056         | 14.98 | 618  | 0.1710          | 0.9339   | 0.9325   | 0.9369    |
| 0.0545        | 16.0  | 660  | 0.2094          | 0.9248   | 0.9236   | 0.9298    |
| 0.0591        | 16.99 | 701  | 0.1752          | 0.9317   | 0.9303   | 0.9341    |
| 0.0512        | 17.99 | 742  | 0.1781          | 0.9311   | 0.9297   | 0.9342    |
| 0.0424        | 18.98 | 783  | 0.1873          | 0.9305   | 0.9293   | 0.9338    |
| 0.0438        | 19.88 | 820  | 0.1955          | 0.9265   | 0.9252   | 0.9307    |


### Framework versions

- Transformers 4.29.2
- Pytorch 2.0.1+cu117
- Datasets 2.12.0
- Tokenizers 0.13.3

glioma meningioma notumor pituitary