Update README.md
Browse files
README.md
CHANGED
|
@@ -3,6 +3,7 @@ license: apache-2.0
|
|
| 3 |
base_model: google/siglip-so400m-patch14-384
|
| 4 |
tags:
|
| 5 |
- generated_from_trainer
|
|
|
|
| 6 |
metrics:
|
| 7 |
- accuracy
|
| 8 |
- f1
|
|
@@ -11,9 +12,6 @@ model-index:
|
|
| 11 |
results: []
|
| 12 |
---
|
| 13 |
|
| 14 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 15 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 16 |
-
|
| 17 |
# siglip-tagger-test-3
|
| 18 |
|
| 19 |
This model is a fine-tuned version of [google/siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384) on an unknown dataset.
|
|
@@ -24,15 +22,61 @@ It achieves the following results on the evaluation set:
|
|
| 24 |
|
| 25 |
## Model description
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Intended uses & limitations
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## Training and evaluation data
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
## Training procedure
|
| 38 |
|
|
@@ -109,4 +153,4 @@ The following hyperparameters were used during training:
|
|
| 109 |
- Transformers 4.37.2
|
| 110 |
- Pytorch 2.1.2+cu118
|
| 111 |
- Datasets 2.16.1
|
| 112 |
-
- Tokenizers 0.15.0
|
|
|
|
| 3 |
base_model: google/siglip-so400m-patch14-384
|
| 4 |
tags:
|
| 5 |
- generated_from_trainer
|
| 6 |
+
- siglip
|
| 7 |
metrics:
|
| 8 |
- accuracy
|
| 9 |
- f1
|
|
|
|
| 12 |
results: []
|
| 13 |
---
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
# siglip-tagger-test-3
|
| 16 |
|
| 17 |
This model is a fine-tuned version of [google/siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384) on an unknown dataset.
|
|
|
|
| 22 |
|
| 23 |
## Model description
|
| 24 |
|
| 25 |
+
This model is an experimental model that predicts danbooru tags of images.
|
| 26 |
+
|
| 27 |
+
## Example
|
| 28 |
+
|
| 29 |
+
```py
|
| 30 |
+
from PIL import Image
|
| 31 |
+
import torch
|
| 32 |
+
|
| 33 |
+
from transformers import (
|
| 34 |
+
AutoModelForImageClassification,
|
| 35 |
+
AutoImageProcessor,
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
import numpy as np
|
| 39 |
+
|
| 40 |
+
MODEL_NAME = "p1atdev/siglip-tagger-test-3"
|
| 41 |
+
|
| 42 |
+
model = AutoModelForImageClassification.from_pretrained(
|
| 43 |
+
MODEL_NAME, torch_dtype=torch.bfloat16, trust_remote_code=True
|
| 44 |
+
)
|
| 45 |
+
model.eval()
|
| 46 |
+
processor = AutoImageProcessor.from_pretrained(MODEL_NAME)
|
| 47 |
+
|
| 48 |
+
image = Image.open("sample.jpg") # load your image
|
| 49 |
+
|
| 50 |
+
inputs = processor(image, return_tensors="pt").to(model.device, model.dtype)
|
| 51 |
+
|
| 52 |
+
logits = model(**inputs).logits.detach().cpu().float()[0]
|
| 53 |
+
logits = np.clip(logits, 0.0, 1.0)
|
| 54 |
+
|
| 55 |
+
results = {
|
| 56 |
+
model.config.id2label[i]: logit for i, logit in enumerate(logits) if logit > 0
|
| 57 |
+
}
|
| 58 |
+
results = sorted(results.items(), key=lambda x: x[1], reverse=True)
|
| 59 |
+
|
| 60 |
+
for tag, score in results:
|
| 61 |
+
print(f"{tag}: {score*100:.2f}%")
|
| 62 |
+
```
|
| 63 |
|
| 64 |
## Intended uses & limitations
|
| 65 |
|
| 66 |
+
This model is for research use only and is not recommended for production.
|
| 67 |
+
|
| 68 |
+
Please use wd-v1-4-tagger series by SmilingWolf:
|
| 69 |
+
|
| 70 |
+
- [SmilingWolf/wd-v1-4-moat-tagger-v2](https://huggingface.co/SmilingWolf/wd-v1-4-moat-tagger-v2)
|
| 71 |
+
- [SmilingWolf/wd-v1-4-swinv2-tagger-v2](https://huggingface.co/SmilingWolf/wd-v1-4-swinv2-tagger-v2)
|
| 72 |
+
|
| 73 |
+
etc.
|
| 74 |
+
|
| 75 |
|
| 76 |
## Training and evaluation data
|
| 77 |
|
| 78 |
+
High quality 5000 images from danbooru. They were shuffled and split into train:eval at 4500:500. (Same as p1atdev/siglip-tagger-test-2)
|
| 79 |
+
|
| 80 |
|
| 81 |
## Training procedure
|
| 82 |
|
|
|
|
| 153 |
- Transformers 4.37.2
|
| 154 |
- Pytorch 2.1.2+cu118
|
| 155 |
- Datasets 2.16.1
|
| 156 |
+
- Tokenizers 0.15.0
|