hyperpose.Dataset.mscoco_dataset package

Submodules

hyperpose.Dataset.mscoco_dataset.dataset module

class hyperpose.Dataset.mscoco_dataset.dataset.MSCOCO_dataset(config, input_kpt_cvter=None, output_kpt_cvter=None, dataset_filter=None)

Bases: hyperpose.Dataset.base_dataset.Base_dataset

a dataset class specified for coco dataset, provides uniform APIs

Methods

get_eval_dataset(self[, in_list])

provide uniform tensorflow dataset for evaluating

get_train_dataset(self[, in_list, …])

provide uniform tensorflow dataset for training

official_eval(self, pd_anns[, eval_dir])

providing official evaluation of COCO dataset

prepare_dataset(self)

download,extract, and reformat the dataset the official format is in zip format, extract it into json files and image files.

visualize(self, vis_num)

visualize annotations of the train dataset

generate_eval_data

generate_test_data

generate_train_data

get_colors

get_dataset_type

get_eval_datasize

get_input_kpt_cvter

get_output_kpt_cvter

get_parts

get_test_dataset

get_test_datasize

get_train_datasize

official_test

set_dataset_version

set_input_kpt_cvter

set_output_kpt_cvter

generate_eval_data(self)
generate_test_data(self)
generate_train_data(self)
get_colors(self)
get_dataset_type(self)
get_input_kpt_cvter(self)
get_output_kpt_cvter(self)
get_parts(self)
official_eval(self, pd_anns, eval_dir='./eval_dir')

providing official evaluation of COCO dataset

using pycocotool.cocoeval class to perform official evaluation. output model metrics of MAPs on coco evaluation dataset

Parameters
arg1String

A string path of the json file in the same format of cocoeval annotation file(person_keypoints_val2017.json) which contains predicted results. one can refer the evaluation pipeline of models for generation procedure of this json file.

arg2String

A string path indicates where the json files of filtered intersection part of predict results and ground truth the filtered prediction file is stored in eval_dir/pd_ann.json the filtered ground truth file is stored in eval_dir/gt_ann.json

Returns
None
official_test(self, pd_anns, test_dir='./test_dir')
prepare_dataset(self)

download,extract, and reformat the dataset the official format is in zip format, extract it into json files and image files.

Parameters
None
Returns
None
set_input_kpt_cvter(self, input_kpt_cvter)
set_output_kpt_cvter(self, output_kpt_cvter)
visualize(self, vis_num)

visualize annotations of the train dataset

visualize the annotation points in the image to help understand and check annotation the visualized image will be saved in the “data_vis_dir” of the corresponding model directory(specified by model name). the visualized annotations are from the train dataset.

Parameters
arg1Int

An integer indicates how many images with their annotations are going to be visualized.

Returns
None
hyperpose.Dataset.mscoco_dataset.dataset.init_dataset(config)

hyperpose.Dataset.mscoco_dataset.define module

class hyperpose.Dataset.mscoco_dataset.define.CocoPart(value)

Bases: enum.Enum

An enumeration.

LAnkle = 15
LEar = 3
LElbow = 7
LHip = 11
LKnee = 13
LShoulder = 5
LWrist = 9
Leye = 1
Nose = 0
RAnkle = 16
REar = 4
RElbow = 8
RHip = 12
RKnee = 14
RShoulder = 6
RWrist = 10
Reye = 2
hyperpose.Dataset.mscoco_dataset.define.opps_input_converter(coco_kpts)
hyperpose.Dataset.mscoco_dataset.define.opps_output_converter(kpt_list)
hyperpose.Dataset.mscoco_dataset.define.pifpaf_input_converter(coco_kpts)
hyperpose.Dataset.mscoco_dataset.define.pifpaf_output_converter(kpt_list)
hyperpose.Dataset.mscoco_dataset.define.ppn_input_converter(coco_kpts)
hyperpose.Dataset.mscoco_dataset.define.ppn_output_converter(kpt_list)

hyperpose.Dataset.mscoco_dataset.format module

class hyperpose.Dataset.mscoco_dataset.format.CocoMeta(image_id, img_url, img_meta, kpts_infos, masks, bbxs, is_crowd)

Bases: object

Be used in PoseInfo.

class hyperpose.Dataset.mscoco_dataset.format.PoseInfo(image_base_dir, anno_path, with_mask=True, dataset_filter=None, eval=False)

Bases: object

Use COCO for pose estimation, returns images with people only.

Methods

get_image_annos(self)

Read JSON file, and get and check the image list.

get_bbx_list

get_bbxs

get_image_id_list

get_image_list

get_keypoints

get_kpt_list

get_mask_list

load_images

get_bbx_list(self)
static get_bbxs(annos_info)
get_image_annos(self)

Read JSON file, and get and check the image list. Skip missing images.

get_image_id_list(self)
get_image_list(self)
static get_keypoints(annos_info)
get_kpt_list(self)
get_mask_list(self)
load_images(self)

hyperpose.Dataset.mscoco_dataset.generate module

hyperpose.Dataset.mscoco_dataset.generate.generate_eval_data(val_imgs_path, val_anns_path, dataset_filter=None)
hyperpose.Dataset.mscoco_dataset.generate.generate_test_data(test_imgs_path, test_anns_path)
hyperpose.Dataset.mscoco_dataset.generate.generate_train_data(train_imgs_path, train_anns_path, dataset_filter=None, input_kpt_cvter=<function <lambda> at 0x7f0a853361e0>)

hyperpose.Dataset.mscoco_dataset.prepare module

hyperpose.Dataset.mscoco_dataset.prepare.prepare_dataset(data_path='./data', version='2017', task='person')

Download MSCOCO Dataset. Both 2014 and 2017 dataset have train, validate and test sets, but 2017 version put less data into the validation set (115k train, 5k validate) i.e. has more training data.

Parameters
pathstr

The path that the data is downloaded to, defaults is data/mscoco....

datasetstr

The MSCOCO dataset version, 2014 or 2017.

taskstr

person for pose estimation, caption for image captioning, instance for segmentation.

Returns
train_image_pathstr

Folder path of all training images.

train_ann_pathstr

File path of training annotations.

val_image_pathstr

Folder path of all validating images.

val_ann_pathstr

File path of validating annotations.

test_image_pathstr

Folder path of all testing images.

test_ann_pathNone

File path of testing annotations, but as the test sets of MSCOCO 2014 and 2017 do not have annotation, returns None.

References

Examples

>>> train_im_path, train_ann_path, val_im_path, val_ann_path, _, _ =         ...    tl.files.load_mscoco_dataset('data', '2017')

hyperpose.Dataset.mscoco_dataset.visualize module

Module contents