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
|
Download README.md from Modotte/AIRealNet-2: direct link, hf CLI and curl.
- Browser
- Download file 5.86 kB
-
https://huggingface.co/Modotte/AIRealNet-2/resolve/main/README.md
- Command line
-
hf download hf://Modotte/AIRealNet-2/README.md
-
curl -L -o README.md https://huggingface.co/Modotte/AIRealNet-2/resolve/main/README.md
5.86 kB
| license: mit | |
| base_model: | |
| - Modotte/AIRealNet | |
| pipeline_tag: image-classification | |
| library_name: transformers | |
| tags: | |
| - safety | |
| - Modotte | |
| - AIRealNet | |
| - SoTA | |
| # Modotte | |
| <p align="center"> | |
| <img | |
| src="https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/T-Twoka4G5_Qfcqlka4l8.png" | |
| alt="AIRealNet Banner" | |
| width="90%" | |
| style="border-radius:15px;" | |
| /> | |
| </p> | |
| --- | |
| > 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. | |
| ## Overview | |
| In an era of rapidly advancing AI-generated imagery, deepfakes, and synthetic media, the need for reliable detection tools has never been higher. **AIRealNet-2** 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. | |
| * **Class 0:** AI-generated image | |
| * **Class 1:** Real human image | |
| By leveraging the robust **SwinV2 Tiny** architecture as its backbone, AIRealNet achieves a high degree of accuracy while remaining lightweight enough for practical deployment. | |
| --- | |
| ## Key Features | |
| 1. **High Accuracy on Public Datasets:** Model is trained on data from social media | |
| 2. **Balanced Training Split:** | |
| The dataset contains a balanced number of AI-generated and real images, ensuring unbiased training and minimizing class imbalance issues. | |
| * **AI-Generated:** 50% | |
| * **Human-Images:** 50% | |
| 4. **Ethical Design:** | |
| No personal photos were included, even if edited or AI-modified, respecting privacy and ethical AI principles. | |
| 5. **Fast and Scalable:** | |
| Based on a transformer vision model, AIRealNet can be deployed efficiently in both research and production environments. | |
| --- | |
| ## Training Data | |
| * **Dataset:** Collection of images from differnt plaforms like instagram, x. | |
| * **Size:** 98k images (balanced between AI and human) | |
| * **Split:** Used the train split for fine-tuning; validation performed on a separate balanced subset. | |
| * **Notes:** Images sourced from public datasets and AI generation tools. Edited personal photos were intentionally excluded. | |
| --- | |
| ## Limitations | |
| While AIRealNet performs exceptionally well on typical AI-generated images, users should note: | |
| 1. **Subtle Edits:** The model struggles with nano-scale edits or ultra-precise modifications, like “nano banana” edits. | |
| 2. **Edited Personal Images(over precise):** Images of real people that have been AI-modified are **not detected**, aligning with privacy and ethical guidelines. | |
| 3. **Domain Generalization:** Performance may vary on images from completely unseen AI generators or extremely unconventional content. | |
| --- | |
| ## Performance Metrics | |
| > Metrics, chosen to illustrate stable performance after fine-tuning. | |
| <p align="center"> | |
| <img | |
| src="https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/Z7rfOLgZuxDn96ss25bRL.png" | |
| alt="AIRealNet Banner" | |
| width="90%" | |
| style="border-radius:15px;" | |
| /> | |
| </p> | |
| --- | |
| ## Demo and Usage | |
| 1. **Installing dependencies** | |
| ```python | |
| pip install -U transformers | |
| ``` | |
| 2. **Loading and running a demo** | |
| ```python | |
| from transformers import pipeline | |
| pipe = pipeline("image-classification", model="Modotte/AIRealNet-2") | |
| pipe("https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/rYzxmRIFgqg2_EfEFRi89.jpeg")# example image | |
| ``` | |
| # Demo | |
| * **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. | |
| <p align="center"> | |
| <img | |
| src="https://cdn-uploads.huggingface.co/production/uploads/677fcdf29b9a9863eba3f29f/rYzxmRIFgqg2_EfEFRi89.jpeg" | |
| alt="AIRealNet Banner" | |
| width="90%" | |
| style="border-radius:15px;" | |
| /> | |
| </p> | |
| * **New Model Output** | |
| ```bash | |
| [{'label': 'real', 'score': 0.9999173879623413}, | |
| {'label': 'artificial', 'score': 8.256531145889312e-05}] | |
| ``` | |
| --- | |
| ## Intended Use | |
| * Detect AI-generated imagery on social media, research publications, and digital media platforms. | |
| * Assist content moderators, researchers, and fact-checkers in identifying synthetic media. | |
| * **Not intended** for legal verification without human corroboration. | |
| --- | |
| ## Ethical Considerations | |
| * **Privacy-first Approach:** Personal photos, even if AI-edited, were excluded. | |
| * **Responsible Deployment:** Users should combine model predictions with human review to avoid false positives or negatives. | |
| * **Transparency:** The model card openly communicates its limitations and dataset design to prevent misuse. | |
| --- | |
| ## How It Works | |
| 1. Images are preprocessed and resized to `256x256`. | |
| 2. Features are extracted using the **SwinV2 Tiny** vision transformer backbone. | |
| 3. A binary classification head outputs probabilities for AI-generated vs real human images. | |
| 4. Predictions are interpreted as class 0 (AI) or class 1 (Human). | |
| --- | |
| ## Future Work | |
| Future iterations aim to: | |
| * Improve detection of subtle AI-generated edits and “nano banana” modifications. | |
| * Expand training data with diverse AI generators to enhance generalization. | |
| * Explore multi-modal detection capabilities (e.g., video, metadata, and image combined). | |
| --- | |
| ### Citation | |
| ```bibtex | |
| @misc{Modotte_AIRealNet_2025, | |
| title={AIRealNet-2: A Fine-Tuned Vision Transformer for Detecting AI-Generated vs Real Human Images}, | |
| author={Parvesh Rawal}, | |
| publisher={Hugging Face}, | |
| year={2025}, | |
| url={https://huggingface.co/Modotte/AIRealNet} | |
| } | |
| ``` | |
| ## References | |
| * Microsoft SwinV2 Tiny: [https://github.com/microsoft/Swin-Transformer](https://github.com/microsoft/Swin-Transformer) | |
| * Parveshiiii/AI-vs-Real dataset (subset): Open-sourced by our team member | |
| --- |