🚀 開源深度偽造檢測模型
開源深度偽造檢測模型是一個基於視覺 - 語言編碼器的模型,它在 siglip2-base-patch16-512
基礎上進行微調,用於二分類圖像分類任務。該模型使用 OpenDeepfake-Preview 數據集進行訓練,能夠檢測圖像是偽造的還是真實的。模型採用 SiglipForImageClassification
架構。

🚀 快速開始
安裝依賴
pip install -q transformers torch pillow gradio hf_xet
推理代碼
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch
model_name = "prithivMLmods/open-deepfake-detection"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)
id2label = {
"0": "Fake",
"1": "Real"
}
def classify_image(image):
image = Image.fromarray(image).convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
prediction = {
id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
}
return prediction
iface = gr.Interface(
fn=classify_image,
inputs=gr.Image(type="numpy"),
outputs=gr.Label(num_top_classes=2, label="Deepfake Detection"),
title="open-deepfake-detection",
description="Upload an image to detect whether it is AI-generated (Fake) or a real photograph (Real), using the OpenDeepfake-Preview dataset."
)
if __name__ == "__main__":
iface.launch()
演示推理
⚠️ 重要提示
以下是真實圖片示例:

⚠️ 重要提示
以下是偽造圖片示例:

✨ 主要特性
分類報告
Classification Report:
precision recall f1-score support
Fake 0.9718 0.9155 0.9428 10000
Real 0.9201 0.9734 0.9460 9999
accuracy 0.9444 19999
macro avg 0.9459 0.9444 0.9444 19999
weighted avg 0.9459 0.9444 0.9444 19999
標籤空間
模型將圖像分為以下兩類:
Class 0: 偽造
Class 1: 真實
預期用途
open-deepfake-detection
模型旨在用於以下場景:
- 深度偽造檢測:識別由人工智能生成或經過篡改的圖像。
- 內容審核:標記合成或偽造的視覺內容。
- 數據集整理:從混合數據集中移除合成樣本。
- 視覺真實性驗證:檢查視覺媒體的完整性。
- 數字取證:支持圖像來源驗證和可追溯性。
相關論文
SigLIP 2: Multilingual Vision-Language Encoders with Improved Semantic Understanding, Localization, and Dense Features
https://arxiv.org/pdf/2502.14786
注意事項
⚠️ 重要提示
此為實驗性模型。
📄 許可證
本項目採用 Apache-2.0 許可證。
📦 模型信息
屬性 |
詳情 |
模型類型 |
基於視覺 - 語言編碼器的圖像分類模型 |
訓練數據 |
prithivMLmods/OpenDeepfake-Preview |
基礎模型 |
google/siglip2-base-patch16-512 |
庫名稱 |
transformers |
標籤 |
深度偽造、檢測、SigLIP2、藝術、合成 |
任務類型 |
圖像分類 |
