MARS icon indicating copy to clipboard operation
MARS copied to clipboard

extract flow problem

Open cym3223 opened this issue 5 years ago • 15 comments

When i run the extract_frames_flows.py to extract flow and frames , it show me sh: /home/ncrasto/code/workspace/action-recog-release/utils1/tvl1_videoframes: No such file or directory i have run g++ -std=c++11 tvl1_videoframes.cpp -o tvl1_videoframes -I${OPENCV}include/opencv4/ -L${OPENCV}lib64 -lopencv_objdetect -lopencv_features2d -lopencv_imgproc -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_cudaoptflow -lopencv_cudaarithm

could you help me what should i do,thank u very much

cym3223 avatar May 26 '20 03:05 cym3223

屏幕快照 2020-05-26 11 22 18

cym3223 avatar May 26 '20 03:05 cym3223

I have the same question....have you solved it?

VincentWPJ avatar Sep 26 '20 14:09 VincentWPJ

I have the same question....have you solved it?

no..... i give up

cym3223 avatar Sep 26 '20 14:09 cym3223

I have the same question....have you solved it?

no..... i give up

oh..I will try again

VincentWPJ avatar Sep 26 '20 14:09 VincentWPJ

I have the same question....have you solved it?

no..... i give up

check your opencv with cuda and the tvl1_videoframes.cpp. I re-cmake the opencv and now it's ok~

VincentWPJ avatar Sep 30 '20 14:09 VincentWPJ

@VincentWPJ Hi, I wonder if you saw something like "sh: 1: /home/ncrasto/code/workspace/action-recog-release/utils1/tvl1_videoframes: not found" when you fixed the issue and started to extract flows. Below is my screenshot for your reference. Thank you in advance

Screen Shot 2020-10-11 at 4 33 43 PM

superctj avatar Oct 11 '20 20:10 superctj

I figured I need to change the executable path in extract_frames_flows.py.

superctj avatar Oct 11 '20 21:10 superctj

Thank you very much. Do you have an RGB training model for HMDB51-2 and 3 partitioned datasets as following RGB_HMDB51_64f.pth,I want to check the accuracy of MARS+RGB model on HMDB51 over 3 splits.

在 2021-03-10 21:00:39,hzs @.***> 写道:

I think this problem can be solved by changing the code in extract_frames_flows.py as following:

extract flows os.system('export CUDA_VISIBLE_DEVICES=%d; /home/ncrasto/code/workspace/action-recog-release/utils1/tvl1_videoframes "%s" %d "%s" ' % ( gpu, os.path.join(outdir, '%05d.jpg'), nframes, os.path.join(outdir, '%05d_flow256crop.flo')))

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

runtoforever avatar Mar 11 '21 14:03 runtoforever

@superctj @craston When I extracted the optical flow, I found it was very slow. Could you please tell me how fast you extracted it ? Is there a faster way to extract it ? Looking forward to your reply as soon as possible.

HuangZuShu avatar Mar 14 '21 07:03 HuangZuShu

@cym3223

I think the author should be clear about the version of OpenCV,because dynamically linked libraries vary from version to version,which causes the program (tvl1_videoframes.cpp) has been compiling failure. The following is the complete process of my running through the optical flow extraction algorithm :

  • First, install cuda-11.2.2 and cudnn-11.0 whose version are decided by your machine.
  • Second, install opencv-4.5.0 with opencv_contrib-4.5.0 by cmake . The command is as follows.
cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/home/baode/data2/hzs/tool/opencv-app-4.5.0 -D CUDA_ARCH_BIN='6.1' -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=/home/baode/data2/hzs/tool/opencv_contrib-4.5.0/modules ..

CMAKE_INSTALL_PREFIX :Your installation directory. OPENCV_EXTRA_MODULES_PATH : the directory of opencv_contrib-4.5.0. CUDA_ARCH_BIN : you can find in navida website according to your machine.

  • Third, compile the program tvl1_videoframes.cpp and you will get a executable file tvl1_videoframes
g++ -std=c++11 tvl1_videoframes.cpp -o tvl1_videoframes -I${OPENCV}include/opencv4/ -L${OPENCV}lib -lopencv_objdetect -lopencv_features2d -lopencv_imgproc -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_cudaoptflow -lopencv_cudaarithm

The command is a little different from official commad between L${OPENCV}lib and L${OPENCV}lib64, which dicided by the version of opencv.

  • At last, modify the program extract_frames_flows.py demo,mainly the location of tvl1_videoframes produced by third step.
 os.system('export CUDA_VISIBLE_DEVICES=%d; /home/baode/data2/hzs/workspace2020/MARS/video_script/tvl1_videoframes "%s" %d "%s" ' % (gpu, os.path.join(outdir, '%05d.jpg'), nframes, os.path.join(outdir, '%05d_flow256crop.flo')))

To run through the programm of extracting optical flow takes my two days. However,I found it is Intolerably slow.

HuangZuShu avatar Mar 14 '21 08:03 HuangZuShu

I have a question about flow, in the extract_frames_flows.py, line 95 to line 96:

