How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-classification", model="aevalone/vit-base-patch16-224-finetuned-forgery")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification

processor = AutoImageProcessor.from_pretrained("aevalone/vit-base-patch16-224-finetuned-forgery")
model = AutoModelForImageClassification.from_pretrained("aevalone/vit-base-patch16-224-finetuned-forgery", device_map="auto")
Quick Links

vit-base-patch16-224-finetuned-forgery

This model is a fine-tuned version of google/vit-base-patch16-224 on the imagefolder dataset. It achieves the following results on the evaluation set:

  • Loss: 0.0659
  • Accuracy: 0.9762

Model description

More information needed

Intended uses & limitations

To use, combine known genuine signature with questioned signature into a single image, then run inference.

from PIL import Image

def create_comparison_image(img1_path, img2_path):
    # Open images
    img1 = Image.open(img1_path).convert("RGB")
    img2 = Image.open(img2_path).convert("RGB")
    
    # Resize to same height
    height = max(img1.height, img2.height)
    width1 = int(img1.width * (height / img1.height))
    width2 = int(img2.width * (height / img2.height))
    
    img1 = img1.resize((width1, height), Image.LANCZOS)
    img2 = img2.resize((width2, height), Image.LANCZOS)
    
    # Create new image with space for both images
    total_width = width1 + width2
    comparison = Image.new('RGB', (total_width, height))
    
    # Paste images side by side
    comparison.paste(img1, (0, 0))
    comparison.paste(img2, (width1, 0))
    
    return comparison

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2.1687073595562957e-05
  • train_batch_size: 29
  • eval_batch_size: 8
  • seed: 42
  • gradient_accumulation_steps: 5
  • total_train_batch_size: 145
  • optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_steps: 1
  • num_epochs: 5

Training results

Training Loss Epoch Step Validation Loss Accuracy
0.3114 0.9991 470 0.1464 0.9477
0.2831 1.9991 940 0.0803 0.9697
0.2806 2.9991 1410 0.0727 0.9756
0.2779 3.9991 1880 0.0744 0.9758
0.2588 4.9991 2350 0.0659 0.9762

Framework versions

  • Transformers 4.51.3
  • Pytorch 2.7.0+cu126
  • Datasets 3.6.0
  • Tokenizers 0.21.1
Downloads last month
31
Safetensors
Model size
85.8M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for aevalone/vit-base-patch16-224-finetuned-forgery

Finetuned
(2,112)
this model

Dataset used to train aevalone/vit-base-patch16-224-finetuned-forgery

Evaluation results