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