aevalone/fd_dataset
Viewer โข Updated โข 85.2k โข 38
How to use aevalone/vit-base-patch16-224-finetuned-forgery with Transformers:
# 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")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:
More information needed
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
The following hyperparameters were used during training:
| 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 |
Base model
google/vit-base-patch16-224