furusu's picture
Update README.md
e089cbc
metadata
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%

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])