AI Detection CNN Model
This model detects AI-generated images using spatial features extracted from Qwen2.5-VL.
Model Description
- Architecture: 1D CNN with 3 convolutional layers
- Task: Binary classification (AI-generated vs Real images)
- Feature Extractor: Qwen2.5-VL-3B-Instruct
- Framework: PyTorch
Usage
from inference import test_image
# Test an image
result = test_image(
"path/to/image.jpg",
hf_repo_id="nahid112376/ai-detection-cnn",
threshold=0.5
)
print(f"Label: {result['label']}")
print(f"Confidence: {result['confidence']*100:.2f}%")
Model Details
- Input: Spatial features from Qwen2.5-VL (shape: [num_patches, hidden_dim])
- Output: Single regression score (0-1, threshold at 0.5)
- Training: Trained on demectai dataset
Installation
pip install torch transformers huggingface_hub pillow numpy
pip install qwen-vl-utils
Files
cnn_regression_model.pth: Trained model weightsinference.py: Inference scriptextract_features.py: Feature extraction script
Citation
If you use this model, please cite:
@misc{ai-detection-cnn,
author = {bartazable},
title = {AI Detection CNN Model},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/nahid112376/ai-detection-cnn}}
}