Update README.md
Browse files
README.md
CHANGED
@@ -7,3 +7,22 @@ finetuned from https://huggingface.co/google/vit-base-patch16-224-in21k
|
|
7 |
dataset:26k images
|
8 |
|
9 |
accuracy of validation dataset is 95%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
dataset:26k images
|
8 |
|
9 |
accuracy of validation dataset is 95%
|
10 |
+
|
11 |
+
|
12 |
+
```Python
|
13 |
+
from transformers import ViTFeatureExtractor, ViTForImageClassification
|
14 |
+
from PIL import Image
|
15 |
+
|
16 |
+
path = 'image_path'
|
17 |
+
image = Image.open(path)
|
18 |
+
|
19 |
+
feature_extractor = ViTFeatureExtractor.from_pretrained('furusu/umamusume-classifier')
|
20 |
+
model = ViTForImageClassification.from_pretrained('furusu/umamusume-classifier')
|
21 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
22 |
+
|
23 |
+
outputs = model(**inputs)
|
24 |
+
|
25 |
+
predicted_class_idx = outputs.logits.argmax(-1).item()
|
26 |
+
print("Predicted class:", model.config.id2label[predicted_class_idx])
|
27 |
+
|
28 |
+
```
|