.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "build/examples_pose/demo_alpha_pose.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_build_examples_pose_demo_alpha_pose.py: 2. Predict with pre-trained AlphaPose Estimation models ========================================================== This article shows how to play with pre-trained Alpha Pose models with only a few lines of code. First let's import some necessary libraries: .. GENERATED FROM PYTHON SOURCE LINES 9-14 .. code-block:: default from matplotlib import pyplot as plt from gluoncv import model_zoo, data, utils from gluoncv.data.transforms.pose import detector_to_alpha_pose, heatmap_to_coord_alpha_pose .. GENERATED FROM PYTHON SOURCE LINES 15-26 Load a pretrained model ------------------------- Let's get a Alpha Pose model trained with input images of size 256x192 on MS COCO dataset. We pick the one using ResNet-101 V1b as the base model. By specifying ``pretrained=True``, it will automatically download the model from the model zoo if necessary. For more pretrained models, please refer to :doc:`../../model_zoo/index`. Note that a Alpha Pose model takes a top-down strategy to estimate human pose in detected bounding boxes from an object detection model. .. GENERATED FROM PYTHON SOURCE LINES 26-35 .. code-block:: default detector = model_zoo.get_model('yolo3_mobilenet1.0_coco', pretrained=True) pose_net = model_zoo.get_model('alpha_pose_resnet101_v1b_coco', pretrained=True) # Note that we can reset the classes of the detector to only include # human, so that the NMS process is faster. detector.reset_class(["person"], reuse_weights=['person']) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading /root/.mxnet/models/alpha_pose_resnet101_v1b_coco-de56b871.zip from https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/alpha_pose_resnet101_v1b_coco-de56b871.zip... 0%| | 0/216178 [00:00` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_alpha_pose.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_