fabro66 / GAST-Net-3DPoseEstimation

A Graph Attention Spatio-temporal Convolutional Networks for 3D Human Pose Estimation in Video (GAST-Net)
MIT License
313 stars 70 forks source link

NotImplementedError: It is not currently possible to manually set the aspect on 3D axes #16

Closed yerzhan7orazayev closed 3 years ago

yerzhan7orazayev commented 3 years ago

Dear @fabro66,

I am encountering the following error. Could you please fix it? Thanks.

python gen_skes.py -v baseball.mp4 -np 1 --animation
Loading YOLOv3 network.....
YOLOv3 network successfully loaded
Loading HRNet model ...
HRNet network successfully loaded
Generating 2D pose ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 277/277 [00:28<00:00,  9.77it/s]
Loading GAST-Net ...
/home/orazayy/GAST-Net-3DPoseEstimation-inference/model/local_attention.py:25: UserWarning: This overload of nonzero is deprecated:
        nonzero()
Consider using one of the following signatures instead:
        nonzero(*, bool as_tuple) (Triggered internally at  /opt/conda/conda-bld/pytorch_1603729096996/work/torch/csrc/utils/python_arg_parser.cpp:882.)
  self.e = nn.Parameter(torch.zeros(out_features, len(self.m[0].nonzero()), dtype=torch.float))
