This is a simple example.

    from gluoncv import model_zoo, data, utils

    from gluoncv.data.transforms.pose import detector_to_simple_pose, 
heatmap_to_coord

    detector = model_zoo.get_model('yolo3_mobilenet1.0_coco', pretrained=True, 
root='./model')

    pose_net = model_zoo.get_model('simple_pose_resnet18_v1b', pretrained=True, 
root='./model')

    detector.reset_class(["person"], reuse_weights=['person'])

    url = 
'https://raw.githubusercontent.com/dmlc/web-data/master/gluoncv/segmentation/mhpv1_examples/1.jpg'

    filename = 'sample.jpg'

    utils.download(url, filename)

    x, img = data.transforms.presets.ssd.load_test(filename, short=512)

    class_IDs, scores, bounding_boxs = detector(x)

    pose_input, upscale_bbox = detector_to_simple_pose(img, class_IDs, scores, 
bounding_boxs)

    predicted_heatmap = pose_net(pose_input)

    pred_coords, confidence = heatmap_to_coord(predicted_heatmap, upscale_bbox)

    from PIL import Image, ImageDraw

    pil_image = Image.fromarray(img)

    draw = ImageDraw.Draw(pil_image)

    keypoints = data.mscoco.keypoints.COCOKeyPoints.KEYPOINTS

    for keypoint_id in range(len(keypoints)):

        pred = pred_coords[:,keypoint_id,:]

        for i in range(pred.shape[0]):

            if (confidence[i,keypoint_id,:] > 0.2) == 1:

                draw.text(pred[i,:].asnumpy(),text=keypoints[keypoint_id], 
fill='red')

    pil_image.show()





---
[Visit 
Topic](https://discuss.mxnet.apache.org/t/how-to-find-which-part-of-body-the-keypoint-relates-to-in-pose-estimation/6468/4)
 or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.mxnet.apache.org/email/unsubscribe/b7c58a4ac97c51783812897cba7ffb65603af51aff16818e8e67e74f28a09415).

Reply via email to