An end-to-end deep-learning project that classifies gallery images into five categories:
blurred · Notes · Posters · real · Screenshots
This repository focuses only on image-model training: dataset preparation, model training, evaluation, TensorFlow Lite export, and single-image prediction.
Phone galleries contain normal photos, screenshots, notes, posters, and accidental blurry images. This project trains a supervised image classifier that identifies those categories automatically.
The model uses transfer learning with EfficientNetV2B0. It learns from labelled images, is tested on unseen validation images, and exports a .tflite model after training.
Place images in class folders as shown below:
data/
├── blurred/
├── Notes/
├── Posters/
├── real/
└── Screenshots/
| Class | Images | Description |
|---|---|---|
blurred |
700 | Blurry or low-quality photos |
Notes |
960 | Notes, documents, and written reminders |
Posters |
896 | Posters and graphic images |
real |
998 | Normal photographs |
Screenshots |
741 | Screen captures |
Total images: 4,295
Do not upload personal images to a public GitHub repository unless you have permission to share them.
Labelled images
↓
prepare_dataset.py
↓
Clean RGB JPEG images
↓
train.py
↓
EfficientNetV2B0 model
↓
Metrics + Keras model + TFLite model
↓
predict.py
↓
Prediction for a new image
- Supports JPG, JPEG, PNG, WEBP, GIF, and BMP inputs
- Corrects image orientation and converts images to RGB JPEG
- Uses an 80/20 training-validation split
- Uses a fixed seed for reproducible results
- Uses EfficientNetV2B0 transfer learning
- Applies augmentation: flip, rotation, zoom, and contrast changes
- Uses early stopping and saves the best model
- Exports a TensorFlow Lite model
- Includes Google Colab GPU training support
| File | Purpose |
|---|---|
prepare_dataset.py |
Converts source images into consistent RGB JPEG training data. |
train.py |
Trains, validates, and exports the classifier. |
predict.py |
Predicts the class of one image using the trained TFLite model. |
colab_train.ipynb |
Google Colab notebook for GPU training. |
requirements.txt |
Required Python packages. |
git clone <your-repository-url>
cd IMAGE_classifier
python -m venv .venvActivate the environment.
Windows PowerShell
.\.venv\Scripts\Activate.ps1macOS / Linux
source .venv/bin/activateInstall requirements:
pip install -r requirements.txtpython prepare_dataset.py --source data --output processed_dataThis creates a cleaned processed_data/ folder. Your original images in data/ are not changed.
python train.py --data processed_data --output artifacts --epochs 15 --batch-size 32Training uses 80% of images to learn and 20% for validation.
Use Google Colab if your computer cannot handle model training.
- Upload the complete project folder to Google Drive.
- Open
colab_train.ipynbin Google Colab. - Select Runtime → Change runtime type → T4 GPU.
- Run the cells from top to bottom.
- The finished files are saved in
artifacts/.
After training, the artifacts/ folder contains:
artifacts/
├── best.keras
├── model.keras
├── gallery_cleanup_classifier.tflite
├── labels.txt
├── metrics.json
└── training_config.json
| File | Meaning |
|---|---|
model.keras |
Full TensorFlow/Keras model. |
best.keras |
Best model based on validation accuracy. |
gallery_cleanup_classifier.tflite |
Lightweight model for inference. |
labels.txt |
Class names in model-output order. |
metrics.json |
Validation accuracy and training history. |
After training, run:
python predict.py "data/Screenshots/your-image.png"Example output:
Image: data/Screenshots/your-image.png
Screenshots 95.4%
real 2.3%
Notes 1.1%
blurred 0.8%
Posters 0.4%
The class with the highest confidence is the prediction.
Open artifacts/metrics.json after training. The first metric to check is:
validation.accuracy
Also test images that were not part of the original dataset. Accuracy alone is not enough; check whether the model confuses categories such as normal photos and blurry images.
- Python
- TensorFlow / Keras
- EfficientNetV2B0
- TensorFlow Lite
- Pillow
- NumPy
- Google Colab
- Add a confusion matrix and per-class precision/recall.
- Add more images for weaker classes.
- Fine-tune the EfficientNet backbone after initial training.
- Test with images from different phones and lighting conditions.