Downloads · 30 days
55
0% of all-time downloads
imjeffhi/pokemon_classifier
pokemon_classifier is a image classification model from imjeffhi. Use it when you need a label for an image. It is set up for transformers.
A fine-tuned version of ViT-base on a collected set of Pokémon images. You can read more about the model here.
Downloads · 30 days
55
0% of all-time downloads
All-time downloads
50.6K
Public
Repo size
692 MB
Likes
16
Public
Click a slice to open those files.
.bin346 MB · 100%
From the Hugging Face model README
A fine-tuned version of ViT-base on a collected set of Pokémon images. You can read more about the model here.
from transformers import ViTForImageClassification, ViTFeatureExtractor
from PIL import Image
import torch
# Loading in Model
device = "cuda" if torch.cuda.is_available() else "cpu"
model = ViTForImageClassification.from_pretrained( "imjeffhi/pokemon_classifier").to(device)
feature_extractor = ViTFeatureExtractor.from_pretrained('imjeffhi/pokemon_classifier')
# Caling the model on a test image
img = Image.open('test.jpg')
extracted = feature_extractor(images=img, return_tensors='pt').to(device)
predicted_id = model(**extracted).logits.argmax(-1).item()
predicted_pokemon = model.config.id2label[predicted_id]