Downloads · 30 days
70
2% of all-time downloads
cvetanovskaa/vit-base-patch16-224-in21k-gtsrb-tuned
vit-base-patch16-224-in21k-gtsrb-tuned is a image classification model from cvetanovskaa. Use it when you need a label for an image. It is set up for transformers. The card lists the license as apache-2.0.
Vision Transformer (ViT) model pre-trained on ImageNet-21k (14 million images, 21,843 classes) at resolution 224x224. It was introduced in the paper An Image is Worth 16x16 Words: Transformers for Image Recognition at…
Downloads · 30 days
70
2% of all-time downloads
All-time downloads
2.8K
Public
Parameters
85.8M
343 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors343 MB · 100%
From the Hugging Face model README
Vision Transformer (ViT) model pre-trained on ImageNet-21k (14 million images, 21,843 classes) at resolution 224x224. It was introduced in the paper An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale by Dosovitskiy et al. and first released in this repository. Fine-tuned on the German Traffic Sign Recognition Benchmark Dataset.
from transformers import ViTForImageClassification, ViTImageProcessor
from torch.utils.data import DataLoader
import torch
url = 'https://images.unsplash.com/photo-1572670014853-1d3a3f22b40f?q=80&w=2942&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'
image = Image.open(requests.get(url, stream=True).raw)
model_name = "cvetanovskaa/vit-base-patch16-224-in21k-gtsrb-tuned"
model = ViTForImageClassification.from_pretrained(model_name)
processor = ViTImageProcessor.from_pretrained(model_name)
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state
You can use the fine-tuned model for image classification.