Instructions to use Modotte/AIRealNet-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Modotte/AIRealNet-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Modotte/AIRealNet-2") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("Modotte/AIRealNet-2") model = AutoModelForImageClassification.from_pretrained("Modotte/AIRealNet-2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Model card added
Browse files
README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model:
|
| 4 |
+
- Modotte/AIRealNet
|
| 5 |
+
pipeline_tag: image-classification
|
| 6 |
+
library_name: transformers
|
| 7 |
+
tags:
|
| 8 |
+
- safety
|
| 9 |
+
- Modotte
|
| 10 |
+
- SoTA
|
| 11 |
+
---
|
| 12 |
+
# Modotte
|
| 13 |
+
|
| 14 |
+
<p align="center">
|
| 15 |
+
<img
|
| 16 |
+
src="https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/m7ddTjuxxLUntdXVk0t5N.png"
|
| 17 |
+
alt="AIRealNet Banner"
|
| 18 |
+
width="90%"
|
| 19 |
+
style="border-radius:15px;"
|
| 20 |
+
/>
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
> This is an upgraded version of AIRealNet. We have improved its performance on social media images of different qualities, making it a great upgrade from its previous version.
|
| 26 |
+
|
| 27 |
+
## Overview
|
| 28 |
+
|
| 29 |
+
In an era of rapidly advancing AI-generated imagery, deepfakes, and synthetic media, the need for reliable detection tools has never been higher. **AIRealNet** is a binary image classifier explicitly designed to distinguish **AI-generated images** from **real human photographs**. This model is optimized to detect conventional AI-generated content while adhering to strict privacy standards—avoiding personal or sensitive images.
|
| 30 |
+
|
| 31 |
+
* **Class 0:** AI-generated image
|
| 32 |
+
* **Class 1:** Real human image
|
| 33 |
+
|
| 34 |
+
By leveraging the robust **SwinV2 Tiny** architecture as its backbone, AIRealNet achieves a high degree of accuracy while remaining lightweight enough for practical deployment.
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## Key Features
|
| 39 |
+
|
| 40 |
+
1. **High Accuracy on Public Datasets:**
|
| 41 |
+
Despite using a **14k-image fine-tuning split(Part of main fine tuning split)**, AIRealNet demonstrates exceptional accuracy and robustness in detecting AI-generated images.
|
| 42 |
+
|
| 43 |
+
2. **Balanced Training Split:**
|
| 44 |
+
The dataset contains a balanced number of AI-generated and real images, ensuring unbiased training and minimizing class imbalance issues.
|
| 45 |
+
|
| 46 |
+
* **AI-Generated:** 60%
|
| 47 |
+
* **Human-Images:** 40%
|
| 48 |
+
|
| 49 |
+
4. **Ethical Design:**
|
| 50 |
+
No personal photos were included, even if edited or AI-modified, respecting privacy and ethical AI principles.
|
| 51 |
+
|
| 52 |
+
5. **Fast and Scalable:**
|
| 53 |
+
Based on a transformer vision model, AIRealNet can be deployed efficiently in both research and production environments.
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## Training Data
|
| 58 |
+
|
| 59 |
+
* **Dataset:** `Parveshiiii/AI-vs-Real` (open-sourced subset of main dataset )
|
| 60 |
+
* **Size:** 14k images (balanced between AI and human)
|
| 61 |
+
* **Split:** Used the train split for fine-tuning; validation performed on a separate balanced subset.
|
| 62 |
+
* **Notes:** Images sourced from public datasets and AI generation tools. Edited personal photos were intentionally excluded.
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## Limitations
|
| 67 |
+
|
| 68 |
+
While AIRealNet performs exceptionally well on typical AI-generated images, users should note:
|
| 69 |
+
|
| 70 |
+
1. **Subtle Edits:** The model struggles with nano-scale edits or ultra-precise modifications, like “nano banana” edits.
|
| 71 |
+
2. **Edited Personal Images(over precise):** Images of real people that have been AI-modified are **not detected**, aligning with privacy and ethical guidelines.
|
| 72 |
+
3. **Domain Generalization:** Performance may vary on images from completely unseen AI generators or extremely unconventional content.
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## Performance Metrics
|
| 77 |
+
|
| 78 |
+
> Metrics, chosen to illustrate stable performance after fine-tuning.
|
| 79 |
+
|
| 80 |
+
<p align="center">
|
| 81 |
+
<img
|
| 82 |
+
src="https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/Z7rfOLgZuxDn96ss25bRL.png"
|
| 83 |
+
alt="AIRealNet Banner"
|
| 84 |
+
width="90%"
|
| 85 |
+
style="border-radius:15px;"
|
| 86 |
+
/>
|
| 87 |
+
</p>
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## Demo and Usage
|
| 92 |
+
|
| 93 |
+
1. **Installing dependencies**
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
pip install -U transformers
|
| 97 |
+
```
|
| 98 |
+
2. **Loading and running a demo**
|
| 99 |
+
|
| 100 |
+
```python
|
| 101 |
+
from transformers import pipeline
|
| 102 |
+
|
| 103 |
+
pipe = pipeline("image-classification", model="Modotte/AIRealNet")
|
| 104 |
+
pipe("https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/rYzxmRIFgqg2_EfEFRi89.jpeg")# example image
|
| 105 |
+
```
|
| 106 |
+
# Demo
|
| 107 |
+
|
| 108 |
+
* **Given Image**: This image is actually real, but the older model would classify it as fake because it was not trained on varied social media platform compressions.
|
| 109 |
+
|
| 110 |
+
<p align="center">
|
| 111 |
+
<img
|
| 112 |
+
src="https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/rYzxmRIFgqg2_EfEFRi89.jpeg"
|
| 113 |
+
alt="AIRealNet Banner"
|
| 114 |
+
width="90%"
|
| 115 |
+
style="border-radius:15px;"
|
| 116 |
+
/>
|
| 117 |
+
</p>
|
| 118 |
+
|
| 119 |
+
* **New Model Output**
|
| 120 |
+
|
| 121 |
+
```bash
|
| 122 |
+
[{'label': 'real', 'score': 0.9999173879623413},
|
| 123 |
+
{'label': 'artificial', 'score': 8.256531145889312e-05}]
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
---
|
| 128 |
+
|
| 129 |
+
## Intended Use
|
| 130 |
+
|
| 131 |
+
* Detect AI-generated imagery on social media, research publications, and digital media platforms.
|
| 132 |
+
* Assist content moderators, researchers, and fact-checkers in identifying synthetic media.
|
| 133 |
+
* **Not intended** for legal verification without human corroboration.
|
| 134 |
+
|
| 135 |
+
---
|
| 136 |
+
|
| 137 |
+
## Ethical Considerations
|
| 138 |
+
|
| 139 |
+
* **Privacy-first Approach:** Personal photos, even if AI-edited, were excluded.
|
| 140 |
+
* **Responsible Deployment:** Users should combine model predictions with human review to avoid false positives or negatives.
|
| 141 |
+
* **Transparency:** The model card openly communicates its limitations and dataset design to prevent misuse.
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
## How It Works
|
| 146 |
+
|
| 147 |
+
1. Images are preprocessed and resized to `256x256`.
|
| 148 |
+
2. Features are extracted using the **SwinV2 Tiny** vision transformer backbone.
|
| 149 |
+
3. A binary classification head outputs probabilities for AI-generated vs real human images.
|
| 150 |
+
4. Predictions are interpreted as class 0 (AI) or class 1 (Human).
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## Future Work
|
| 155 |
+
|
| 156 |
+
Future iterations aim to:
|
| 157 |
+
|
| 158 |
+
* Improve detection of subtle AI-generated edits and “nano banana” modifications.
|
| 159 |
+
* Expand training data with diverse AI generators to enhance generalization.
|
| 160 |
+
* Explore multi-modal detection capabilities (e.g., video, metadata, and image combined).
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
### Citation
|
| 165 |
+
```bibtex
|
| 166 |
+
@misc{Modotte_AIRealNet_2025,
|
| 167 |
+
title={AIRealNet: A Fine-Tuned Vision Transformer for Detecting AI-Generated vs Real Human Images},
|
| 168 |
+
author={Parvesh Rawal},
|
| 169 |
+
publisher={Hugging Face},
|
| 170 |
+
year={2025},
|
| 171 |
+
url={https://huggingface.co/Modotte/AIRealNet}
|
| 172 |
+
}
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
## References
|
| 176 |
+
|
| 177 |
+
* Microsoft SwinV2 Tiny: [https://github.com/microsoft/Swin-Transformer](https://github.com/microsoft/Swin-Transformer)
|
| 178 |
+
* Parveshiiii/AI-vs-Real dataset (subset): Open-sourced by our team member
|
| 179 |
+
|
| 180 |
+
---
|