File size: 723 Bytes
7dbb6cb f413b30 e089cbc 2d5b980 80b4a18 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
---
license: apache-2.0
---
finetuned from https://huggingface.co/google/vit-base-patch16-224-in21k
dataset:26k images (train:21k valid:5k)
accuracy of validation dataset is 95%
```Python
from transformers import ViTFeatureExtractor, ViTForImageClassification
from PIL import Image
path = 'image_path'
image = Image.open(path)
feature_extractor = ViTFeatureExtractor.from_pretrained('furusu/umamusume-classifier')
model = ViTForImageClassification.from_pretrained('furusu/umamusume-classifier')
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
predicted_class_idx = outputs.logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])
```
|