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

extract flow problem #21

Open
cym3223 opened this issue May 26, 2020 · 15 comments
Open

extract flow problem #21

cym3223 opened this issue May 26, 2020 · 15 comments

Comments

@cym3223
Copy link

cym3223 commented May 26, 2020

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
Copy link
Author

cym3223 commented May 26, 2020

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

@VincentWPJ
Copy link

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

@cym3223
Copy link
Author

cym3223 commented Sep 26, 2020

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

no..... i give up

@VincentWPJ
Copy link

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

no..... i give up

oh..I will try again

@VincentWPJ
Copy link

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~

@superctj
Copy link

@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
Copy link

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

@runtoforever
Copy link

runtoforever commented Mar 11, 2021 via email

@HuangZuShu
Copy link

@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
Copy link

HuangZuShu commented Mar 14, 2021

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

@Maojianzeng
Copy link

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.

@ZChengLong578
Copy link

@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
Copy link

I want to ask what the start and end means

@wutongshu819274135
Copy link

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

我也出现了这样的问题

@hoanganh27042001
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants