Commit e5153942 authored by Yuxin Wu's avatar Yuxin Wu

update demo

parent 06169124
# Convolutional Pose Machines
A script to load and run pretrained CPM model released by Shih-En. The original code in caffe is [here](https://github.com/shihenw/convolutional-pose-machines-release).
A script to load and run pre-trained CPM model released by Shih-En. The original code in caffe is [here](https://github.com/shihenw/convolutional-pose-machines-release).
## Usage:
Prepare the model:
```
# download the relased caffe model:
# download the released caffe model:
wget http://pearl.vasc.ri.cmu.edu/caffe_model_github/model/_trained_MPI/pose_iter_320000.caffemodel
wget https://github.com/shihenw/convolutional-pose-machines-release/raw/master/model/_trained_MPI/pose_deploy_resize.prototxt
# convert the model to a dict:
python -m tensorpack.utils.loadcaffe pose_deploy_resize.prototxt pose_iter_320000.caffemodel CPM-original.npy
# run it on a test image, and produce output.jpg
```
Or you can download the converted model from [model zoo](https://drive.google.com/open?id=0B9IPQTvr2BBkRU8zM2w2ZGh3eU0)
Run it on an image, and produce `output.jpg`:
```
python load-cpm.py --load CPM-original.npy --input test.jpg
```
Input image will get resized to 368x368. Note that this CPM comes without person detection, so the
person has to be in the center of the image (and not too small).
![demo](demo.jpg)
For a real-time CPM application in tensorpack, check out [Stereo Pose Machines](https://github.com/ppwwyyxx/Stereo-Pose-Machines).
......@@ -4,18 +4,14 @@
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import cv2
import tqdm
import tensorflow as tf
import numpy as np
import os, argparse
import matplotlib.pyplot as plt
import argparse
from tensorpack import *
from tensorpack.utils.argtools import memoized
from tensorpack.tfutils.symbolic_functions import *
from tensorpack.tfutils.summary import *
from tensorpack.dataflow.dataset import ILSVRCMeta
import matplotlib.pyplot as plt
_CM = plt.get_cmap('jet')
def colorize(img, heatmap):
""" img: bgr, [0,255]
......@@ -105,6 +101,7 @@ def run_test(model_path, img_file):
))
im = cv2.imread(img_file, cv2.IMREAD_COLOR).astype('float32')
im = cv2.resize(im, (368,368))
out = predict_func([[im]])[0][0]
hm = out[:,:,:14].sum(axis=2)
viz = colorize(im, hm)
......
......@@ -12,7 +12,8 @@ Training examples with __reproducible__ and meaningful performance.
+ [InceptionV3 with 74% accuracy (similar to the official code)](Inception/inceptionv3.py)
+ [Fully-convolutional Network for Holistically-Nested Edge Detection(HED)](HED)
+ [Spatial Transformer Networks on MNIST addition](SpatialTransformer)
+ Load a pretrained [AlexNet](load-alexnet.py) or [VGG16](load-vgg16.py) model.
+ Load a pre-trained [AlexNet](load-alexnet.py) or [VGG16](load-vgg16.py) model.
+ Load a pre-trained [Convolutional Pose Machines](ConvolutionalPoseMachines/).
## Reinforcement Learning:
+ [Deep Q-Network(DQN) variants on Atari games](Atari2600)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment