Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error message, etc. #10

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ 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

## Dependencies(Recommended versions)
- 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
Expand Down
10 changes: 8 additions & 2 deletions bin/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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__':
Expand Down
3 changes: 0 additions & 3 deletions sample/gen_epoch_500.npz

This file was deleted.

3 changes: 3 additions & 0 deletions sample/gen_epoch_6.npz
Git LFS file not shown