cv2.imwrite(os.path.join(outdir, 'TVL1jpg_x_%05d.jpg' % (i)), iflow[:, :, 0])
cv2.imwrite(os.path.join(outdir, 'TVL1jpg_y_%05d.jpg' % (i)), iflow[:, :, 1])

so the shape of the TVL1jpg_x.jpg and TVL1jpg_y.jpg are both (256,256), while in the test_single_stream.py, line 35 to line 36:

if opt.modality=='RGB': opt.input_channels = 3
elif opt.modality=='Flow': opt.input_channels = 2 

when I run the test_single_stream.py, it occured an error: Length of validation data = 0 I want know how it processes the two gray pictures to meet input_channels = 2.

Maojianzeng avatar Jul 11 '21 11:07 Maojianzeng

@HuangZuShu I'm sorry to bother you, I used your method to install OpenCV. First, I downloaded the two packages and uncompressed them as shown in the picture below: 1648466236(1) And then I in/home/ZCL/Dense - video - caption/Action - recognition/MARS - master/tool/opencv4.5.0 / cmake directory using the cmake you to install the command: cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/home/zcl/Dense-video-caption/Action-recognition/MARS-master/tool/opencv-4.5.0 -D CUDA_ARCH_BIN='8.6' -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=/home/zcl/Dense-video-caption/Action-recognition/MARS-master/tool/opencv_contrib-4.5.0/modules .. This is due in CMakeLists.txt under the opencv-4.5.0 directory. Then, after executing the command, I go back to mars-master and execute the code that handles tvl1_videofames.cpp: g++ -std=c++11 tvl1_videoframes.cpp -o tvl1_videoframes -I${OPENCV}include/opencv4/ -L${OPENCV}lib64 -lopencv_objdetect -lopencv_features2d -lopencv_imgproc -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_cudaoptflow -lopencv_cudaarithm The following figure shows the error: 1648466672(1) I would like to ask which of the above steps is wrong and how to modify it. The method you gave does not specify the path to run, I am not sure which path to run under. Also, do you not need OpencV as long as tvl1_videoframes are generated? If so, can you share the generated tvl1_videoframes with me?

ZChengLong578 avatar Mar 28 '22 11:03 ZChengLong578

I want to ask what the start and end means

wutongshu819274135 avatar Apr 12 '22 14:04 wutongshu819274135

@HuangZuShu I'm sorry to bother you, I used your method to install OpenCV. First, I downloaded the two packages and uncompressed them as shown in the picture below: 1648466236(1) And then I in/home/ZCL/Dense - video - caption/Action - recognition/MARS - master/tool/opencv4.5.0 / cmake directory using the cmake you to install the command: cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/home/zcl/Dense-video-caption/Action-recognition/MARS-master/tool/opencv-4.5.0 -D CUDA_ARCH_BIN='8.6' -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=/home/zcl/Dense-video-caption/Action-recognition/MARS-master/tool/opencv_contrib-4.5.0/modules .. This is due in CMakeLists.txt under the opencv-4.5.0 directory. Then, after executing the command, I go back to mars-master and execute the code that handles tvl1_videofames.cpp: g++ -std=c++11 tvl1_videoframes.cpp -o tvl1_videoframes -I${OPENCV}include/opencv4/ -L${OPENCV}lib64 -lopencv_objdetect -lopencv_features2d -lopencv_imgproc -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_cudaoptflow -lopencv_cudaarithm The following figure shows the error: 1648466672(1) I would like to ask which of the above steps is wrong and how to modify it. The method you gave does not specify the path to run, I am not sure which path to run under. Also, do you not need OpencV as long as tvl1_videoframes are generated? If so, can you share the generated tvl1_videoframes with me?

我也出现了这样的问题

wutongshu819274135 avatar Apr 21 '22 07:04 wutongshu819274135

@HuangZuShu I'm sorry to bother you, I used your method to install OpenCV. First, I downloaded the two packages and uncompressed them as shown in the picture below: 1648466236(1) And then I in/home/ZCL/Dense - video - caption/Action - recognition/MARS - master/tool/opencv4.5.0 / cmake directory using the cmake you to install the command: cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/home/zcl/Dense-video-caption/Action-recognition/MARS-master/tool/opencv-4.5.0 -D CUDA_ARCH_BIN='8.6' -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=/home/zcl/Dense-video-caption/Action-recognition/MARS-master/tool/opencv_contrib-4.5.0/modules .. This is due in CMakeLists.txt under the opencv-4.5.0 directory. Then, after executing the command, I go back to mars-master and execute the code that handles tvl1_videofames.cpp: g++ -std=c++11 tvl1_videoframes.cpp -o tvl1_videoframes -IOPENCVinclude/opencv4/−L{OPENCV}lib64 -lopencv_objdetect -lopencv_features2d -lopencv_imgproc -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_cudaoptflow -lopencv_cudaarithm The following figure shows the error: 1648466672(1) I would like to ask which of the above steps is wrong and how to modify it. The method you gave does not specify the path to run, I am not sure which path to run under. Also, do you not need OpencV as long as tvl1_videoframes are generated? If so, can you share the generated tvl1_videoframes with me?

Have you fixed this yet? I faced the same problem.

hoanganh27042001 avatar May 24 '22 10:05 hoanganh27042001