Estimate Human Pose For Multiple Person Using Pretrained Network
June 11, 2020 ยท View on GitHub
Load pretrained pose estimator model
detector = posenet.PoseEstimator;
Make a prediction for multi-person
Next, we will try to estimate keypoints with a test image. First, read a test image.
I = imread('visionteam1.jpg');
imshow(I);

Detect people in the loaded image.
[bboxes,scores] = detectPeopleACF(I);
Iout = insertObjectAnnotation(I,'rectangle',bboxes,scores,'LineWidth',3);
imshow(Iout)
title('Detected people and detection scores')

Extract and transform the detected objects to fit the input of the network.
[croppedImages, croppedBBoxes] = detector.normalizeBBoxes(I, bboxes);
Iout2 = insertObjectAnnotation(I,'rectangle',croppedBBoxes,scores,'LineWidth',3);
imshow(Iout2);
title('Resize the bounding boxes to be the same aspect ratio in the input of the network.');

figure, montage(croppedImages);
title('Each cropped image')

Estimate keypoints for each cropped image
heatmaps = detector.predict(croppedImages);
Iheatmaps = detector.visualizeHeatmaps(heatmaps, croppedImages);
montage(Iheatmaps);
title("Joint heatmaps")

keypoints = detector.heatmaps2Keypoints(heatmaps);
Iheatmaps = detector.visualizeKeyPoints(Iheatmaps,keypoints);
montage(Iheatmaps);
title('Extracted joints for each person');

Iout3 = detector.visualizeKeyPointsMultiple(I,keypoints,croppedBBoxes);
imshow(Iout3);
title('Estimated keypoints in the coordinates of the original image');

Copyright 2020 The MathWorks, Inc.