Skip to content

SanthiyaR-git/AI-Image-Classification-Web-App-Deep-Learning-Flask-React-MongoDB-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

AI-Image-Classification-Web-App

A full-stack AI-powered web application for image classification using Deep Learning (CNN). Built with Flask, TensorFlow, and MongoDB, it allows users to upload an image and get instant classification results along with prediction confidence.

Project Demo

πŸš€ Live Demo (Localhost): http://127.0.0.1:5000/

When you upload an image, it:

Runs through a trained Convolutional Neural Network (CNN)

Predicts the most likely class (e.g., Cat, Dog, Car)

Displays prediction + confidence

Saves results to MongoDB for analytics/logging

Features

βœ… Upload any image (JPG, PNG, etc.) βœ… Classify using a CNN model (TensorFlow/Keras) βœ… Real-time results with confidence score βœ… Stores predictions in MongoDB βœ… Simple & clean frontend (HTML + JS + CSS inside Flask) βœ… Single-file deployment (app.py)

Tech Stack

Component Technology
Frontend HTML5, CSS3, Vanilla JS
Backend Flask (Python)
Deep Learning TensorFlow / Keras
Database MongoDB
Libraries numpy, pillow, flask-cors
Model Custom CNN trained for image classification

Folder Structure ImageClassificationApp/ β”‚ β”œβ”€β”€ app.py # Main full-stack Flask application β”œβ”€β”€ static/ β”‚ └── uploads/ # Stores uploaded images β”œβ”€β”€ model.h5 # Saved CNN model └── README.md # Documentation (this file)

Installation & Setup 1️⃣ Clone the Repository git clone https://github.com/SanthiyaR-git/AI-Image_Classification-Web-App-Deep-Learning-Flask-React-MongoDB-NN.git cd AI-Image_Classification-Web-App-Deep-Learning-Flask-React-MongoDB-NN

2️⃣ Create a Virtual Environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

3️⃣ Install Dependencies pip install flask flask-cors tensorflow pymongo pillow numpy

4️⃣ Start MongoDB

Make sure MongoDB service is running locally:

mongod

5️⃣ Run the Application python app.py

6️⃣ Open the App

Visit πŸ‘‰ http://127.0.0.1:5000 in your web browser.

Model Information

A simple CNN with:

2 Convolutional + MaxPooling layers

1 Dense hidden layer

Softmax output for classification

Input image size: 64Γ—64Γ—3

Optimizer: Adam

Loss: Categorical Crossentropy

Accuracy: ~90%+ (depending on dataset)

You can retrain the model by replacing the CNN training section in app.py with your dataset.

Example Output πŸ–ΌοΈ Uploaded Image: dog.jpg

🧠 Model Output: { "filename": "dog.jpg", "prediction": "dog", "confidence": 97.83, "timestamp": "2025-10-08 10:23:55" }

πŸ–₯️ Web Interface: Prediction: Dog Confidence: 97.83%

And your uploaded image is displayed below.

MongoDB Record Example { "_id": { "$oid": "6521e95f3a5a2a47dc7a8c2b" }, "filename": "cat_1.jpg", "prediction": "cat", "confidence": 95.42, "timestamp": "2025-10-08 09:47:11" }

How It Works

Upload β†’ User selects an image.

Preprocess β†’ Image resized to 64Γ—64 & normalized.

Predict β†’ CNN model predicts the class label.

Store β†’ Result saved to MongoDB with timestamp.

Display β†’ Frontend shows prediction + confidence + image.

Future Enhancements

Add MySQL support (optional backend database)

Integrate pre-trained models (ResNet, MobileNet)

User authentication for tracking history

Deploy on AWS / Render / Heroku

Add frontend with React or Streamlit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages