質問編集履歴
2
説明追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,6 +64,36 @@
|
|
64
64
|
|
65
65
|
```
|
66
66
|
|
67
|
+
pose_detector.pyには、このように書かれています。
|
68
|
+
|
69
|
+
```python
|
70
|
+
if __name__ == '__main__':
|
71
|
+
parser = argparse.ArgumentParser(description='Pose detector')
|
72
|
+
parser.add_argument('arch', choices=params['archs'].keys(), default='posenet', help='Model architecture')
|
73
|
+
parser.add_argument('weights', help='weights file path')
|
74
|
+
parser.add_argument('--img', '-i', default=None, help='image file path')
|
75
|
+
parser.add_argument('--gpu', '-g', type=int, default=-1, help='GPU ID (negative value indicates CPU)')
|
76
|
+
parser.add_argument('--precise', action='store_true', help='do precise inference')
|
77
|
+
args = parser.parse_args()
|
78
|
+
|
79
|
+
chainer.config.enable_backprop = False
|
80
|
+
chainer.config.train = False
|
81
|
+
|
82
|
+
# load model
|
83
|
+
pose_detector = PoseDetector(args.arch, args.weights, device=args.gpu, precise=args.precise)
|
84
|
+
|
85
|
+
# read image
|
86
|
+
img = cv2.imread(args.img)
|
87
|
+
|
88
|
+
# inference
|
89
|
+
poses, _ = pose_detector(img)
|
90
|
+
|
91
|
+
# draw and save image
|
92
|
+
img = draw_person_pose(img, poses)
|
93
|
+
print('Saving result into result.png...')
|
94
|
+
cv2.imwrite('result.png', img)
|
95
|
+
```
|
96
|
+
|
67
97
|
どうすれば、--imgの読み込みができるのでしょうか。
|
68
98
|
ご回答よろしくおねがいします。
|
69
99
|
|
1
タイトル
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
python for文中での%run
|
1
|
+
python for文中での%runを実行するとエラーが出る。
|
body
CHANGED
File without changes
|