đ AI Image Classification - Midjourney V6 & SDXL
A Swin Transformer-based classifier for distinguishing AI-generated and human-created images from Midjourney V6 and Stable Diffusion XL.
đ Quick Start
You can use this model with the đ¤ Transformers library:
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
from PIL import Image
import torch
model_name = "ideepankarsharma2003/AI_ImageClassification_MidjourneyV6_SDXL"
model = AutoModelForImageClassification.from_pretrained(model_name)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
image = Image.open("path_to_image.jpg")
inputs = feature_extractor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_label = logits.argmax(-1).item()
id2label = {0: "ai_gen", 1: "human"}
print("Predicted label:", id2label[predicted_label])
⨠Features
- AI Image Detection: Designed to distinguish between AI-generated and human-created images from Midjourney V6 and Stable Diffusion XL.
- Content Moderation: Useful for content moderation, fact-checking, and detecting synthetic media.
đĻ Installation
This section is skipped as there are no specific installation steps provided in the original document.
đģ Usage Examples
Basic Usage
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
from PIL import Image
import torch
model_name = "ideepankarsharma2003/AI_ImageClassification_MidjourneyV6_SDXL"
model = AutoModelForImageClassification.from_pretrained(model_name)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
image = Image.open("path_to_image.jpg")
inputs = feature_extractor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_label = logits.argmax(-1).item()
id2label = {0: "ai_gen", 1: "human"}
print("Predicted label:", id2label[predicted_label])
đ Documentation
Model Details
Model Description
This model is a Swin Transformer-based classifier designed to distinguish between AI-generated and human-created images, specifically focusing on outputs from Midjourney V6 and Stable Diffusion XL (SDXL). It has been trained on a curated dataset of AI-generated images.
Property |
Details |
Developed by |
Deepankar Sharma |
Model Type |
Image Classification (Swin Transformer) |
Finetuned from model |
SwinForImageClassification |
Model Sources
Uses
Direct Use
This model can be used for detecting AI-generated images from Midjourney V6 and SDXL. It is useful for content moderation, fact-checking, and detecting synthetic media.
Out-of-Scope Use
- The model is not designed for detecting AI-generated images from all generative models.
- It may not perform well on heavily edited AI-generated images or images mixed with human elements.
- It is not intended for forensic-level deepfake detection.
Bias, Risks, and Limitations
This model is trained specifically on Midjourney V6 and Stable Diffusion XL datasets. It may not generalize well to images generated by other AI models. Additionally, biases in the dataset could lead to false positives (flagging real images as AI-generated) or false negatives (failing to detect AI-generated content).
â ī¸ Important Note
Users should verify results with additional tools and not solely rely on this model for high-stakes decisions. Model performance should be tested on domain-specific datasets before deployment.
Training Details
Training Data
The model was trained on the following datasets:
Training Procedure
- Image Size: 224x224
- Patch Size: 4
- Embedding Dimension: 128
- Layers: 4
- Attention Heads per Stage: [4, 8, 16, 32]
- Dropout Rates:
- Attention: 0.0
- Hidden: 0.0
- Drop Path: 0.1
- Activation Function: GeLU
- Optimizer: AdamW
- Learning Rate Scheduler: Cosine Annealing
- Precision: float32
- Training Steps: 3414
Evaluation
Testing Data, Factors & Metrics
- Testing Data: The model was evaluated on a separate validation split from the training datasets.
- Metrics:
- Accuracy
- Precision & Recall
- F1 Score
Summary
The model effectively distinguishes between AI-generated and human-created images, but its performance may be affected by dataset biases and out-of-distribution examples.
đ§ Technical Details
This section is skipped as there are no specific technical details provided in the original document.
đ License
This section is skipped as there is no license information provided in the original document.
đ Citation
If you use this model, please cite:
@misc{ai_image_classification,
author = {Deepankar Sharma},
title = {AI Image Classification - Midjourney V6 & SDXL},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/ideepankarsharma2003/AI_ImageClassification_MidjourneyV6_SDXL}}
}
Model Card Authors