-
大小: 105KB文件类型: .zip金币: 2下载: 1 次发布日期: 2021-06-17
- 语言: Python
- 标签:
资源简介
人体姿势估计和跟踪的简单基线的TensorFlow实现
代码片段和文件信息
#!/usr/bin/python3
# coding=utf-8
import os
import os.path as osp
import numpy as np
import cv2
import json
import pickle
import matplotlib.pyplot as plt
import sys
cur_dir = os.path.dirname(__file__)
sys.path.insert(0 osp.join(cur_dir ‘PythonAPI‘))
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
class Dataset(object):
dataset_name = ‘COCO‘
num_kps = 17
kps_names = [‘nose‘ ‘l_eye‘ ‘r_eye‘ ‘l_ear‘ ‘r_ear‘ ‘l_shoulder‘
‘r_shoulder‘ ‘l_elbow‘ ‘r_elbow‘ ‘l_wrist‘ ‘r_wrist‘
‘l_hip‘ ‘r_hip‘ ‘l_knee‘ ‘r_knee‘ ‘l_ankle‘ ‘r_ankle‘]
kps_symmetry = [(1 2) (3 4) (5 6) (7 8) (9 10) (11 12) (13 14) (15 16)]
kps_lines = [(1 2) (0 1) (0 2) (2 4) (1 3) (6 8) (8 10) (5 7) (7 9) (12 14) (14 16) (11 13) (13 15) (5 6) (11 12)]
human_det_path = osp.join(‘..‘ ‘data‘ dataset_name ‘dets‘ ‘human_detection.json‘) # human detection result
img_path = osp.join(‘..‘ ‘data‘ dataset_name ‘images‘)
train_annot_path = osp.join(‘..‘ ‘data‘ dataset_name ‘annotations‘ ‘person_keypoints_train2017.json‘)
val_annot_path = osp.join(‘..‘ ‘data‘ dataset_name ‘annotations‘ ‘person_keypoints_val2017.json‘)
test_annot_path = osp.join(‘..‘ ‘data‘ dataset_name ‘annotations‘ ‘image_info_test-dev2017.json‘)
def load_train_data(self score=False):
coco = COCO(self.train_annot_path)
train_data = []
for aid in coco.anns.keys():
ann = coco.anns[aid]
imgname = ‘train2017/‘ + coco.imgs[ann[‘image_id‘]][‘file_name‘]
joints = ann[‘keypoints‘]
if (ann[‘image_id‘] not in coco.imgs) or ann[‘iscrowd‘] or (np.sum(joints[2::3]) == 0) or (ann[‘num_keypoints‘] == 0):
continue
# sanitize bboxes
x y w h = ann[‘bbox‘]
img = coco.loadImgs(ann[‘image_id‘])[0]
width height = img[‘width‘] img[‘height‘]
x1 = np.max((0 x))
y1 = np.max((0 y))
x2 = np.min((width - 1 x1 + np.max((0 w - 1))))
y2 = np.min((height - 1 y1 + np.max((0 h - 1))))
if ann[‘area‘] > 0 and x2 >= x1 and y2 >= y1:
bbox = [x1 y1 x2-x1 y2-y1]
else:
continue
if score:
data = dict(image_id = ann[‘image_id‘] imgpath = imgname bbox=bbox joints=joints score=1)
else:
data = dict(image_id = ann[‘image_id‘] imgpath = imgname bbox=bbox joints=joints)
train_data.append(data)
return train_data
def load_val_data_with_annot(self):
coco = COCO(self.val_annot_path)
val_data = []
for aid in coco.anns.keys():
ann = coco.anns[aid]
if ann[‘image_id‘] not in coco.imgs:
continue
imgname = ‘val2017/‘ + coco.imgs[ann[‘image_id‘]][‘file_name‘]
bbox = ann[‘b
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\
文件 70 2019-07-22 16:13 TF-SimpleHumanPose-master\.gitignore
文件 10132 2019-07-22 16:13 TF-SimpleHumanPose-master\README.md
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\data\
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\data\COCO\
文件 6794 2019-07-22 16:13 TF-SimpleHumanPose-master\data\COCO\dataset.py
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\data\MPII\
文件 4596 2019-07-22 16:13 TF-SimpleHumanPose-master\data\MPII\dataset.py
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\data\PoseTrack\
文件 7295 2019-07-22 16:13 TF-SimpleHumanPose-master\data\PoseTrack\dataset.py
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\
文件 110 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\Makefile
文件 26 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\__init__.py
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nets\
文件 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nets\__init__.py
文件 8001 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nets\ba
文件 11902 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nets\resnet_utils.py
文件 13646 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nets\resnet_v1.py
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\
文件 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\__init__.py
文件 2305 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\cpu_nms.pyx
文件 146 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\gpu_nms.hpp
文件 1179 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\gpu_nms.pyx
文件 3338 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\nms.py
文件 5062 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\nms_kernel.cu
文件 5184 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\nms\setup.py
目录 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\tfflat\
文件 0 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\tfflat\__init__.py
文件 17243 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\tfflat\ba
文件 12741 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\tfflat\data_provider.py
文件 1035 2019-07-22 16:13 TF-SimpleHumanPose-master\lib\tfflat\dpflow.py
............此处省略25个文件信息
相关资源
- Python-DeepMoji模型的pyTorch实现
- Python-使用DeepFakes实现YouTube视频自动换
- Python-一系列高品质的动漫人脸数据集
- Python-Insightface人脸检测识别的最小化
- Python-自然场景文本检测PSENet的一个
- Python-在特征金字塔网络FPN的Pytorch实现
- Python-PyTorch实时多人姿态估计项目的实
- Python-用PyTorch10实现FasterRCNN和MaskRCNN比
- Python-心脏核磁共振MRI图像分割
- Python-基于YOLOv3的行人检测
- Python-RLSeq2Seq用于SequencetoSequence模型的
- Python-PyTorch对卷积CRF的参考实现
- Python-高效准确的EAST文本检测器的一个
- Python-pytorch实现的人脸检测和人脸识别
- Python-UNet用于医学图像分割的嵌套UN
- Python-TensorFlow弱监督图像分割
- Python-基于tensorflow实现的用textcnn方法
- Python-Keras实现Inceptionv4InceptionResnetv1和
- Python-pytorch中文手册
- Python-FastSCNN的PyTorch实现快速语义分割
- Python-滑动窗口高分辨率显微镜图像分
- Python-使用MovieLens数据集训练的电影推
- Python-机器学习驱动的Web应用程序防火
- Python-subpixel利用Tensorflow的一个子像素
-
Python-汉字的神经风格转移Neuralst
y - Python-神经网络模型能够从音频演讲中
- Python-深度增强学习算法的PyTorch实现策
- Python-基于深度学习的语音增强使用
- Python-基于知识图谱的红楼梦人物关系
- Python-STGAN用于图像合成的空间变换生
评论
共有 条评论