Downloads · 30 days
41
0% of all-time downloads
nobodyPerfecZ/vit-finetuned-patch16-224-recaptchav2-v1
vit-finetuned-patch16-224-recaptchav2-v1 is a machine learning model from nobodyPerfecZ. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains a Vision Transformer (ViT) model fine-tuned on the ReCAPTCHAv2-29k dataset. The dataset comprises 29,568 labeled images spanning 5 classes, each resized to a resolution of 224×224 pixels.
Downloads · 30 days
41
0% of all-time downloads
All-time downloads
13K
Public
Parameters
85.8M
1.4 GB on disk
Likes
2
Public
Click a slice to open those files.
.h5343 MB · 25%
From the Hugging Face model README
This repository contains a Vision Transformer (ViT) model fine-tuned on the ReCAPTCHAv2-29k dataset. The dataset comprises 29,568 labeled images spanning 5 classes, each resized to a resolution of 224×224 pixels.
This model builds on a pre-trained ViT backbone and is fine-tuned on the ReCAPTCHAv2-29k dataset. It leverages the transformer-based architecture to capture global contextual information effectively, making it well-suited for tasks with diverse visual patterns like ReCAPTCHA classification.
This fine-tuned ViT model is designed for multi-label-classification tasks involving ReCAPTCHA-like visual patterns. Potential applications include:
The model is particularly useful in academic and experimental contexts where understanding transformer-based classification on noisy or distorted visual data is a priority.
Here is how to use this model to classify an image of the ReCAPTCHAv2-29k dataset into one of the 5 classes:
import requests
import torch
from PIL import Image
from transformers import ViTForImageClassification, ViTImageProcessor
url = "https://raw.githubusercontent.com/nobodyPerfecZ/recaptchav2-29k/refs/heads/master/data/bicycle/bicycle_0.png"
image = Image.open(requests.get(url, stream=True).raw)
processor = ViTImageProcessor.from_pretrained(
"nobodyPerfecZ/vit-finetuned-patch16-224-recaptchav2-v1"
)
model = ViTForImageClassification.from_pretrained(
"nobodyPerfecZ/vit-finetuned-patch16-224-recaptchav2-v1"
)
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the 5 classes
predictions = (outputs.logits >= 0.5).to(int)
predicted_class_indicies = torch.where(predictions == 1)[1]
labels = [model.config.id2label[idx.item()] for idx in predicted_class_indicies]
print(f"Predicted labels: {labels}")
The ViT model was fine-tuned on ReCAPTCHAv2-29k dataset, a dataset consisting of 29.568 images and 5 classes.
The exact details of preprocessing of images during training/validation can be found here.
Images are resized/rescaled to the same resolution (224x224) and normalized across the RGB channels with mean (0.5, 0.5, 0.5) and standard deviation (0.5, 0.5, 0.5).
The ViT model was evaluated on a held-out test set from the ReCAPTCHAv2-29k dataset. Two key metrics were used to assess performance:
| Metric | Score |
|---|---|
| Top-1 Accuracy | 0.93 |
| Hamming Accuracy | 0.97 |
These results indicate strong classification performance, especially given the visual complexity and distortion typical in ReCAPTCHA images.