diff --git a/README.md b/README.md index 8f43b2c..9e3dfc0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This is the authors' implementation of [Unsupervised Adversarial Learning of 3D * pose_iter_440000.caffemodel * http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/coco/pose_iter_440000.caffemodel 2. Run Inference - * ` python bin/demo.py sample/image.png --lift_model sample/gen_epoch_500.npz --model2d pose_iter_440000.caffemodel --proto2d openpose_pose_coco.prototxt` + * ` python bin/demo.py sample/image.png --lift_model sample/gen_epoch_6.npz --model2d pose_iter_440000.caffemodel --proto2d openpose_pose_coco.prototxt` * **Need OpenCV >= 3.4** * < 3.3 results extreamly wrong estimation @@ -23,10 +23,11 @@ This is the authors' implementation of [Unsupervised Adversarial Learning of 3D - Python 3.6.5 - Cupy 4.0.0 - Chainer 4.0.0 - - OpenCV 3.4 (when showing results) + - OpenCV 3.4 (only for demo) + - Note: OpenPose in OpenCV via pip (e.g. `pip install opencv-python`) does not work correctly. Plese build your OpenCV or use a conda package (`conda install -c conda-forge opencv` on [Anaconda3-4.4.0](https://repo.continuum.io/archive/) works fine for our environment.). - git-lfs - to download pre-trained model - - or you can download pre-trained model directory from [https://github.com/DwangoMediaVillage/3dpose_gan/blob/master/sample/gen_epoch_500.npz?raw=true](https://github.com/DwangoMediaVillage/3dpose_gan/blob/master/sample/gen_epoch_500.npz?raw=true) + - or you can download pre-trained model directory from [https://github.com/DwangoMediaVillage/3dpose_gan/blob/master/sample/gen_epoch_6.npz?raw=true](https://github.com/DwangoMediaVillage/3dpose_gan/blob/master/sample/gen_epoch_6.npz?raw=true) ## Training #### Human3.6M dataset diff --git a/bin/demo.py b/bin/demo.py index a3bff6b..4eece53 100644 --- a/bin/demo.py +++ b/bin/demo.py @@ -161,10 +161,15 @@ def main(args): if not hasFrame: exit(0) points = OpenPose(args).predict(args, frame) - points = [vec for vec in points] + + if None in points: + n_detect_key_points = sum([vec is not None for vec in points]) + raise Exception('OpenPose could not detect enough key points. ' + '{}/{} points were detected. Try another image.'.format(n_detect_key_points, len(points))) points = [np.array(vec) for vec in points] BODY_PARTS, POSE_PAIRS = parts(args) - points = to36M(points, BODY_PARTS) + + points = to36M(points, BODY_PARTS) # 19 points -> 17 points points = np.reshape(points, [1, -1]).astype('f') points_norm = projection_gan.pose.dataset.pose_dataset.pose_dataset_base.Normalization.normalize_2d(points) pose = create_pose(model, points_norm) @@ -177,6 +182,7 @@ def main(args): for d in range(0, 360 + deg, deg): img = evaluation_util.create_projection_img(pose, np.pi * d / 180.) cv.imwrite(os.path.join(out_directory, "rot_{:03d}_degree.png".format(d)), img) + print("Saved result images in '{}'.".format(os.path.join(os.getcwd(), out_directory))) if __name__ == '__main__': diff --git a/sample/gen_epoch_500.npz b/sample/gen_epoch_500.npz deleted file mode 100644 index 536d357..0000000 --- a/sample/gen_epoch_500.npz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3f4eec394542546e00e8ba6cfec73ae83396b1316144fd75b9cd0008759934c8 -size 8611258 diff --git a/sample/gen_epoch_6.npz b/sample/gen_epoch_6.npz new file mode 100644 index 0000000..b26dccc --- /dev/null +++ b/sample/gen_epoch_6.npz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38b96fa462bad522f212de2e132632a864677e0f9fc775ef2d16f6da069af724 +size 8007843