Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test picture #75

Closed
IDayday opened this issue Aug 2, 2020 · 18 comments
Closed

Test picture #75

IDayday opened this issue Aug 2, 2020 · 18 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@IDayday
Copy link

IDayday commented Aug 2, 2020

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.

@innerlee
Copy link
Contributor

innerlee commented Aug 2, 2020

ref https://github.com/open-mmlab/mmaction2/blob/master/demo/demo.py#L17

@dreamerlin do we have rawframe examples in docs?

@IDayday
Copy link
Author

IDayday commented Aug 2, 2020

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

@innerlee innerlee added the question Further information is requested label Aug 2, 2020
@innerlee
Copy link
Contributor

innerlee commented Aug 2, 2020

maybe there are errors in your slurm script

@IDayday
Copy link
Author

IDayday commented Aug 2, 2020

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

@dreamerlin
Copy link
Collaborator

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
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

you can refer to this.

@innerlee
Copy link
Contributor

innerlee commented Aug 2, 2020

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

@dreamerlin
Copy link
Collaborator

dreamerlin commented Aug 2, 2020

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 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

you can refer to this.

Specifically, Here are the solutions according to the official explanation by the moviepy repo:

  • if you run it on windows, you should change the IMAGEMAGICK_BINARY to your path to magick.exe.
  • if you run it on linux, check for the ImageMagick policy file. ImageMagick does not have the proper permission set:
    /etc/ImageMagick-6/policy.xml. comment out (or remove the line that reads)
    <policy domain="path" rights="none" pattern="@*" /> to
    <!-- <policy domain="path" rights="none" pattern="@*" /> -->

@innerlee innerlee added the enhancement New feature or request label Aug 2, 2020
@IDayday
Copy link
Author

IDayday commented Aug 2, 2020

I check the policy.xml.
The sentence has been commented out.
I will try another tip Zulko/moviepy#693 (comment)
hope it works !

@IDayday
Copy link
Author

IDayday commented Aug 2, 2020

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

@dreamerlin
Copy link
Collaborator

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

@dreamerlin
Copy link
Collaborator

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.

@IDayday
Copy link
Author

IDayday commented Aug 2, 2020

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

@dreamerlin
Copy link
Collaborator

dreamerlin commented Aug 3, 2020

Would you mind sharing your video file if possible? We need a reproduce.

@IDayday
Copy link
Author

IDayday commented Aug 3, 2020

Would you mind sharing your video file if possible? We need a reproduce.

No problem. How can I send it to you? email? Baidunetdisk?

@dreamerlin
Copy link
Collaborator

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.

@dreamerlin
Copy link
Collaborator

dreamerlin commented Aug 3, 2020

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).

@IDayday
Copy link
Author

IDayday commented Aug 3, 2020

It works well for me. 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).

Ok, I will try. Thanks

@zhangyan1005
Copy link

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.
6B855467-3698-4878-B92D-53065274B053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants