shihenw / convolutional-pose-machines-release

Code repository for Convolutional Pose Machines, CVPR'16
Other
878 stars 343 forks source link

Speeding up demo.ipynb #43

Open vj-1988 opened 7 years ago

vj-1988 commented 7 years ago

I found that generating a gaussian map (in[12]) consumes around 0.5 seconds. So I did something like this

gaussian_map=np.fromfunction(lambda x_p,y_p: np.exp(-1*((x_p - model['boxsize']/2) * (x_p - model['boxsize']/2) +(y_p - model['boxsize']/2) * (y_p - model['boxsize']/2))/2.0 / model['sigma'] /model['sigma']), (model['boxsize'], model['boxsize']), dtype=int)

This one takes 0.0035 seconds since it avoids nested loops.