環境
Windows10 Pro 64bit (GPUなし) Python 3.6.8
バージョン確認(pip freeze)
certifi==2019.9.11 chardet==3.0.4 cycler==0.10.0 gluoncv==0.5.0 graphviz==0.8.4 idna==2.6 kiwisolver==1.1.0 matplotlib==3.1.1 mxnet==1.5.0 numpy==1.16.5 Pillow==6.2.0 pyparsing==2.4.2 python-dateutil==2.8.0 requests==2.18.4 scipy==1.3.1 six==1.12.0 tqdm==4.36.1 urllib3==1.22
実行スクリプト
from matplotlib import pyplot as plt 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) pose_net = model_zoo.get_model('simple_pose_resnet18_v1b', pretrained=True) detector.reset_class(["person"], reuse_weights=['person']) im_fname = 'golf.jpg' x, img = data.transforms.presets.ssd.load_test(im_fname, 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) img[:]=0 ax = utils.viz.plot_keypoints(img, pred_coords, confidence, class_IDs, bounding_boxs, scores, box_thresh=1.1, keypoint_thresh=0.2) plt.axis('off') plt.show()
結果の表示
感想
自分のスイングチェックには役に立つ?