una-dinosauria/3d-pose-baseline

openpose: visualization of 3D predictions joint

ShaminiKoravuna opened this issue · 19 comments

Hello everyone,

I'm trying to execute the following command for getting the 3D pose output:

python src/openpose_3dpose_sandbox.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise --use_sh --epochs 200 --load 4874200 --pose_estimation_json output/ --write_gif --gif_fps 24

But am getting the following error

experiments\All\dropout_0.5\epochs_200\lr_0.001\residual\depth_2\linear_size1024\batch_size_64\no_procrustes\maxnorm\batch_normalization\use_stacked_hourglass\predict_17
A subdirectory or file -p already exists.
Error occurred while processing: -p.
A subdirectory or file experiments\All\dropout_0.5\epochs_200\lr_0.001\residual\depth_2\linear_size1024\batch_size_64\no_procrustes\maxnorm\batch_normalization\use_stacked_hourglass\predict_17\log already exists.
Error occurred while processing: experiments\All\dropout_0.5\epochs_200\lr_0.001\residual\depth_2\linear_size1024\batch_size_64\no_procrustes\maxnorm\batch_normalization\use_stacked_hourglass\predict_17\log.
INFO:__main__:start reading json files
Traceback (most recent call last):
 File "src/openpose_3dpose_sandbox.py", line 415, in <module>
   tf.app.run()
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
   _sys.exit(main(argv))
 File "src/openpose_3dpose_sandbox.py", line 232, in main
   smoothed = read_openpose_json()
 File "src/openpose_3dpose_sandbox.py", line 131, in read_openpose_json
   drop_curves_plot.savefig(pngName)
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\pyplot.py", line 689, in savefig
   res = fig.savefig(*args, **kwargs)
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\figure.py", line 2094, in savefig
   self.canvas.print_figure(fname, **kwargs)
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\backend_bases.py", line 2075, in print_figure
   **kwargs)
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\backends\backend_agg.py", line 521, in print_png
   cbook.open_file_cm(filename_or_obj, "wb") as fh:
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\contextlib.py", line 81, in __enter__
   return next(self.gen)
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\cbook\__init__.py", line 407, in open_file_cm
fh, opened = to_filehandle(path_or_file, mode, True, encoding)
 File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\cbook\__init__.py", line 392, in to_filehandle
   fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'gif_output/dirty_plot.png'
  1. Operating system: Windows 10
  2. TensorFlow version: 1.13.1
  3. Python version:3.6.5

Can anyone help me out with this?

Thanks in advance

You'll have to create the folder gif_output in the parent 3d-baseline directory before running the command

yeah thank you

I'm trying to print the 3d key joint values it is showing a 24x4 matrix. which columns represent the x, y & z coordinates? and what does that extra column represent?

