detectPoses
warning
The document is a continuation of the previous document, if you have landed directly on this page then, Please read from page Get started.
#
What is detectPoses component ?detectPoses component is used to detect pose of a person in input image.
- Description : detectPoses() takes an input as image in base64 string format and returns the points(x,y) with probability for that point.Check Input and output parameters for details.
- Parameters :
- Input(Via STDIN) : A JSON String with following contents:
- Input1 : Image (.jpg/.png) in base64 format
- Output(Via STDOUT) : A JSON string with following contents
- For each detected point
- x,y co-ordinates
- probability being point
- int responseID
- For each detected point
- Input(Via STDIN) : A JSON String with following contents:
#
List of detectPoses features in shunya stack- Get human pose data.
detectPoses
#
Using detectPoses
#
Requirements to use - Shunya OS installed (supported Arm devices) or Shunya OS docker container (X86 based windows/linux devices)
- Shunya AI installed in Shunya OS.
detectPoses
#
Steps to use - Set input image location.
- Get human pose data
note
Run the steps given below inside Shunya OS installed (supported Arm devices) or Shunya OS docker container (X86 based windows/linux devices) terminals.
Lets take an example use case: Say we need to
- Detect pose of person in an image.
- Get JSON output of detected pose data.
Steps are
#
Step 1: Set location of the input image for pose estimationStart with an ready to use template for detecting pose from image.
Open the examples in a text editor and modify as per your usecase.
- For CPP you will find the examples in the folder
cpp-examples/pose-estimation/detectPoses
- Open the file
detect_poses.cpp
- Modify the line to set the location of the input image
- For Python you will find the examples in the folder
python-examples/pose-estimation/detectPoses
- Open the file
detect_poses.py
- Modify the line to set the location of the input image
- For CPP you will find the examples in the folder
#
Step 2: Get human pose data.Once you are done editing, save and run the code, by running
Running the codes will print the JSON output on the terminal (to STDOUT).
For Example:
Lets say the input image is
Input JSON is
Then the JSON output is
#
Understand this component with an example (ready to use code)This is an example for pose-estimation and here we will be using 2 components: detectPoses and drawPoses
Check this ready to use example in c++ and python
Download the code
```shell git clone https://gitlab.iotiot.in/shunya/products/shunya-ai-examples.git cd shunya-ai-examples/python-examples/pose-estimation ```In this folder there is a file, pose_detect.cpp or pose_detect.py
detectbjects Components used
```shell detectPoses = Popen(['/usr/bin/detectPoses'], stdout=PIPE, stdin=PIPE) ```drawPoses component used
```shell drawPoses = Popen(['/usr/bin/drawPoses'], stdout=PIPE, stdin=PIPE) ```Run code by yourself
- You will get a new image stored in system.```shell python3 pose_estimate.py ```