Skip to content

I have built a model to classify images of different natural scenes (like forests, glaciers, and streets) using a powerful technique called transfer learning. This project is perfect for understanding the end-to-end machine learning workflow.

Notifications You must be signed in to change notification settings

mithun-27/Image_classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation


🏞️ Natural Scene Image Classifier


This project is a deep learning–based image classification system that identifies natural scenes such as buildings, forests, glaciers, mountains, seas, and streets. It uses MobileNetV2 with transfer learning for model training and a Streamlit web app for interactive predictions.


📌 Features

  • ✅ Train a CNN using MobileNetV2 on Intel’s Natural Scene dataset.
  • ✅ Use data augmentation to improve generalization.
  • ✅ Save and load the trained model (scene_classifier_model.h5).
  • ✅ Deploy a Streamlit app to classify uploaded images.
  • ✅ Outputs the predicted class along with confidence percentage.

📂 Project Structure

.
├── app.py                   # Streamlit web application
├── train_model.py           # Model training script
├── scene_classifier_model.h5 # Saved trained model (generated after training)
├── data/                    # Dataset folder (download from Kaggle)
└── README.md                # Project documentation

📊 Dataset

The model is trained on the Intel Image Classification Dataset from Kaggle:

🔗 Intel Image Classification Dataset

  • Classes (6 total):

    • 🏙️ Buildings
    • 🌲 Forest
    • 🧊 Glacier
    • ⛰️ Mountain
    • 🌊 Sea
    • 🚦 Street

⚙️ Installation & Setup

  1. Clone the repository

    git clone https://github.com/mithun-27/natural-scene-classifier.git
    cd natural-scene-classifier
  2. Install dependencies

    pip install -r requirements.txt

    Example requirements.txt:

    streamlit
    tensorflow
    pillow
    numpy
    
  3. Download the dataset


🏋️‍♂️ Train the Model

Run the training script:

python train_model.py

This will:

  • Load and preprocess the dataset.
  • Train a MobileNetV2-based classifier.
  • Save the trained model as scene_classifier_model.h5.

🚀 Run the Streamlit App

Start the app:

streamlit run app.py

Then, open the provided local URL in your browser.

  • Upload an image (jpg, jpeg, or png).
  • Click Classify Image.
  • See the predicted class and confidence score.

🖼️ Screenshots

Below are example screenshots of the app in action:

🔹 Upload Screen

image

🔹 Prediction Screen

image

📈 Model Details

  • Base Model: MobileNetV2 (pretrained on ImageNet).
  • Input Size: 150×150 RGB images.
  • Optimizer: Adam (lr = 0.001).
  • Loss Function: Categorical Crossentropy.
  • Training Epochs: 5 (can be increased for better accuracy).

🛠️ Future Improvements

  • Increase training epochs for higher accuracy.
  • Fine-tune MobileNetV2 layers.
  • Deploy as a web service (Flask/FastAPI backend).
  • Add support for more scene categories.

👨‍💻 Author

Developed by Mithun 🚀


About

I have built a model to classify images of different natural scenes (like forests, glaciers, and streets) using a powerful technique called transfer learning. This project is perfect for understanding the end-to-end machine learning workflow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages