Giter Club home page Giter Club logo

maxinexiong / imageai-flask-apps Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 2.0 72.29 MB

This project offers two Flask applications that utilize ImageAI's image prediction algorithms and object detection models. These apps enable users to upload images and videos for object recognition, detection and analysis, providing accurate prediction results, confidence scores, raw data of detected objects at frame-level, and object insights.

Home Page: https://maxinexiong.github.io/projects/ai-projects.html#imageai-flask

License: Other

Python 57.74% CSS 15.32% HTML 26.95%
computer-vision flask image-recognition imageai python video-object-detection ai-project pandas-dataframe css3 html5

imageai-flask-apps's Introduction

ImageAI Computer Vision Flask Apps

GitHub License: MIT Made with Python HTML5 CSS3 ImageAI


Project Description

This project consists of two Flask applications that utilize ImageAI's image prediction algorithms and object detection models to perform object recognition and analysis in images and videos. The first application, Image Object Recognition Flask Application, allows users to upload images and obtain accurate predictions about the objects contained within, along with confidence scores. The second application, Video Object Detection Flask Application, performs the detection of objects in videos, generating frame-level data of the detected objects and providing insights through data analysis. These user-friendly apps offer an accessible and intuitive platform for leveraging advanced computer vision capabilities, empowering users to explore, analyze, and extract meaningful information from visual content with ease.


Features

  • App 1 - Image Object Recognition Flask Application:
    • Upload and predict objects in images.
    • Display predicted objects with confidence scores.
  • App 2 - Video Object Detection Flask Application:
    • Upload and detect objects in a video.
    • Generate a raw dataset of detected objects at the frame level in CSV format (downloadable).
    • Generate an output video with detected objects highlighted with rectangles (downloadable).
    • Perform data analysis to provide insights on detected objects in the video, including:
      • Average number of unique objects per frame.
      • Average number of unique objects per second (conditions applies).
      • Average number of unique objects per minute (conditions applies).
      • Average number of unique objects per hour (conditions applies).
      • Total number of unique objects in the entire video.

Repository Structure

The repository has the following structure:

ImageAI-Flask-Apps/
├── ImageAI-web-app.py
├── image_recognizer.py
├── video_object_detector.py
├── templates/
│   ├── image-prediction.html
│   ├── index.html
│   └── video-object-detection.html
├── static/
│   ├── main.css
│   ├── images/
│   │   ├── demo-image-recognizer.gif
│   │   ├── demo-video-object-detector.gif
│   │   └── web-icon.ico
├── models/
│   ├── image-prediction-models/
│   │   └── README.md
│   ├── video-object-detection-models/
│   │   └── README.md
├── files_for_testing/
├── requirements.txt
├── README.md
└── LICENSE

The description of each file and folder in the repository is as follows:

  • ImageAI-web-app.py: This is the core driver file for the Flask apps. It handles the routing and functionality for the Image Object Recognition and Video Object Detection apps.

  • image_recognizer.py: This file contains the code responsible for image object recognition. It utilizes ImageAI's image prediction algorithms to predict objects in uploaded images.

  • video_object_detector.py: This file handles video object detection. It uses ImageAI's object detection models to detect objects in uploaded videos and generates frame-level data of the detected objects.

  • templates/: This folder contains the HTML templates used by the Flask apps. It includes three files:

    • index.html: The main HTML template that serves as the home page for the Flask apps. It provides navigation links to the Image Object Recognition and Video Object Detection apps.
    • image-prediction.html: The HTML template for the Image Object Recognition app, which allows users to upload and predict objects in images.
    • video-object-detection.html: The HTML template for the Video Object Detection app, which enables users to upload and detect objects in videos.
  • static/: This folder contains static files used by the Flask apps, such as CSS stylesheets and images. It includes the following:

    • main.css: The CSS styling file that defines the appearance and layout of the HTML templates.
    • images/: A subfolder that stores various images used in the project, including demo GIFs (demo-image-recognizer.gif and demo-video-object-detector.gif) and a favicon (web-icon.ico).
  • models/: This folder is meant to store ImageAI's models for image classification and object detection. However, it currently contains two empty subfolders:

    • image-prediction-models/: An empty subfolder where users should manually place ImageAI's image prediction models. Instructions for downloading and saving the models are provided in the README.md file inside this subfolder.
    • video-object-detection-models/: Another empty subfolder where users should manually add ImageAI's object detection models. Instructions for downloading and saving the models are provided in the README.md file inside this subfolder.

    Note: The models/ folder is intentionally left empty in the GitHub repository due to the large size of the models. Users are required to manually download and place the models into the corresponding subfolders as described in the README files.

  • files_for_testing/: This folder contains a collection of test images and videos that can be used for app testing and experimentation.

  • requirements.txt: This file lists the necessary dependencies and packages required to run the Flask apps. It provides a convenient way to install all the dependencies.

  • README.md: The README file for the project. It provides an overview of the project, installation instructions, usage guidelines, and other relevant information.

  • LICENSE: The license file for the project, which specifies the terms and conditions under which the code and resources are shared.


