Load MPII Human Pose Dataset. Parameters ----------- path : str The path that the data is downloaded to. is_16_pos_only : boolean If True, only return the peoples contain 16 pose keypoints. (Usually be used for single person pose estimation) Returns --------
(path='data', is_16_pos_only=False)
| 1675 | |
| 1676 | |
| 1677 | def load_mpii_pose_dataset(path='data', is_16_pos_only=False): |
| 1678 | """Load MPII Human Pose Dataset. |
| 1679 | |
| 1680 | Parameters |
| 1681 | ----------- |
| 1682 | path : str |
| 1683 | The path that the data is downloaded to. |
| 1684 | is_16_pos_only : boolean |
| 1685 | If True, only return the peoples contain 16 pose keypoints. (Usually be used for single person pose estimation) |
| 1686 | |
| 1687 | Returns |
| 1688 | ---------- |
| 1689 | img_train_list : list of str |
| 1690 | The image directories of training data. |
| 1691 | ann_train_list : list of dict |
| 1692 | The annotations of training data. |
| 1693 | img_test_list : list of str |
| 1694 | The image directories of testing data. |
| 1695 | ann_test_list : list of dict |
| 1696 | The annotations of testing data. |
| 1697 | |
| 1698 | Examples |
| 1699 | -------- |
| 1700 | >>> import pprint |
| 1701 | >>> import tensorlayer as tl |
| 1702 | >>> img_train_list, ann_train_list, img_test_list, ann_test_list = tl.files.load_mpii_pose_dataset() |
| 1703 | >>> image = tl.vis.read_image(img_train_list[0]) |
| 1704 | >>> tl.vis.draw_mpii_pose_to_image(image, ann_train_list[0], 'image.png') |
| 1705 | >>> pprint.pprint(ann_train_list[0]) |
| 1706 | |
| 1707 | References |
| 1708 | ----------- |
| 1709 | - `MPII Human Pose Dataset. CVPR 14 <http://human-pose.mpi-inf.mpg.de>`__ |
| 1710 | - `MPII Human Pose Models. CVPR 16 <http://pose.mpi-inf.mpg.de>`__ |
| 1711 | - `MPII Human Shape, Poselet Conditioned Pictorial Structures and etc <http://pose.mpi-inf.mpg.de/#related>`__ |
| 1712 | - `MPII Keyponts and ID <http://human-pose.mpi-inf.mpg.de/#download>`__ |
| 1713 | """ |
| 1714 | path = os.path.join(path, 'mpii_human_pose') |
| 1715 | logging.info("Load or Download MPII Human Pose > {}".format(path)) |
| 1716 | |
| 1717 | # annotation |
| 1718 | url = "http://datasets.d2.mpi-inf.mpg.de/andriluka14cvpr/" |
| 1719 | tar_filename = "mpii_human_pose_v1_u12_2.zip" |
| 1720 | extracted_filename = "mpii_human_pose_v1_u12_2" |
| 1721 | if folder_exists(os.path.join(path, extracted_filename)) is False: |
| 1722 | logging.info("[MPII] (annotation) {} is nonexistent in {}".format(extracted_filename, path)) |
| 1723 | maybe_download_and_extract(tar_filename, path, url, extract=True) |
| 1724 | del_file(os.path.join(path, tar_filename)) |
| 1725 | |
| 1726 | # images |
| 1727 | url = "http://datasets.d2.mpi-inf.mpg.de/andriluka14cvpr/" |
| 1728 | tar_filename = "mpii_human_pose_v1.tar.gz" |
| 1729 | extracted_filename2 = "images" |
| 1730 | if folder_exists(os.path.join(path, extracted_filename2)) is False: |
| 1731 | logging.info("[MPII] (images) {} is nonexistent in {}".format(extracted_filename, path)) |
| 1732 | maybe_download_and_extract(tar_filename, path, url, extract=True) |
| 1733 | del_file(os.path.join(path, tar_filename)) |
| 1734 |
nothing calls this directly
no test coverage detected
searching dependent graphs…