Skip to content

myekini/Image_detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CNN-based Image Classification with Flask

This project implements a Flask web application for image classification using a pre-trained Convolutional Neural Network (CNN) model. Users can upload images and receive predictions about their content.

Key Features

  • Image Upload: Users can conveniently upload images through the application's interface.
  • Image Prediction: Leverages a pre-trained Keras model with loaded checkpoint weights to predict the class of the uploaded image.
  • Error Handling: Ensures graceful handling of errors and provides informative messages to users.
  • Easy Deployment: Allows for straightforward deployment on platforms like Render with minimal configuration.

Installation

  1. Clone the Repository:
git clone https://github.com/your_username/cnn-image-detection.git
cd cnn-image-detection
  1. Install Dependencies:
pip install -r requirements.txt
  1. Run the Application:
python app.py
  1. Access the Application:

Open a web browser and navigate to http://localhost:5000 to interact with the application.

Usage

  1. Visit the application in your web browser.
  2. Select and upload an image using the provided interface.
  3. The application will process the image and display the predicted class.

Technologies Used

  • Flask: Web framework for building the user interface and handling user interactions.
  • TensorFlow/Keras: Deep learning libraries used for model development and image prediction.
  • (Optional) Render: Cloud platform for deploying the application (alternatives exist).

Requirements

  • Python 3.x
  • Flask
  • TensorFlow
  • Keras
  • Pillow (PIL Fork)
  • NumPy

Setup

  1. Install Required Libraries:
pip install flask tensorflow keras pillow numpy
  1. Configure the Application:

    • Replace placeholders in the code:
      • MODEL_PATH: Path to your saved model architecture (.h5 file).
      • CHECKPOINT_PATH: Path to your saved checkpoint weights (.h5 file).
      • TARGET_NAMES: List of class names corresponding to your model's output (adjust accordingly).
    • Modify the preprocess_image function if needed for specific image preprocessing (e.g., normalization parameters).
  2. Create User Interface:

    • Develop an HTML template (index.html) for the user interface, including a form for uploading images and displaying prediction results.

Additional Notes

  • This code serves as a basic example. Adapt it to your specific model and requirements.
  • Implement robust error handling to gracefully handle user input errors or unexpected issues.

Deployment

For production deployment, consider using web servers like Gunicorn or cloud platforms.

License

This project is licensed under the MIT License (see the LICENSE: LICENSE file for details).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published