Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posture Detection using PoseNet #717

Merged
merged 27 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Deep Learning/Posture_Detection_Posenet/Images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions Deep Learning/Posture_Detection_Posenet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Deep Learning Model Posture Detection with PoseNet

This repository contains a web application that utilizes the PoseNet model for pose estimation. The application captures video from the user's webcam and detects human poses in real-time.

## Model Description

The PoseNet model is a deep learning model developed by Google that allows for real-time pose estimation using machine learning techniques. It can identify key body joints and provide their positions in an image or video. This implementation uses the ml5.js library, which provides a simple interface for working with PoseNet in JavaScript.

## Features

- Real-time pose estimation using the user's webcam
- Drawing of key points and skeleton lines on the video feed
- Image overlay on specific body parts

## Dependencies

The following dependencies are used in this project:

- [ml5.js](https://ml5js.org/): A friendly JavaScript library for machine learning
- [p5.js](https://p5js.org/): A JavaScript library for creative coding.

## Tech Stack

The following technologies and libraries were used in this project:

- HTML
- CSS
- JavaScript
- [ml5.js](https://ml5js.org/): A friendly JavaScript library for machine learning
- [p5.js](https://p5js.org/): A JavaScript library for creative coding

The project utilizes HTML for structuring the web page, CSS for styling, and JavaScript for interactivity and integration with PoseNet. The ml5.js library is used to load the PoseNet model and perform pose estimation, while p5.js is used for drawing the video feed and overlays on the canvas.






17 changes: 17 additions & 0 deletions Deep Learning/Posture_Detection_Posenet/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>

<head>
<title>PoseNet Demo</title>
<script src="https://unpkg.com/ml5@latest/dist/ml5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script>
<script src='sketch.js'></script>
</head>

<body>
<h1>PoseNet Demo</h1>
</body>




</html>
61 changes: 61 additions & 0 deletions Deep Learning/Posture_Detection_Posenet/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
let capture;
let posenet;
let noseX,noseY;
let reyeX,reyeY;
let leyeX,leyeY;
let singlePose,skeleton;
let actor_img;
let specs,smoke;

function setup() {
createCanvas(800, 500);
capture = createCapture(VIDEO)
capture.hide();

posenet = ml5.poseNet(capture, modelLoaded);
posenet.on('pose',receivedPoses);

actor_img = loadImage('images/shahrukh.png');
specs = loadImage('images/spects.png');
smoke = loadImage('images/cigar.png');

}

function receivedPoses(poses){
console.log(poses);

if(poses.length > 0){
singlePose = poses[0].pose;
skeleton = poses[0].skeleton;
}
}

function modelLoaded() {
console.log('Model has loaded');
}

function draw() {

// images and videos(webcam)
image(capture, 0, 0);
fill(255,0,0);

if(singlePose){
for(let i=0; i<singlePose.keypoints.length; i++){
ellipse(singlePose.keypoints[i].position.x, singlePose.keypoints[i].position.y,20);
}
stroke(255,255,255);
strokeWeight(5);
for(let j=0; j<skeleton.length; j++){
line(skeleton[j][0].position.x, skeleton[j][0].position.y, skeleton[j][1].position.x, skeleton[j][1].position.y)
}

//image(specs,singlePose.nose.x-35,singlePose.nose.y-50,80,80);
//image(smoke,singlePose.nose.x-35,singlePose.nose.y+10,40,40);


}



}
5 changes: 5 additions & 0 deletions Deep Learning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@
- <a href="https://github.com/lcs2022026/MindWave_fork/blob/Tomato_Leaf_Disease_Detection_by_using_CNN_%2398/Deep%20Learning/Tomato%20Leaf%20Disease%20Detection/CNN_Tomato_Leaf_Disease_Detection.ipynb">CNN - Tomato Leaf Disease Detection</a>
- <a href="https://github.com/lcs2022026/MindWave_fork/blob/WCE_Curated_Colon_Disease_classification_%23168/Deep%20Learning/WCE%20Curated%20Colon%20Disease%20classification/model.algorithm.ipynb">CNN - WCE curated colon disease</a>
- <a href="https://github.com/Shubhra-31/MindWave/blob/main/Deep%20Learning/Tfidf_LightGBM_Netflix%20Movies%20and%20TV%20Shows/Lightgbm_Netflix%20Movies%20and%20TV%20Shows%20.ipynb"> Tfidf-LightGBM-Netlfix Movies and TV Shows </a>
- <a href="https://github.com/Shreyg-27/MindWave/tree/main/Deep%20Learning/Posture_Detection_Posenet">CNN - Posture Detection</a>
- <a href="https://github.com/Soumya1219/MindWave/blob/master/Deep%20Learning/Traffic%20Sign%20Recognition/Traffic-Sign-Recognition.ipynb"> CNN - Traffic Sign Recognition
</a>





## Implementation Ideas

- <a href="https://www.kaggle.com/datasets/andradaolteanu/gtzan-dataset-music-genre-classification">ANN - Music genre classification</a>
Expand Down Expand Up @@ -100,6 +103,7 @@
- <a href="https://github.com/sujanrupu/MindWave/blob/main/Deep%20Learning/CNN_Speech_Emotion_Recognition.ipynb">CNN - Speech Emotion Recognition</a>
- <a href="https://github.com/lakshmishreea122003/face-detedtion-MTCNN">Face Detection MTCNN</a>
- <a href="https://github.com/sujanrupu/MindWave/tree/main/Deep%20Learning/Gender_Recognition_Using_Voice">Gender Recognition Using Voice</a>
- <a href="https://github.com/Shreyg-27/MindWave/tree/main/Deep%20Learning/Posture_Detection_Posenet">CNN - Posture Detection</a>



Expand All @@ -121,4 +125,5 @@
- VGG16
- VGG19
- MTCNN
- PoseNet

Loading