返回模型
说明文档
VeriChain 深度伪造检测模型 - ViT
本仓库包含用于深度伪造(Deepfake)检测任务的 Vision Transformer (ViT) 微调模型工件,作为 VeriChain 项目的一部分开发。
该模型用于将图像分类为以下三个类别之一:真实、AI生成 或 深度伪造。
仓库结构
本仓库中的模型工件组织如下:
- /models/vit-deepfake-model/:包含最终的微调 PyTorch 模型文件,可直接使用
transformers库加载。 - /models/onnx/:包含转换为 ONNX 格式的模型,针对生产部署和推理进行了优化。
- /assets/:包含文档视觉素材,如混淆矩阵。
如何使用(PyTorch 模型)
您可以使用 transformers 库中的 pipeline 函数直接使用微调后的 PyTorch 模型。请确保指定正确的 subfolder。
from transformers import pipeline
from PIL import Image
# 使用您的模型加载图像分类管道
# 'subfolder' 参数指向包含模型文件的目录
classifier = pipeline(
\"image-classification\",
model=\"einrafh/verichain-deepfake-models\",
subfolder=\"models/vit-deepfake-model\"
)
# 加载您想要分类的图像
# 请确保将 'path/to/your/image.jpg' 替换为实际的图像文件
try:
image = Image.open('path/to/your/image.jpg')
results = classifier(image)
print(results)
except FileNotFoundError:
print(\"Please provide a valid path to an image file.\")
# 示例输出:
# [{'label': 'Deepfake', 'score': 0.9985}, {'label': 'AI Generated', 'score': 0.0010}, {'label': 'Real', 'score': 0.0005}]
评估结果
该模型在 2,000 张图像的留出测试集上进行了评估,取得了近乎完美的性能。
| 指标 | 分数 |
|---|---|
| 测试准确率 | 0.9990 |
| F1分数 (宏平均) | 0.9990 |
| 测试损失 | 0.0202 |
分类报告
| 类别 | 精确率 | 召回率 | F1分数 |
|---|---|---|---|
| AI生成 | 1.0000 | 0.9970 | 0.9985 |
| 深度伪造 | 0.9970 | 1.0000 | 0.9985 |
| 真实 | 1.0000 | 1.0000 | 1.0000 |
混淆矩阵
下面的混淆矩阵展示了该模型在所有类别上的高精确率和高召回率,误分类极少。

引用
如果您在研究中使用了此模型,请考虑引用本仓库。
@misc{verichain_model_2025,
author = {Muhammad Rafly Ash Shiddiqi},
title = {VeriChain Deepfake Detection Model - ViT},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\url{[https://huggingface.co/einrafh/verichain-deepfake-models](https://huggingface.co/einrafh/verichain-deepfake-models)}},
}
许可证
版权所有 (c) 2025 Muhammad Rafly Ash Shiddiqi.
einrafh/verichain-deepfake-models
作者 einrafh
image-classification
transformers
↓ 0
♥ 0
创建时间: 2025-07-08 15:41:11+00:00
更新时间: 2025-07-09 14:32:52+00:00
在 Hugging Face 上查看文件 (8)
.gitattributes
README.md
assets/confusion_matrix.png
models/onnx/verichain-model.onnx
ONNX
models/vit-deepfake-model/config.json
models/vit-deepfake-model/model.safetensors
models/vit-deepfake-model/preprocessor_config.json
models/vit-deepfake-model/training_args.bin