ValueError in Inference
ChawDoe opened this issue · 8 comments
When I ran the inference script:
python videopose-j16-wild-eval_run.py
I got folloing errors. Could you help me?
-------------- prepare video clip spends 0.03 seconds
-------------- load keypoint spends 0.05 seconds
Loading checkpoint ./checkpoint/ckpt_ep_045.bin
-------------- load 3D model spends 3.81 seconds
-------------- generate reconstruction 3D data spends 0.53 seconds
Loading checkpoint ./checkpoint/ckpt_ep_045.bin
-------------- load 3D Traj model spends 0.16 seconds
-------------- generate reconstruction 3D data spends 0.02 seconds
Rendering... save to ./wild_eval/333_scale2D_010/bilibili-clip/kunkun_clip_alpha_pose.mp4
===========================> This video get 49 frames in total.
2%|##2 | 1/49 [00:00<00:10, 4.57it/s]Traceback (most recent call last):
File "videopose-j16-wild-eval_run.py", line 288, in <module>
Vis.redering()
File "videopose-j16-wild-eval_run.py", line 44, in redering
self.visalizatoin(anim_output)
File "videopose-j16-wild-eval_run.py", line 232, in visalizatoin
input_video_skip=args.viz_skip)
File "/mnt/zhoudeyu/project/save_video/dengyuanzhang/posetriplet/PoseTriplet-main/estimator_inference/common/visualization.py", line 195, in render_animation
anim.save(output, writer=writer)
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 1174, in save
writer.grab_frame(**savefig_kwargs)
File "/root/miniconda3/envs/alphapose/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 232, in saving
self.finish()
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 358, in finish
self.cleanup()
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 395, in cleanup
out, err = self._proc.communicate()
File "/root/miniconda3/envs/alphapose/lib/python3.6/subprocess.py", line 863, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/root/miniconda3/envs/alphapose/lib/python3.6/subprocess.py", line 1525, in _communicate
selector.register(self.stdout, selectors.EVENT_READ)
File "/root/miniconda3/envs/alphapose/lib/python3.6/selectors.py", line 351, in register
key = super().register(fileobj, events, data)
File "/root/miniconda3/envs/alphapose/lib/python3.6/selectors.py", line 237, in register
key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
File "/root/miniconda3/envs/alphapose/lib/python3.6/selectors.py", line 224, in _fileobj_lookup
return _fileobj_to_fd(fileobj)
File "/root/miniconda3/envs/alphapose/lib/python3.6/selectors.py", line 39, in _fileobj_to_fd
"{!r}".format(fileobj)) from None
ValueError: Invalid file object: <_io.BufferedReader name=30>
6%|######6 | 3/49 [00:00<00:07, 5.99it/s]
Hi, thank you for the interest!
This might be the issue of matplotlib dependency version. I have upload a requirement file for you to check.
Can you check and try this matplotlib version ?
It seems that I did not install ffmpeg correctly.
PoseTriplet-main/estimator_inference/common/visualization.py:191: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.
fig.tight_layout()
2%|###2 | 1/49 [00:00<00:19, 2.48it/s]MovieWriter stderr:
Unknown encoder 'h264'
Traceback (most recent call last):
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 251, in saving
yield self
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 1157, in save
anim._draw_next_frame(d, blit=False)
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 1192, in _draw_next_frame
self._draw_frame(framedata)
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 1742, in _draw_frame
self._drawn_artists = self._func(framedata, *self._args)
File "/mnt/zhoudeyu/project/save_video/dengyuanzhang/posetriplet/PoseTriplet-main/estimator_inference/common/visualization.py", line 185, in update_video
lines_3d[n][j - 1][0].set_3d_properties([pos[j, 2], pos[j_parent, 2]], zdir='z')
File "/root/miniconda3/envs/alphapose/lib/python3.6/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 "videopose-j16-wild-eval_run.py", line 288, in <module>
Vis.redering()
File "videopose-j16-wild-eval_run.py", line 44, in redering
self.visalizatoin(anim_output)
File "videopose-j16-wild-eval_run.py", line 232, in visalizatoin
input_video_skip=args.viz_skip)
File "/mnt/zhoudeyu/project/save_video/dengyuanzhang/posetriplet/PoseTriplet-main/estimator_inference/common/visualization.py", line 199, in render_animation
anim.save(output, writer=writer)
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 1161, in save
writer.grab_frame(**savefig_kwargs)
File "/root/miniconda3/envs/alphapose/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 253, in saving
self.finish()
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 354, in finish
self.cleanup()
File "/root/miniconda3/envs/alphapose/lib/python3.6/site-packages/matplotlib/animation.py", line 391, in cleanup
self._proc.returncode, self._proc.args, out, err)
subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1000x500', '-pix_fmt', 'rgba', '-r', '30', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '30000k', '-y', './wild_eval/333_scale2D_010/bilibili-clip/kunkun_clip_alpha_pose.mp4']' returned non-zero exit status 1.
2%|###2
I have two ffmpeg
version, one is in ubuntu system by apt install
, another is by pip install
. I am not sure which one is used here.
- The
apt version
:
(base) xx@xx:~$ ffmpeg -version
ffmpeg version 2.8.17-0ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
- the
pip version
:
(envRL) xx@xx:~$ ffmpeg -version
ffmpeg version 9c33b2f Copyright (c) 2000-2021 the FFmpeg developers built with gcc 9.3.0 (crosstool-NG 1.24.0.133_b0863d8_dirty)
Can you try the apt install
and see?
I have two
ffmpeg
version, one is in ubuntu system byapt install
, another is bypip install
. I am not sure which one is used here.
- The
apt version
:
(base) xx@xx:~$ ffmpeg -version
ffmpeg version 2.8.17-0ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
- the
pip version
:
(envRL) xx@xx:~$ ffmpeg -version
ffmpeg version 9c33b2f Copyright (c) 2000-2021 the FFmpeg developers built with gcc 9.3.0 (crosstool-NG 1.24.0.133_b0863d8_dirty)
Can you try the
apt install
and see?
Thanks, I give up installing ffmpeg because I met some errors while re-installing it with x264-lib.
So I try to use this inference script with another environment which has ffmpeg correctly installed with x264-lib.
And now everything goes well! Thanks for you patient reply.
The conclusion is that a newer matplotlib version is needed and the ffmpeg should be installed with libx264.
Ummm, not sure but glad to see the problem solved :P
Change Line 194 in common/visualization.py
to writer = Writer(fps=fps, metadata={}, bitrate=bitrate, codec='mpeg4')
. It works for me.
I meet the same issue today and I do conda uninstall, then conda install, it works.