Code:
```

Plot 3d predictions

        ax = plt.subplot(gs1[subplot_idx - 1], projection='3d')
        ax.view_init(18, -70)
        logger.debug(np.min(poses3d))
        if np.min(poses3d) < -1000:
            poses3d = before_pose

        p3d = poses3d
        logger.debug(poses3d)
        viz.show3Dpose(p3d, ax, lcolor="#9b59b6", rcolor="#2ecc71")
        **print(p3d)**
        pngName = '{}_keypoints.png'.format(str(frame))
        plt.savefig(pngName)
        if FLAGS.write_gif:
            png_lib.append(imageio.imread(pngName))
        before_pose = poses3d
can anyone help?
Thanks in Advance

That doesn't look like a matrix to me; it's probably a vector with some breakpoints in the terminal.

Use the show3dpose function under the viz folder to visualize this.

thanks a lot for the quick response. How can I display the x, y, z-axes of the keyjoints?

Like I said, use our function:

def show3Dpose(channels, ax, lcolor="#3498db", rcolor="#e74c3c", add_labels=False): # blue, orange

I'm trying out this :

result = viz.show3Dpose(p3d, ax)
print(result)

but it is not showing any axes of the key joints.

2019-04-26 22:30:14.135689: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library cublas64_100.dll locally
None
INFO:__main__:calc frame 1168/10
None
INFO:__main__:calc frame 1169/10
None
INFO:__main__:calc frame 1170/10
None
INFO:__main__:calc frame 1171/10
None
INFO:__main__:calc frame 1172/10
None
INFO:__main__:calc frame 1173/10
None
INFO:__main__:calc frame 1174/10
None
INFO:__main__:calc frame 1175/10
None
INFO:__main__:calc frame 1176/10
None
INFO:__main__:creating Gif gif_output/animation.gif, please Wait!
INFO:__main__:Done!
  1. Based on the output that you are showing, it seems like you are using code from another repo.
  2. I cannot support code from other repos -- this is a research repo, whose goal is to reproduce scientific results; which is already a lot of work. I'm adding the help wanted tag in case someone else can step in to help you.
  3. That being said, it seems like your code is outputting something to gif_output/animation.gif. You may want to check that folder.

Thanks a lot for the tagline. I'm using the code from here https://github.com/ArashHosseini/3d-pose-baseline (ArashHosseinin's 3D pose baseline fork) I have made slight changes in the code according to the output which I was looking for and in gif_output/animation.gif it is showing all the 3D frames in gif format.

sorry for the trouble I got it now. As there 96 values in the vector these values correspond to x, y, z values of the 32 key joints i.e., 32*3=96 I tried plotting it in 3D matplotlib if was showing all the key joints. Thanks a lot for you help.

sorry for the trouble I got it now. As there 96 values in the vector these values correspond to x, y, z values of the 32 key joints i.e., 32*3=96 I tried plotting it in 3D matplotlib if was showing all the key joints. Thanks a lot for you help.

Could you provide the code you used to plot this in 3d matplotlib?

It is a simple python code using matplotlib. I have used the information from one of the images for checking it.

from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x= [ 0.00000000e+00, 1.30188278e+02,  1.64277085e+02,  3.36501706e+02,1.96770239e+01, -1.98503357e+01, -1.30720719e+02, -2.87925389e+02, -2.47418471e+02,-1.90307759e+01, -1.89423771e+01,2.16841217e-03,-1.61042845e+01,-2.34661292e+01, -5.41150825e+01, -4.91135209e+01, 1.05470163e+01, -1.46048975e+02,-2.13717278e+02, -1.22403050e+02,3.08515285e+00,3.70817421e+00, 2.63636041e+00 , 2.63636041e+00,1.05470163e+01, 1.08321570e+02, 2.17129012e+02, 4.58723357e+01,2.67768816e+00, 3.59443868e+00, 2.34730200e+00,2.34730200e+00]
y= [0.00000000e+00, 2.21986779e+01, 2.52096679e+02, -6.42890553e+00, 3.30486138e+00, 3.06663179e+00,-2.45572063e+01,2.04953112e+02,-1.43192625e+02, 2.32261310e+00,1.95059831e+00, -4.33307097e-04, 3.76801909e+01,1.22121575e+02, 2.09397916e+02, 1.72502659e+02,-2.42756581e+00, 8.56258206e+01,8.94572573e+01, 2.89263473e+02, -1.93617082e+00, -2.01886790e+00, -2.09002162e+00,-2.09002162e+00, -2.42756581e+00,1.25432511e+02,1.38619899e+02,2.98959920e+02,-9.84540951e-01, -1.21193105e+00, -1.14707478e+00,-1.14707478e+00]
z= [0.00000000e+00, 6.78266409e+00, -3.51739862e+02,-5.49785345e+02,-7.60418528e+02 , -7.54878736e+02, -1.08603812e+01,-3.11501338e+02,-5.82948171e+02, -7.66807681e+02, -7.54258818e+02,8.81305028e-02,2.28206654e+02,  4.56774955e+02,5.34880094e+02,6.39409914e+02,4.45827562e+02,4.00281897e+02 ,1.38059257e+02,1.05949419e+02,1.23399810e+02,1.55761093e+02, 1.10753042e+02,1.10753042e+02,4.45827562e+02, 3.92289210e+02,1.31398055e+02, 7.07938187e+01, 1.72737912e+02, 2.05771724e+02,1.69889177e+02, 1.69889177e+02]

ax.scatter(x, y, z, c='b', marker='o')
#ax.plot(x, y, z, '-r')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')

plt.show()

Thank you! In what format are the x y and w being displayed in the output of the terminal? is it [x1,y1,z1,x2,y2,z2,...] for each frame?

@ShaminiKoravuna
if i understand correctly from your screen shot , of 1x96 vector, you split the vector 32 indices each for getting x,y,z co -ordinates is it ?
For example

p3d[0] , p3d[1] , ........p3d[31] -->X 
p3d[32],.p3e[33] , ...... p3d[61] -->Y 
p3d[62], ...... p3d[95]--> Z

sorry for the trouble I got it now. As there 96 values in the vector these values correspond to x, y, z values of the 32 key joints i.e., 32*3=96 I tried plotting it in 3D matplotlib if was showing all the key joints. Thanks a lot for you help.

Maybe i am wrong , i get the following for a frame , printing all_poses_3d which returns a list

`[array([[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
        -5.41511240e+01, -2.30953821e+01, -1.74871288e+01,
        -4.91000564e+01,  2.44382720e+02,  1.71213983e+02,
        -1.54755310e+02,  5.97881714e+02,  3.52366218e+02,
        -1.15560633e+01,  7.42149725e+02,  1.66477287e+02,
        -1.18447102e+01,  7.36763064e+02,  1.65182437e+02,
         5.41502771e+01,  2.30950820e+01,  1.74870470e+01,
        -1.71258190e+01,  3.26592894e+02,  2.03220778e+02,
        -1.41130065e+02,  7.04033786e+02,  3.84201614e+02,
        -1.12642400e+01,  7.48636864e+02,  1.66665977e+02,
        -1.14090840e+01,  7.36435064e+02,  1.63713810e+02,
         1.21660845e-03, -8.60110629e-02, -1.93000576e-02,
         1.57141460e+01, -2.34399996e+02, -2.86722926e+01,
         5.28252697e+01, -4.40469167e+02, -1.11653705e+02,
         1.03085631e+02, -5.01280352e+02, -1.93111585e+02,
         7.16011844e+01, -5.88214725e+02, -2.18615940e+02,
         5.67537804e+00, -4.35088906e+02, -9.76974016e+01,
         7.71909591e+01, -3.88738749e+02, -6.29099586e+01,
        -2.99970496e+01, -2.25985794e+02,  6.41590789e+01,
         1.03847001e+02, -7.32419021e+01,  1.04802558e+02,
         1.26585822e+00, -1.20170579e+02, -2.82526049e+01,
         1.57900698e+00, -1.51780249e+02, -3.52080548e+01,
         8.84543993e-01, -1.07795356e+02, -2.56307189e+01,
         8.84543993e-01, -1.07795356e+02, -2.56307189e+01,
         5.67537804e+00, -4.35088906e+02, -9.76974016e+01,
         8.01141013e+00, -4.16078607e+02, -1.25355227e+02,
         1.17740492e+00, -2.55151916e+02, -7.20503620e+01,
        -1.73992688e+01, -2.44854505e+02, -9.25408725e+01,
         8.70569014e-01, -1.68664569e+02, -3.73902498e+01,
         1.39982512e+00, -2.00884252e+02, -4.47207875e+01,
         5.24591115e-01, -1.65867774e+02, -3.68342864e+01,
         5.24591115e-01, -1.65867774e+02, -3.68342864e+01]])]

which i think gives x,y,z co ordinates for all 32 keypoints. However i have not plotted it yet
`

``

@timtensor hello ,
Can you tell me how these 32 points correspond to joint points?

@AndroidUnityGit i think i am wrong in that , i found out that this is the joint order

facebookresearch/VideoPose3D#57 (comment)

@timtensor Thanks for your reply.
After reading the link you gave, there are still some problems, The link only say 17 joints,but our datas have 32*3 ,It doesn't correspond at all. so You mean, are we getting the data wrong or something?

lets continue here #154 , thx

yeah thank you

Hello, did you solve the problem? I have exactly the same problem. Even after I create the folder named gif_output in the folder named 3d-pose-baseline. Can you help me?