open-mmlab / mmaction

An open-source toolbox for action understanding based on PyTorch
https://open-mmlab.github.io/
Apache License 2.0
1.86k stars 353 forks source link

Strange error when extracting rgb-images and optical flow by dense flow. #65

Closed longweiwei closed 4 years ago

longweiwei commented 5 years ago

hi @zhaoyue-zephyrus

when using dense_flow to exact frames and optical flow for kinetics datasets,most of video can be successfully extracted,but others maybe will report an same error as follows resulting in extraction failure:

terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.1.0) /home/lw/opencv-4.1.0/modules/core/src/cuda_info.cpp:73: error: (-217:Gpu API call) invalid device ordinal in function 'setDevice' Aborted (core dumped)

to these semmingly problematic video , when I using the following commands(suppose the video was renamed to test.mp4) to extract rbg-frames and optical flow individually:

./extract_gpu_ -f=test.mp4 -x=tmp/flow_x -y=tmp/flow_y -i=tmp/image -b=20 -t=1 -d=0 -s=1 -o=dir

it will be no problem!!

my dataset's directory as follows: |------kinetics | |--------------abseiling | | |---------------------_4YTwq0-73Y_000044_000054.mp4 | | |---------------------3B32lodo2M_000059_000069.mp4 | | |-----------------------.... | |--------------air_drumming | | |-------------------.03V2idM7_KY_000003_000013.mp4 | | |--------------------..... | |--------------..... | |--------------zumba | | |----------------- klz-HIvmlJo_000025_000035.mp4 | | |-----------------...... | | |------------------ klz-HIvmlJo_000025_000035.mp4

zhaoyue-zephyrus commented 5 years ago

Hi @longweiwei

Thanks for spotting the issue. What's your command? How many GPUs are there on the machine?

longweiwei commented 5 years ago

thanks for your prompt reply @zhaoyue-zephyrus

I used the script file(namely build_rawframes.py) provided by you to extrace frames and optical flow.

I found the cause of the error.I used the defalut parameter settings(num_gpu=8),but there is only one gpu on my machine. so when I set it to 1,namely num_pgu=1,then no problem.But unfortunately, there is a new problem. the errors as follows:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0xe08c20] moov atom not found /media/lw/1D76BC6FE6555087/kinetice/compress/train_256_2/canoeing_or_kayaking/-bfAUrAr8ZA_000142_000152.mp4 does not support memory mapping

2019-08-01 20:22:36,204 FATAL [default] Check failed: [video_stream.isOpened()] Cannot open video stream "/media/lw/1D76BC6FE6555087/kinetice/compress/train_256_2/canoeing_or_kayaking/-bfAUrAr8ZA_000142_000152.mp4" for optical flow extraction.

2019-08-01 20:22:36,204 WARN [default] Aborting application. Reason: Fatal log at [/home/lw/dense_flow/src/dense_flow_gpu.cpp:19]

same as the previous question, when I using the following commands to extract rbg-frames and optical flow individually,it will be ok. I don't know if the error is related to the fact that I have run multiple programes using same executable file.

zhaoyue-zephyrus commented 5 years ago

@longweiwei

  1. The first problem arises because num_gpu is greater than the number of gpu you actually have on your machine.

  2. I am not quite clear about your saying run multiple programes using same executable file? Can you explain more?

longweiwei commented 5 years ago

Forgive me for not good English!!@zhaoyue-zephyrus

Let me give an example. when I compiled the 'dense_flow', the executable file (namely,extract_cpu,extract_gpu and extract_warp_gpu) is under the ''/home/lw/mmaction/third_party/dense_flow/build". the 'extract_gpu' was used in several programes extracting optical flow due to the dataset is very very large.That is ,different programs use the same executable file.

I don't know if I have made it clear.

Another problem is how to set the number of frames extracted per second ?

zhaoyue-zephyrus commented 5 years ago

@longweiwei I don't think that the practice you mentioned may cause any problem. Actually the multiprocessing in the script calls extract_gpu in parallel. To modify the number of frames, consider changing the argument -t=xx which is 1 by default.

longweiwei commented 5 years ago

@zhaoyue-zephyrus Oh! Thanks for you solving my question.I understand.