Views
No views yet

google/vit-base-patch32-224-in21k).1 id2label: {
2 "0": "Issue In Deepfake",
3 "1": "High Quality Deepfake"
4 }1 Classification report:
2
3 precision recall f1-score support
4
5 Issue In Deepfake 0.7851 0.7380 0.7610 2000
6 High Quality Deepfake 0.7765 0.8250 0.8000 2000
7
8 accuracy 0.7815 4000
9 macro avg 0.7808 0.7815 0.7805 4000
10 weighted avg 0.7808 0.7815 0.7805 40001from transformers import pipeline
2
3# Load the model
4pipe = pipeline('image-classification', model="prithivMLmods/Deepfake-QualityAssess2.1-85M", device=0)
5
6# Predict on an image
7result = pipe("path_to_image.jpg")
8print(result)1from transformers import ViTForImageClassification, ViTImageProcessor
2from PIL import Image
3import torch
4
5# Load the model and processor
6model = ViTForImageClassification.from_pretrained("prithivMLmods/Deepfake-QualityAssess2.1-85M")
7processor = ViTImageProcessor.from_pretrained("prithivMLmods/Deepfake-QualityAssess2.1-85M")
8
9# Load and preprocess the image
10image = Image.open("path_to_image.jpg").convert("RGB")
11inputs = processor(images=image, return_tensors="pt")
12
13# Perform inference
14with torch.no_grad():
15 outputs = model(**inputs)
16 logits = outputs.logits
17 predicted_class = torch.argmax(logits, dim=1).item()
18
19# Map class index to label
20label = model.config.id2label[predicted_class]
21print(f"Predicted Label: {label}")