prithivMLmods/Deepfake-vs-Real
Viewer β’ Updated β’ 8k β’ 100 β’ 8
Run prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX")
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("prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX")
model = AutoModelForImageClassification.from_pretrained("prithivMLmods/Deepfake-Detection-Exp-02-22-ONNX", device_map="auto")Deepfake-Detection-Exp-02-22 is a minimalist, high-quality dataset trained on a ViT-based model for image classification, distinguishing between deepfake and real images. The model is based on Google's google/vit-base-patch32-224-in21k.
Mapping of IDs to Labels: {0: 'Deepfake', 1: 'Real'}
Mapping of Labels to IDs: {'Deepfake': 0, 'Real': 1}
Classification report:
precision recall f1-score support
Deepfake 0.9833 0.9187 0.9499 1600
Real 0.9238 0.9844 0.9531 1600
accuracy 0.9516 3200
macro avg 0.9535 0.9516 0.9515 3200
weighted avg 0.9535 0.9516 0.9515 3200
from transformers import pipeline
# Load the model
pipe = pipeline('image-classification', model="prithivMLmods/Deepfake-Detection-Exp-02-22", device=0)
# Predict on an image
result = pipe("path_to_image.jpg")
print(result)
from transformers import ViTForImageClassification, ViTImageProcessor
from PIL import Image
import torch
# Load the model and processor
model = ViTForImageClassification.from_pretrained("prithivMLmods/Deepfake-Detection-Exp-02-22")
processor = ViTImageProcessor.from_pretrained("prithivMLmods/Deepfake-Detection-Exp-02-22")
# Load and preprocess the image
image = Image.open("path_to_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# Perform inference
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=1).item()
# Map class index to label
label = model.config.id2label[predicted_class]
print(f"Predicted Label: {label}")
vit-base-patch32-224-in21k, it is optimized for 224x224 image resolution, which may limit its effectiveness on high-resolution images. Base model
google/vit-base-patch32-224-in21k