Paul commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,10 +1,43 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
-
-
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- imageomics/fish-vista
|
| 5 |
tags:
|
| 6 |
+
- swin
|
| 7 |
+
- swin-transformer
|
| 8 |
+
- fish
|
| 9 |
+
- fish-classification
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Swin Transformer for Fish Classification
|
| 13 |
+
|
| 14 |
+
This swin-tiny transformer was trained to classify fish species from the fish-visa dataset. The dataset contains massive imbalance and has varying
|
| 15 |
+
degrees of accuracy depending on the class frequency. I recommend to use this model weights as a baseline for building a classification or segmentation
|
| 16 |
+
model.
|
| 17 |
+
|
| 18 |
+
## Usage
|
| 19 |
+
Load and use the model :
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
import torch
|
| 23 |
+
from PIL import Image
|
| 24 |
+
from transformers import AutoImageProcessor
|
| 25 |
+
from transformers import AutoModel
|
| 26 |
+
|
| 27 |
+
# 1. Load the model and processor from the Hub
|
| 28 |
+
repo_id = "Aelyos/swin-fish-classification"
|
| 29 |
+
|
| 30 |
+
# This downloads the code from the Hub and initializes the classes automatically
|
| 31 |
+
processor = AutoImageProcessor.from_pretrained(repo_id, trust_remote_code=True)
|
| 32 |
+
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True, id2label=id2label, label2id=label2id)
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Training
|
| 36 |
+
The model was trained on 80 epochs on a A10 GPU, first by training the classifier head only for 30 epochs and then by training the entire model for 50 more epochs.
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
|
| 40 |
+
## Results
|
| 41 |
+
Following the original fish-vista paper, I computed the accuracy accross bins (ultra rare 2-10, minority 10-100, neutral 100-500, majority 500+).
|
| 42 |
+
|
| 43 |
+

|