Downloads · 30 days
0
cftcimert/cifake-efficientnet-b0
cifake-efficientnet-b0 is a image classification model from cftcimert. Use it when you need a label for an image. It is set up for onnx. The card lists the license as mit.
A binary image classifier that distinguishes real photographs from AI-generated (synthetic) images, built with EfficientNet-B0 and transfer learning.
Downloads · 30 days
0
Access
Public
Updated Sep 22, 2026
Repo size
16.7 MB
Likes
1
Trending 1
Click a slice to open those files.
.data16 MB · 96%
From the Hugging Face model README
A binary image classifier that distinguishes real photographs from AI-generated (synthetic) images, built with EfficientNet-B0 and transfer learning.
This model was trained to detect AI-generated images using the CIFAKE dataset, which contains 120,000 images (60K real from CIFAR-10 + 60K synthetic from Stable Diffusion v1.4).
[batch, 3, 224, 224], normalized with ImageNet statistics| Phase | Epochs | Strategy | Learning Rate | Scheduler |
|---|---|---|---|---|
| 1 | 10 | Feature extraction (backbone frozen) | 3e-4 | — |
| 2 | 5 | Full fine-tuning (all layers) | 3e-5 | CosineAnnealingLR |
torch.autocasttransforms.Resize((224, 224), interpolation=InterpolationMode.BICUBIC, antialias=True)
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
| Metric | Value |
|---|---|
| Test Accuracy | 97.85% |
Evaluated on 20,000 test images (10K real + 10K AI-generated).
import numpy as np
import onnxruntime as ort
from PIL import Image
from torchvision import transforms
from torchvision.transforms import InterpolationMode
# Load model
session = ort.InferenceSession("model.onnx")
# Preprocess image
transform = transforms.Compose([
transforms.Resize((224, 224), interpolation=InterpolationMode.BICUBIC, antialias=True),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
image = Image.open("your_image.jpg").convert("RGB")
input_tensor = transform(image).unsqueeze(0).numpy()
# Run inference
logit = session.run(None, {"input": input_tensor})[0]
probability = 1 / (1 + np.exp(-logit)) # sigmoid
label = "REAL" if probability >= 0.5 else "FAKE"
confidence = float(probability) if label == "REAL" else float(1 - probability)
print(f"{label} ({confidence * 100:.2f}% confidence)")
| Index | Class | Description |
|---|---|---|
| 0 | FAKE | AI-generated synthetic image |
| 1 | REAL | Real photograph (from CIFAR-10) |
The model outputs a single logit. After applying sigmoid:
sigmoid(logit) >= 0.5 → REALsigmoid(logit) < 0.5 → FAKEThe CIFAKE dataset consists of:
| Split | Real | Fake | Total |
|---|---|---|---|
| Train | 50,000 | 50,000 | 100,000 |
| Test | 10,000 | 10,000 | 20,000 |
@article{bird2024cifake,
title={CIFAKE: Image Classification and Explainable Identification of AI-Generated Synthetic Images},
author={Bird, Jordan J and Lotfi, Ahmad},
journal={IEEE Access},
year={2024},
doi={10.1109/ACCESS.2024.3356122}
}
This model is released under the MIT License.