Closed IDayday closed 4 years ago
ref https://github.com/open-mmlab/mmaction2/blob/master/demo/demo.py#L17
@dreamerlin do we have rawframe examples in docs?
Oh! I just find the demo.py already updated. But when I use: python demo/demo.py configs/recognition/slowfast/slowfast_r50_video_4x16x1_256e_kinetics400_rgb.py demo/checkpoints/slowfast_r50_4x16x1_256e_kinetics400_rgb_20200618-9a124260.pth demo/test1.mp4 demo/label_map.txt --out-filename demo/test1_out.mp4
it returns: /tmp/slurmd/job13202212/slurm_script: line 11: activate: No such file or directory File "demo/demo.py", line 120 print(f'{result[0]}: ', result[1]) ^ SyntaxError: invalid syntax
maybe there are errors in your slurm script
After update the mmaction2. Also moviepy and ImageMagick have been installed by : pip install moviepy conda install ImageMagick I test the video again. It turns out:
The top-5 labels with corresponding scores are:
riding scooter: 6.93249
skateboarding: 6.3930197
parkour: 5.9693227
motorcycling: 5.3658776
riding unicycle: 5.1771736
Traceback (most recent call last):
File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1137, in __init__
subprocess_call(cmd, logger=None)
File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/tools.py", line 54, in subprocess_call
raise IOError(err.decode('utf8'))
OSError: convert: unable to read font `Courier' @ warning/annotate.c/RenderType/962.
convert: unable to read font `Courier' @ error/annotate.c/RenderFreetype/1396.
convert: no images defined `PNG32:/tmp/tmpnv_m5ba_.png' @ error/convert.c/ConvertImageCommand/3285.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "demo/demo.py", line 134, in <module>
main()
File "demo/demo.py", line 130, in main
use_frames=args.use_frames)
File "demo/demo.py", line 89, in get_output
text_clips = TextClip(label, fontsize=font_size, color=font_color)
File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1146, in __init__
raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:
convert: unable to read font `Courier' @ warning/annotate.c/RenderType/962.
convert: unable to read font `Courier' @ error/annotate.c/RenderFreetype/1396.
convert: no images defined `PNG32:/tmp/tmpnv_m5ba_.png' @ error/convert.c/ConvertImageCommand/3285.
.
.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
After update the mmaction2. Also moviepy and ImageMagick have been installed by : pip install moviepy conda install ImageMagick I test the video again. It turns out:
The top-5 labels with corresponding scores are: riding scooter: 6.93249 skateboarding: 6.3930197 parkour: 5.9693227 motorcycling: 5.3658776 riding unicycle: 5.1771736 Traceback (most recent call last): File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1137, in init subprocess_call(cmd, logger=None) File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/tools.py", line 54, in subprocess_call raise IOError(err.decode('utf8')) OSError: convert: unable to read font
Courier' @ warning/annotate.c/RenderType/962. convert: unable to read font
Courier' @ error/annotate.c/RenderFreetype/1396. convert: no images defined `PNG32:/tmp/tmpnvm5ba.png' @ error/convert.c/ConvertImageCommand/3285.During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "demo/demo.py", line 134, in main() File "demo/demo.py", line 130, in main use_frames=args.use_frames) File "demo/demo.py", line 89, in get_output text_clips = TextClip(label, fontsize=font_size, color=font_color) File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1146, in init raise IOError(error) OSError: MoviePy Error: creation of None failed because of the following error:
convert: unable to read font
Courier' @ warning/annotate.c/RenderType/962. convert: unable to read font
Courier' @ error/annotate.c/RenderFreetype/1396. convert: no images defined `PNG32:/tmp/tmpnvm5ba.png' @ error/convert.c/ConvertImageCommand/3285. ..This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
you can refer to this.
well, let's see what happens in future. if more than three upvotes this issue or similar issues, we may consider to reimplement this functionality using opencv, and remove the moviepy dependency
After update the mmaction2. Also moviepy and ImageMagick have been installed by : pip install moviepy conda install ImageMagick I test the video again. It turns out: The top-5 labels with corresponding scores are: riding scooter: 6.93249 skateboarding: 6.3930197 parkour: 5.9693227 motorcycling: 5.3658776 riding unicycle: 5.1771736 Traceback (most recent call last): File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1137, in init subprocess_call(cmd, logger=None) File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/tools.py", line 54, in subprocess_call raise IOError(err.decode('utf8')) OSError: convert: unable to read font
Courier' @ warning/annotate.c/RenderType/962. convert: unable to read font
Courier' @ error/annotate.c/RenderFreetype/1396. convert: no images definedPNG32:/tmp/tmpnv_m5ba_.png' @ error/convert.c/ConvertImageCommand/3285. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "demo/demo.py", line 134, in main() File "demo/demo.py", line 130, in main use_frames=args.use_frames) File "demo/demo.py", line 89, in get_output text_clips = TextClip(label, fontsize=font_size, color=font_color) File "/dat01/liuzhixiong/anaconda3/envs/mmaction/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1146, in **init** raise IOError(error) OSError: MoviePy Error: creation of None failed because of the following error: convert: unable to read font
Courier' @ warning/annotate.c/RenderType/962. convert: unable to read fontCourier' @ error/annotate.c/RenderFreetype/1396. convert: no images defined
PNG32:/tmp/tmpnvm5ba.png' @ error/convert.c/ConvertImageCommand/3285. . .This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrectyou can refer to this.
Specifically, Here are the solutions according to the official explanation by the moviepy
repo:
IMAGEMAGICK_BINARY
to your path to magick.exe
.<policy domain="path" rights="none" pattern="@*" />
to
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
I check the policy.xml.
The sentence has been commented out.
I will try another tip https://github.com/Zulko/moviepy/issues/693#issuecomment-499982601
hope it works !
Unfortunately, I did as suggested and still failed. I installed ImageMagick by: conda install ImageMagick. It's right? I didn't export anything about ImageMagick in the .bashrc
Unfortunately, I did as suggested and still failed. I installed ImageMagick by: conda install ImageMagick. It's right? I didn't export anything about ImageMagick in the .bashrc
It should be apt install imagemagick
. and remember to replace <policy domain="path" rights="none" pattern="@*" />
to <!-- <policy domain="path" rights="none" pattern="@*" /> -->
in /etc/ImageMagick-6/policy.xml
Unfortunately, I did as suggested and still failed. I installed ImageMagick by: conda install ImageMagick. It's right? I didn't export anything about ImageMagick in the .bashrc
It should be
apt install imagemagick
. and remember to replace<policy domain="path" rights="none" pattern="@*" />
to<!-- <policy domain="path" rights="none" pattern="@*" /> -->
in /etc/ImageMagick-6/policy.xml
Also, you could try this repo to install imagemagick without sudo by using zzimagemagick.sh
.
Thank you for answering my questions in time! I have tried a series of methonds and finally installed it. The demo.py works. But there is a new problem. I get the video_out.mp4, but there is no label painted on it.
The slurm_job.out reads:
chunk: 0%| | 0/225 [00:00<?, ?it/s, now=None] chunk: 23%|██▎ | 51/225 [00:00<00:00, 509.67it/s, now=None] chunk: 54%|█████▍ | 122/225 [00:00<00:00, 556.22it/s, now=None] chunk: 88%|████████▊ | 198/225 [00:00<00:00, 602.16it/s, now=None]
t: 0%| | 0/245 [00:00<?, ?it/s, now=None] t: 5%|▍ | 12/245 [00:00<00:02, 98.80it/s, now=None] t: 11%|█ | 27/245 [00:00<00:01, 109.99it/s, now=None] t: 17%|█▋ | 41/245 [00:00<00:01, 116.88it/s, now=None] t: 22%|██▏ | 53/245 [00:00<00:01, 105.98it/s, now=None] t: 25%|██▌ | 62/245 [00:00<00:02, 81.24it/s, now=None] t: 29%|██▉ | 72/245 [00:00<00:02, 84.39it/s, now=None] t: 33%|███▎ | 81/245 [00:00<00:02, 79.64it/s, now=None] t: 36%|███▋ | 89/245 [00:00<00:02, 76.32it/s, now=None] t: 40%|████ | 98/245 [00:01<00:01, 78.48it/s, now=None] t: 43%|████▎ | 106/245 [00:01<00:01, 77.30it/s, now=None] t: 47%|████▋ | 114/245 [00:01<00:01, 74.15it/s, now=None] t: 50%|████▉ | 122/245 [00:01<00:01, 74.32it/s, now=None] t: 53%|█████▎ | 130/245 [00:01<00:01, 71.17it/s, now=None] t: 56%|█████▋ | 138/245 [00:01<00:01, 69.99it/s, now=None] t: 60%|█████▉ | 146/245 [00:01<00:01, 67.72it/s, now=None] t: 63%|██████▎ | 154/245 [00:01<00:01, 67.99it/s, now=None] t: 66%|██████▌ | 162/245 [00:02<00:01, 67.87it/s, now=None] t: 69%|██████▉ | 170/245 [00:02<00:01, 67.17it/s, now=None] t: 72%|███████▏ | 177/245 [00:02<00:01, 67.05it/s, now=None] t: 75%|███████▌ | 184/245 [00:02<00:00, 65.81it/s, now=None] t: 78%|███████▊ | 191/245 [00:02<00:00, 60.18it/s, now=None] t: 81%|████████ | 198/245 [00:02<00:00, 61.08it/s, now=None] t: 84%|████████▎ | 205/245 [00:02<00:00, 61.45it/s, now=None] t: 87%|████████▋ | 212/245 [00:02<00:00, 57.31it/s, now=None] t: 89%|████████▉ | 218/245 [00:02<00:00, 54.77it/s, now=None] t: 91%|█████████▏| 224/245 [00:03<00:00, 51.24it/s, now=None] t: 94%|█████████▍| 230/245 [00:03<00:00, 51.21it/s, now=None] t: 96%|█████████▋| 236/245 [00:03<00:00, 48.15it/s, now=None] t: 98%|█████████▊| 241/245 [00:03<00:00, 47.05it/s, now=None]
The top-5 labels with corresponding scores are: climbing ladder: 14.743916 cleaning gutters: 9.852766 trimming trees: 9.279804 climbing tree: 9.162321 cleaning windows: 9.046522 Moviepy - Building video demo/test2_out.mp4. MoviePy - Writing audio in test2_outTEMP_MPY_wvf_snd.mp3 MoviePy - Done. Moviepy - Writing video demo/test2_out.mp4
Moviepy - Done ! Moviepy - video ready demo/test2_out.mp4
Would you mind sharing your video file if possible? We need a reproduce.
Would you mind sharing your video file if possible? We need a reproduce.
No problem. How can I send it to you? email? Baidunetdisk?
Would you mind sharing your video file if possible? We need a reproduce.
No problem. How can I send it to you? email? Baidunetdisk?
Email to me.
It works well for me, the output file has emailed to you. The problems may caused by the moviepy
version I guess. please check your moviepy version, we use moviepy >= 1.0.3
(we will explain it in documents later).
It works well for me. The problems may caused by the
moviepy
version I guess. please check your moviepy version, we usemoviepy >= 1.0.3
(we will explain it in documents later).
Ok, I will try. Thanks
But there is a new problem. I get the video_out.mp4, but there is no label painted on it.
hi,I also encountered the same problem. Have you solved it? My video shows it like this, but it doesn't have a label.
I successfully used demo.py to test a video, but how can I test a picture from my own data? If I can. I want to compare the result between video and pictures in order from the same data. I have seen the " dataset_type = 'RawframeDataset' " and " dataset_type = 'VideoDataset' " in the config.