TimKond/diffusion-detection

🤗 Hugging Face 来源image-classificationapache-2.086M 参数343 MBsafetensors✓ 6 个校验和今天更新
一条命令提交

在你的模型文件夹旁边运行它。它会制作种子、将文件与 Hugging Face 比对,然后提交。你只需开始做种,并粘贴你账户中的密钥。它只读取你的文件,绝不修改。如果愿意,可以先阅读脚本。

curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo TimKond/diffusion-detection ./model-folder
需要做种者 →

diffusion-detection

This model was trained to distinguish real world images (negative) from machine generated ones (postive).

Model usage

from transformers import BeitImageProcessor, BeitForImageClassification
from PIL import Image

processor = BeitImageProcessor.from_pretrained('TimKond/diffusion-detection')
model = BeitForImageClassification.from_pretrained('TimKond/diffusion-detection')

image = Image.open("2980_saltshaker.jpg")

inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits

predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])

Training and evaluation data

BEiT-base-patch16-224-pt22k was loaded as a base model for further fine tuning:

As negatives a subsample of 10.000 images from imagenet-1k was used. Complementary 10.000 positive images were generated using Realistic_Vision_V1.4.

The labels from imagenet-1k were used as prompts for image generation. GitHub reference

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 0.0002
  • train_batch_size: 32
  • eval_batch_size: 8
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 3
  • mixed_precision_training: Native AMP

Framework versions

  • Transformers 4.29.2
  • Pytorch 1.11.0+cu113
  • Datasets 2.12.0
  • Tokenizers 0.13.3