GAST-Net successfully loaded
Generating 3D human pose ...
Generating animation ...
Traceback (most recent call last):
  File "gen_skes.py", line 179, in <module>
    generate_skeletons(video=video_path, output_animation=args.animation, num_person=args.num_person)
  File "gen_skes.py", line 153, in generate_skeletons
    render_animation(re_kpts, keypoints_metadata, anim_output, skeleton, 25, 30000, np.array(70., dtype=np.float32),
  File "/home/orazayy/GAST-Net-3DPoseEstimation-inference/tools/vis_h36m.py", line 111, in render_animation
    ax.set_aspect('equal')
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 1280, in set_aspect
    raise NotImplementedError(
NotImplementedError: It is not currently possible to manually set the aspect on 3D axes
yerzhan7orazayev commented 3 years ago

Is this a problem due to my libraries?

guerrifrancesco commented 3 years ago

edit vis_h36m.py and substitute ax.set_aspect('equal') with ax.set_aspect('auto') or downgrade your matplotlib version

yerzhan7orazayev commented 3 years ago

I tried both. When I changed to 'auto' I got the following error:

Generating animation ...
ffprobe: /sw/csgv/machine_learning/2019.02/el7_cudnn7.6_cuda10.0_py3.7_anaconda3env/lib/./libuuid.so.1: no version information available (required by /lib64/libSM.so.6)
ffmpeg: /sw/csgv/machine_learning/2019.02/el7_cudnn7.6_cuda10.0_py3.7_anaconda3env/lib/./libuuid.so.1: no version information available (required by /lib64/libSM.so.6)
ffmpeg version 3.4.7 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --disable-encoder=libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/orazayy/GAST-Net-3DPoseEstimation-inference/data/video/baseball.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:12.01, start: 0.008005, bitrate: 3798 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 3807 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, image2pipe, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    Stream #0:0(und): Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1193200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.107.100 rawvideo
frame=   31 fps=0.0 q=-0.0 size=  188325kB time=00:00:01.79 bitrate=860214.4kbits/s speed=3.53x   frame=   79 fps= 78 q=-0.0 size=  479925kB time=00:00:03.79 bitrate=1035855.4kbits/s speed=3.76x  frame=  137 fps= 90 q=-0.0 size=  832275kB time=00:00:06.21 bitrate=1097103.7kbits/s speed= 4.1x  frame=  193 fps= 96 q=-0.0 size= 1172475kB time=00:00:08.55 bitrate=1123354.6kbits/s speed=4.24x  frame=  252 fps=100 q=-0.0 size= 1530900kB time=00:00:11.01 bitrate=1138964.0kbits/s speed=4.37x  frame=  277 fps=101 q=-0.0 Lsize= 1682775kB time=00:00:12.09 bitrate=1139712.1kbits/s speed=4.43x    
video:1682775kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
/home/orazayy/GAST-Net-3DPoseEstimation-inference/tools/vis_h36m.py:238: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations. 
  fig.tight_layout()
MovieWriter stderr:
ffmpeg: /sw/csgv/machine_learning/2019.02/el7_cudnn7.6_cuda10.0_py3.7_anaconda3env/lib/./libuuid.so.1: no version information available (required by /lib64/libSM.so.6)
./output/animation_baseball.mp4: No such file or directory

Traceback (most recent call last):
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 251, in saving
    yield self
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 1141, in save
    anim._draw_next_frame(d, blit=False)
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 1176, in _draw_next_frame
    self._draw_frame(framedata)
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 1726, in _draw_frame
    self._drawn_artists = self._func(framedata, *self._args)
  File "/home/orazayy/GAST-Net-3DPoseEstimation-inference/tools/vis_h36m.py", line 232, in update_video
    lines_3d[n][j - 1][0].set_3d_properties([pos[j, 2], pos[j_parent, 2]], zdir='z')
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/mpl_toolkits/mplot3d/art3d.py", line 143, in set_3d_properties
    zs = np.broadcast_to(zs, xs.shape)
AttributeError: 'list' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gen_skes.py", line 179, in <module>
    generate_skeletons(video=video_path, output_animation=args.animation, num_person=args.num_person)
  File "gen_skes.py", line 153, in generate_skeletons
    render_animation(re_kpts, keypoints_metadata, anim_output, skeleton, 25, 30000, np.array(70., dtype=np.float32),
  File "/home/orazayy/GAST-Net-3DPoseEstimation-inference/tools/vis_h36m.py", line 244, in render_animation
    anim.save(output, writer=writer)
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 1145, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 253, in saving
    self.finish()
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 354, in finish
    self.cleanup()
  File "/home/orazayy/.conda/envs/wudu/lib/python3.8/site-packages/matplotlib/animation.py", line 390, in cleanup
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1000x500', '-pix_fmt', 'rgba', '-r', '25', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '30000k', '-y', './output/animation_baseball.mp4']' returned non-zero exit status 1.
yerzhan7orazayev commented 3 years ago

@fabro66 or @rirri93,

Could you please share the required versions of all necessary packages under one file, i.e., requirements.txt? I think I messed up with the package versions. Thanks.

guerrifrancesco commented 3 years ago

Downgrade matplotlib then. Search on pypi a version made in the first quartier of 2019

yerzhan7orazayev commented 3 years ago

I have downgraded the matplotlib version to 3.0.3. But the following error is arised:

Traceback (most recent call last): File "gen_skes.py", line 179, in <module> generate_skeletons(video=video_path, output_animation=args.animation, num_person=args.num_person) File "gen_skes.py", line 154, in generate_skeletons viz_output, input_video_path=video, viewport=(width, height), com_reconstrcution=same_coord) File "/content/drive/My Drive/Inference/tools/vis_h36m.py", line 244, in render_animation anim.save(output, writer=writer) File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 1174, in save writer.grab_frame(**savefig_kwargs) File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__ self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 232, in saving self.finish() File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 358, in finish self.cleanup() File "/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py", line 395, in cleanup out, err = self._proc.communicate() File "/usr/lib/python3.6/subprocess.py", line 863, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "/usr/lib/python3.6/subprocess.py", line 1525, in _communicate selector.register(self.stdout, selectors.EVENT_READ) File "/usr/lib/python3.6/selectors.py", line 351, in register key = super().register(fileobj, events, data) File "/usr/lib/python3.6/selectors.py", line 237, in register key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data) File "/usr/lib/python3.6/selectors.py", line 224, in _fileobj_lookup return _fileobj_to_fd(fileobj) File "/usr/lib/python3.6/selectors.py", line 39, in _fileobj_to_fd "{!r}".format(fileobj)) from None ValueError: Invalid file object: <_io.BufferedReader name=28>

guerrifrancesco commented 3 years ago

This is my pip freeze output:

cached-property==1.5.2
cycler==0.10.0
dataclasses==0.8
decorator==4.4.2
ffmpeg==1.4
ffprobe-python==1.0.3
filterpy==1.4.5
future==0.18.2
h5py==3.1.0
imageio==2.9.0
kiwisolver==1.3.1
llvmlite==0.34.0
matplotlib==3.1.0
networkx==2.5
numba==0.51.2
numpy==1.19.4
opencv-python==4.4.0.46
Pillow==8.0.1
pkg-resources==0.0.0
pyparsing==2.4.7
python-dateutil==2.8.1
PyWavelets==1.1.1
PyYAML==5.3.1
scikit-image==0.17.2
scipy==1.5.4
six==1.15.0
tifffile==2020.9.3
torch==1.7.0
torchsummary==1.5.1
torchvision==0.8.1
tqdm==4.52.0
typing-extensions==3.7.4.3
yacs==0.1.8
yerzhan7orazayev commented 3 years ago

@rirri93 many thanks! It now works with your library versions. I really appreciate it.