Comments (9)
@tristanle22 Thanks to the mediapipe API, it may seems to the user that the pose estimation is done in one step, but behind the scene, it is actually a 2 steps process as explained there: https://google.github.io/mediapipe/solutions/pose#ml-pipeline
The solution utilizes a two-step detector-tracker ML pipeline, proven to be effective in our MediaPipe Hands and MediaPipe Face Mesh solutions. Using a detector, the pipeline first locates the person/pose region-of-interest (ROI) within the frame. The tracker subsequently predicts the pose landmarks and segmentation mask within the ROI using the ROI-cropped frame as input.
For this repo, I took direct inspiration from the mediapipe implementation, but just adapted it to the depthai library.
from depthai_blazepose.
This alignment is done either from the detection stage or from the previous frame keypoints.
It consists in calculating the center and rotation of what I call in my code comments the "rectangle" or "rotated rectangle" (actually it is a square).
In host mode, the code is done in:
depthai_blazepose/mediapipe_utils.py
Line 306 in d79e1ee
In edge mode, the code:
- when calculating from the detection stage :
depthai_blazepose/template_manager_script.py
Lines 116 to 120 in d79e1ee
- when calculating from the previous frame keypoints:
depthai_blazepose/template_manager_script.py
Lines 211 to 222 in d79e1ee
from depthai_blazepose.
Thank you for your reply! I'd like to ask you a few questions about the skeleton adjustment.
I found that some pose estimation algorithms can't detect the inverted pose at present, but blazepose can detect the inverted algorithm very well. I think this is the advantage of the alignment of the skeleton, but I don't know how to adjust the skeleton in the detection stage, do I need to detect the hips first?If you can't detect the skeleton in a inverted pose, how can you detect the key points in the hips? Since the part of skeleton alignment is not explained in detail in the paper, could you please explain how the skeleton is adjusted in the detection stage? Thank you~
from depthai_blazepose.
I think this paragraph clarifies how the detection stage is working: https://google.github.io/mediapipe/solutions/pose.html#personpose-detection-model-blazepose-detector
The pose detector is adapted from the mediapipe face detector. In addition to the face bounding box, the model infers 2 keypoints. One keypoint is an estimation of the mid hip center. The other, combined with the mid hip center keypoint, encodes the size and rotation of the whole body bounding box. It may looks like a bit of magic but the hips don't need to be visible in the image for the detection model to infer these 2 keypoints. For instance, blazepose works even on close-up face picture. It makes sense because knowing the size and orientation of the face is enough to estimate a realistic body position and orientation.
I hope I answered to your question.
from depthai_blazepose.
Thank you for your reply, but I still have two questions to ask.
1.Hello, I would like to know how to infer these two additional key points, is it based on the method of face detector?Do I have to understand the idea of face detection if I want to understand the source of these two key pointsใ
2.After the posture is aligned, the skeleton needs to be mapped back to the original posture when drawing the skeleton. I don't know if I understand correctly. If yes, I would like to ask where the code of this part is.
Thank you~
from depthai_blazepose.
- The detection model outputs directly the face bounding box and the 2 keypoints. In host mode, the parsing of the detection model is done by this function :
depthai_blazepose/mediapipe_utils.py
Line 181 in d79e1ee
More precisely, the model ouputs an array of 12 floats for each detected body (896 bodies max):
- the first 4 floats describe the face bounding box (center_x, center_y, width, height);
- the 8 last floats corresponds to 4 keypoints with 2 floats (x, y) for each keypoint:
- first keypoint corresponds to mid hip center;
- 2nd keypoint is used to encode the size and rotation of the body bounding box;
- the 3rd and 4th were used in a previous version of blazepose but are not used anymore.
- Yes. The landmark regression model yields coordinates in the square rotated body bounding box, so we need to map them back in the image coordinate system if we want to draw the skeleton. In host mode, this is done here:
depthai_blazepose/BlazeposeDepthai.py
Lines 511 to 522 in d79e1ee
depthai_blazepose/BlazeposeDepthai.py
Line 542 in d79e1ee
depthai_blazepose/BlazeposeDepthai.py
Lines 549 to 550 in d79e1ee
depthai_blazepose/BlazeposeDepthai.py
Lines 553 to 554 in d79e1ee
from depthai_blazepose.
Thank you for your reply!
Hello, I have looked up a lot of materials and only explained these two key points of model inference, but did not explain in detail how to infer. The code is a little complicated and I don't understand it very well. Could you please help me explain the idea of getting these two key points?
from depthai_blazepose.
The idea of getting these two keypoints is exactly what I said in my previous message. I don't know how to explain it differently. The 2 keypoints are, among other things, inferred by the detection model. The decode_bboxes() function is just processing the model output to store the information in an instance of a Body class. At the end, the 1st keypoint (mid hip center) is stored in Body.pd_kps[0] and the second keypoint is stored in Body.pd_kps[1] as normalized coordinates (between 0 and 1).
from depthai_blazepose.
Hi there! I have a question somewhat relevant to this discussion. In this tutorial, https://google.github.io/mediapipe/solutions/pose#python-solution-api, you can directly obtain the pose using mediapipe.solutions.pose by directly passing in the image. However in your implementation, you're keeping the pose and landmark detection as 2 separate steps in the pipeline, basically re-implementing feature from mediapipe. May I ask what's the reason behind this?
from depthai_blazepose.
Related Issues (20)
- how to specify IP address of OAK-D Pro HOT 7
- using IR LED and mono cameras for skeleton detection HOT 15
- run as standalone network device on OAK-D Pro POE HOT 3
- [ImageManip(7)] [error] Invalid configuration or input image -skipping frame HOT 21
- Input for landmark regression too small HOT 2
- How to replace ColorCamera with XLinkIn node? HOT 1
- AttributeError: 'depthai.node.Script' object has no attribute 'setScriptData' HOT 1
- RuntimeError: No available devices HOT 6
- Error in the edge mode HOT 3
- 'Couldn't read data from stream: 'manager_out' (X_LINK_ERROR)'
- What is the max FPS for real time pose estimation? HOT 1
- 'Couldn't read data from stream: 'manager_out' (X_LINK_ERROR)' on OAK-D S2, M1 Mac
- glitchiness HOT 1
- Renderer Argument -3 World Attribute Error
- Out of Memory Error
- requirements.txt update for RPi4
- Device not recognized for OAK-D W OV9782
- Wrong 3d hand pose
- Question about getting spatial data of each landmark
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from depthai_blazepose.