Skip to content

Latest commit

 

History

History
105 lines (55 loc) · 2.13 KB

SimplePoseNetForMultiPerson.md

File metadata and controls

105 lines (55 loc) · 2.13 KB

Estimate Human Pose For Multiple Person Using Pretrained Network

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);

figure_0_png.jpg

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')

figure_1_png.jpg

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_2_png.jpg

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

figure_3_png.jpg

Estimate keypoints for each cropped image

heatmaps = detector.predict(croppedImages);
Iheatmaps = detector.visualizeHeatmaps(heatmaps, croppedImages);
montage(Iheatmaps);
title("Joint heatmaps")

figure_4_png.jpg

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

figure_5_png.jpg

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

figure_6_png.jpg

Copyright 2020 The MathWorks, Inc.