An end-to-end Image Tagging (Image Classification) system built using TensorFlow (CNN + Transfer Learning) and deployed with a Streamlit frontend.
The application allows users to upload an image and receive a predicted label along with a confidence score.
This project implements an image tagging system that classifies uploaded images into predefined categories such as Cat and Dog.
A pre-trained MobileNetV2 model is used for feature extraction, making the system CPU-efficient and suitable for execution on local machines.
To improve real-world reliability, the application includes confidence-based unknown detection, preventing incorrect predictions for unrelated images (for example, human faces).
- Develop an image classification model using Convolutional Neural Networks (CNN)
- Apply transfer learning to reduce training time and CPU usage
- Preprocess and normalize image data
- Deploy the trained model using a frontend web interface
- Display prediction results with confidence scores
- Handle unknown or unrelated images intelligently
- Programming Language: Python
- Deep Learning Framework: TensorFlow & Keras
- Pre-trained Model: MobileNetV2
- Frontend Framework: Streamlit
- Image Processing: Pillow (PIL), NumPy
- Version Control: Git & GitHub
User Uploads Image
↓
Streamlit Frontend (frontend/app.py)
↓
Image Preprocessing (Resize & Normalize)
↓
MobileNetV2 (Feature Extraction)
↓
Custom CNN Classification Layer
↓
Softmax Output (Probabilities)
↓
Prediction + Confidence / Unknown Handling
Image_Tagging_Project/
├── dataset/
│ ├── cat/
│ │ ├── cat1.jpg
│ │ ├── cat2.jpg
│ │ └── ...
│ └── dog/
│ ├── dog1.jpg
│ ├── dog2.jpg
│ └── ...
├── model/
│ └── image_tagger.h5
├── frontend/
│ └── app.py
├── train.py
├── predict.py
├── requirements.txt
├── .gitignore
└── README.md
- Images are stored in folders where each folder name represents a class label.
- Images are resized to 128 × 128 pixels and normalized.
- MobileNetV2 extracts high-level image features.
- A custom dense layer predicts the image class.
- The Streamlit frontend allows users to upload images.
- The model outputs prediction probabilities using Softmax.
- If confidence is below a defined threshold, the image is classified as Unknown.
- Model Type: Convolutional Neural Network (CNN)
- Learning Approach: Transfer Learning
- Base Model: MobileNetV2 (pre-trained on ImageNet)
- Input Shape: 128 × 128 × 3
- Optimizer: Adam
- Loss Function: Categorical Crossentropy
- Epochs: 3 (CPU-friendly training)
- Upload image via browser
- Display uploaded image
- Predict image category
- Show confidence percentage
- Handle unknown images gracefully
- Simple and user-friendly interface
pip install -r requirements.txtpython train.pymodel/image_tagger.h5
cd frontend
streamlit run app.pyOpen in browser:
http://localhost:8501If the prediction confidence is below 70%, the system displays:
⚠️ Unknown object (not cat or dog)Prediction: CAT
Confidence: 95.91%Unknown object (not cat or dog)
Confidence was only 48.20%- Add more image classes (human, car, animal types)
- Implement multi-label image tagging
- Deploy using Flask or FastAPI
- Add cloud deployment (AWS / GCP)
- Improve UI with custom CSS
- Integrate real-time camera input
- Understanding of CNNs and transfer learning
- Practical experience with TensorFlow & Keras
- Frontend integration using Streamlit
- Real-world handling of unknown data
- GitHub project structuring and version control
This project is developed for educational purposes and is free to use for learning and experimentation.
Dikshitha A
Aspiring Software Engineer | AI & ML Enthusiast | Python Development