Usage

To use the ImageAI Computer Vision Flask Apps, please follow these steps:

  1. Install the required dependencies by running the following command to install all the necessary packages and dependencies required to run the Flask apps:

    pip install -r requirements.txt
    

    This command will ensure that all the required libraries and dependencies are installed in your Python environment.

  2. Download the image classification and object detection models:

    • Inside the models/image-prediction-models/ subfolder, follow the instructions provided in the README.md file to manually download and save the ImageAI's image prediction models in the current directory.
    • Similarly, inside the models/video-object-detection-models/ subfolder, follow the instructions in the README.md file to manually download and save ImageAI's object detection models in the current directory.
  3. Once the dependencies are installed and the models are added, open the command prompt or terminal and navigate to the project directory.

  4. Run the following command to start the Flask apps:

    python ImageAI-web-app.py
    
  5. After running the above command, access the Flask apps by visiting http://127.0.0.1:5000/ in your web browser. This will take you to the home page of the Flask apps.

  6. From the home page, you can navigate to the Image Object Recognition Flask Application or the Video Object Detection Flask Application to perform the respective tasks.

    • In the Image Object Recognition Flask Application, you can upload images and predict objects present in them. The predicted objects will be displayed along with their confidence scores.


      This GIF demonstrates the process of uploading an image, predicting objects in the image, and displaying the predicted objects with confidence scores.

    • In the Video Object Detection Flask Application, you can upload a video and detect objects in it. The app will generate raw frame-level object data in CSV format that can be downloaded, along with an output video where detected objects are highlighted with rectangles. Additionally, it performs data analysis to provide insights on the detected objects in the video, such as the average number of unique objects per frame, per second, per minute, per hour, and the total number of unique objects in the entire video depending on the length of the video.


      This GIF showcases the steps of uploading a video, detecting objects in the video, generating and downloading frame-level object data in CSV format, and performing data analysis on the detected objects to provide insights.

Note: The files_for_testing folder contains test images and videos that you can use to explore and test the functionalities of the Flask apps. Feel free to experiment with these test files to familiarize yourself with the Flask apps. Alternatively, you can also use your own images or videos when working with the apps in a production environment.

Make sure to follow these instructions in the given sequence to ensure the proper setup and usage of the ImageAI Flask Apps.


Contribution

Contributions to this project are welcome. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.


License

This project is licensed under the MIT License.


Acknowledgement

I would like to thank the creator of ImageAI for providing the image prediction and object detection algorithms used in this project. His contributions have been instrumental in the development of these Flask applications. To delve deeper into the computer vision algorithms and models developed by ImageAI, I encourage you to visit the ImageAI GitHub Page or explore its official documentation.

imageai-flask-apps's People

Contributors

maxinexiong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.