This repository provides a simple example of performing image classification using ML5.js and PoseNet. ML5.js is a JavaScript library that makes machine learning accessible for creative coding, and PoseNet is a pre-trained deep learning model that estimates human pose from images or videos.
In this example, we'll be using PoseNet to capture the pose of a person and then use that pose information for image classification. The code uses a pre-trained PoseNet model and a custom image classification model to demonstrate the integration of the two.
Follow these steps to get started with using ML5.js and PoseNet for image classification:
-
Clone this repository to your local machine:
git clone https://github.com/AnadyaNair/ML5-Posenet-Image-Classification.git
-
Navigate to the project directory:
cd ML5-Posenet-Image-Classification
-
Open the
index.html
file in a web browser to see the example in action.
-
Loading PoseNet Model: The example loads the PoseNet model using the ML5.js library. This model is responsible for estimating the pose of a person in the video feed.
-
Capturing Pose Data: As the video feed starts, PoseNet estimates the pose of the person. The relevant pose data, such as the positions of various body keypoints (e.g., wrists, elbows, knees), is extracted from the PoseNet model.
-
Image Classification: The extracted pose data is then used as input to a custom image classification model. This model classifies the current pose into a specific category. In this example, the image classification model could identify yoga poses or dance moves based on the detected body keypoints.
-
Displaying Results: The classification result is displayed on the webpage, showing the detected pose and the corresponding classification label.
Feel free to customize and expand upon this example:
-
Image Classification Model: Replace the custom image classification model with your own pre-trained model or use a different ML5.js-supported model for your desired classification task.
-
Classification Categories: Modify the categories or labels used for classification according to your application.
-
Styling: Enhance the styling of the webpage to create a visually appealing interface for users.
- ML5.js: A friendly JavaScript library for machine learning.
Contributions are welcome! If you have ideas for improvements, bug fixes, or new features, please feel free to submit a pull request.
This project is licensed under the GNU GENERAL PUBLIC LICENSE v3.0.