NanoMango is a Deep Learning project designed to distinguish between Real photographs and Fake (AI-generated) images specifically from Google Gemini 2.5 Flash Image Preview. It utilizes Transfer Learning with a MobileNetV3 Large architecture to achieve high accuracy with a lightweight footprint.
The project includes a training engine and a user-friendly web interface (Streamlit) for live testing but you have to run it locally.
⚠️ Note: This detector is trained specifically on images generated by NanoBanana (Google Gemini 2.5 Flash Image Preview). Performance on other AI-generated images or models may vary.
NanoMango/
├── data/ # Dataset folder (not included in repo)
│ ├── real/ # Real images from Open Images V7 dataset
│ └── fake/ # AI-generated images(not the pro for now)
├── app.py # Streamlit Web Interface for testing
├── train.py # Main training script
├── environment.yml # Conda environment dependencies
├── nanomango_best.pth # Saved model weights (generated after training)
└── README.md # Project documentation
This project uses a generic Conda environment to manage dependencies (PyTorch, Streamlit, Torchvision, etc.).
- Clone the repository:
git clone <your-repo-url>
cd NanoMango
- Create the Environment: Ensure you have Conda installed, then run:
conda env create -f environment.yml
- Activate the Environment:
conda activate nanomango
To train the model from scratch, ensure your data is organized in the data/ folder with two subdirectories: real and fake.
- Run the training script:
python train.py
- Process:
- The script automatically detects your hardware (CUDA, Apple Silicon MPS, or CPU).
- It fine-tunes a pre-trained MobileNetV3 Large model.
- The best weights are saved automatically as
nanomango_best.pth.
Model Configuration:
- Base: MobileNetV3 Large (Pre-trained on ImageNet)
- Input Size: 224x224 (Resized)
- Classes: * 0: Fake
- 1: Real (Note: PyTorch assigns these alphabetically: F comes before R)
You can test the trained model using the built-in web interface.
- Start the App:
streamlit run app.py
- Use the Interface:
- A browser tab will open at
http://localhost:8501. - Step 1: Upload your
nanomango_best.pthfile. - Step 2: Upload any image (JPEG/PNG) to test.
- The app will display the prediction and confidence score in real-time.
- Core Framework: PyTorch
- Architecture: MobileNetV3 Large
- Interface: Streamlit
- Image Processing: Torchvision & Pillow
This project uses datasets from the following sources:
- Real Images: Open Images V7 - A large-scale dataset of real photographs curated by Bitmind
- Fake Images: NanoBanana - AI-generated images from the NanoBanana model, provided by Bitmind
Thank you to the open-source community and Bitmind for making these datasets publicly available on Hugging Face.

