BodyPix

Person Segmentation

RUN

The BodyPix tool detects body parts in human figures using the BodyPix model. The model runs in multi-person instance by default, but this can be changed to improve performance.

The model outputs object contains a width, height, Pose and an Int32Array with a part id from 0-24 for the pixels that are part of a corresponding body part, and -1 otherwise.

The following 24 body parts are detected:

  1. Left Face
  2. Right Face
  3. Left Upper Arm Front
  4. Left Upper Arm Back
  5. Right Upper Arm Front
  6. Right Upper Arm Back
  7. Left Lower Arm Front
  8. Left Lower Arm Back
  9. Right Lower Arm Front
  10. Right Lower Arm Back
  11. Left Hand
  12. Right Hand
  13. Torso Front
  14. Torso Back
  15. Left Upper Leg Front
  16. Left Upper Leg Back
  17. Right Upper Leg Front
  18. Right Upper Leg Back
  19. Left Lower Leg Front
  20. Left Lower Leg Back
  21. Right Lower Leg Front
  22. Right Lower Leg Back
  23. Left Foot
  24. Right Foot

The data is exported as a CSV file structured as follows:

Frame Timestamp(ms) Left Face Right Face Left Upper Arm Front Left Upper Arm Back Right Upper Arm Front Right Upper Arm Back Left Lower Arm Front Left Lower Arm Back Right Lower Arm Front Right Lower Arm Back Left Hand Right Hand Torso Front Torso Back Left Upper Leg Front Left Upper Leg Back Right Upper Leg Front Right Upper Leg Back Left Lower Leg Front Left Lower Leg Back Right Lower Leg Front Right Lower Leg Back Left Foot Right Foot
0 37 1 1 1 1 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0
1 102 0 0 0 0 0 1 1 1 1 0 1 0 0 1 0 1 1 1 0 0 0 0 1 1

The frame column represents the frame number in the video. Each frame consists of a series of numbers, where each number denotes the number of body parts detected for the body part listed in the corresponding colums.

  1. Architecture - It determines which BodyPix architecture to load.
  2. Output Stride - It specifies the output stride of the model. The smaller the value, the larger the output resolution, and the more accurate the model at the cost of speed.

Source Code