Downloads · 30 days
5
8% of all-time downloads
SasikaA073/vit_base_patch14_reg4_dinov2.lvd142m_sp_ft_in1k
vit_base_patch14_reg4_dinov2.lvd142m_sp_ft_in1k is a image classification model from SasikaA073. Use it when you need a label for an image. The card lists the license as apache-2.0.
This model is a fine-tuned version of facebook/dinov2-base on ImageNet-1k dataset.
Downloads · 30 days
5
8% of all-time downloads
All-time downloads
60
Public
Repo size
349 MB
Likes
0
Public
Click a slice to open those files.
.bin349 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of facebook/dinov2-base on ImageNet-1k dataset.
import torch
import timm
from PIL import Image
# Load model
model_id = "vit_base_patch14_reg4_dinov2.lvd142m"
model = timm.create_model(model_id, pretrained=False)
model.head = torch.nn.Linear(768, 1000, bias=True)
# Load weights
checkpoint = torch.load("pytorch_model.bin")
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
# Inference
data_config = timm.data.resolve_data_config(model.pretrained_cfg)
transforms = timm.data.create_transform(**data_config)
image = Image.open("your_image.jpg")
input_tensor = transforms(image).unsqueeze(0)
with torch.no_grad():
output = model(input_tensor)
probabilities = torch.nn.functional.softmax(output[0], dim=0)
@article{oquab2023dinov2,
title={DINOv2: Learning Robust Visual Features without Supervision},
author={Oquab, Maxime and Darcet, Timothée and Moutakanni, Theo and Vo, Huy V. and Szafraniec, Marc and Khalidov, Vasil and Fernandez, Pierre and Haziza, Daniel and Massa, Francisco and El-Nouby, Alaaeldin and Howes, Russell and Huang, Po-Yao and Xu, Hu and Sharma, Vasu and Li, Shang-Wen and Galuba, Wojciech and Rabbat, Mike and Assran, Mido and Ballas, Nicolas and Synnaeve, Gabriel and Misra, Ishan and Jegou, Herve and Mairal, Julien and Labatut, Patrick and Joulin, Armand and Bojanowski, Piotr},
journal={arXiv:2304.07193},
year={2023}
}