Downloads · 30 days
1
100% of all-time downloads
YiMeng-SYSU/vit-base-patch16-224-in21k-finetuned-cifar100
vit-base-patch16-224-in21k-finetuned-cifar100 is a image classification model from YiMeng-SYSU. Use it when you need a label for an image. It is set up for timm. The card lists the license as apache-2.0.
This model is a fine-tuned version of vitbasepatch16224 on the CIFAR-100 dataset. It achieves an accuracy of 83.58% on the validation set.
Downloads · 30 days
1
100% of all-time downloads
All-time downloads
1
Public
Repo size
344 MB
Likes
0
Public
Click a slice to open those files.
.pth344 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of vit_base_patch16_224 on the CIFAR-100 dataset.
It achieves an accuracy of 83.58% on the validation set.
| Metric | Value |
|---|---|
| Accuracy | 0.8358 |
| Epochs | 20 |
| Batch Size | 128 |
Here is how to use this model to classify an image:
import timm
import torch
from PIL import Image
from urllib.request import urlopen
# 1. Load Model
model = timm.create_model("hf_hub:YiMeng-SYSU/vit-base-patch16-224-in21k-finetuned-cifar100", pretrained=True)
model.eval()
# 2. Prepare Image
url = 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cifar100-test.jpg'
img = Image.open(urlopen(url))
# 3. Predict
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0))
print(f"Predicted Class ID: {output.argmax().item()}")