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

Error when trying to open a video file #18

Open
Fe-56 opened this issue May 22, 2021 · 6 comments
Open

Error when trying to open a video file #18

Fe-56 opened this issue May 22, 2021 · 6 comments

Comments

@Fe-56
Copy link

Fe-56 commented May 22, 2021

Hello all,

I passed the following command onto Ubuntu terminal:

python3 process_source.py --image disabled --video enabled --stream_in ./samples/video.mp4 --stream_out /samples/video_out.avi --horizontal_ratio 0.7 --vertical_ratio 0.7 --openpose_folder /home/user/Desktop/Social-Distancing/openpose/models

However, this is what I got:

Starting OpenPose Python Wrapper...
[ERROR:0] global /tmp/pip-req-build-ms668fyv/opencv/modules/videoio/src/cap.cpp (561) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.1) /tmp/pip-req-build-ms668fyv/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): /samples/video_out.avi in function 'icvExtractPattern'


Error: Unable to load background image (flag enabled)

Only received the error message ^ and nothing else happened.

For some context, I have a video file (video.mp4) in the samples folder of the Social-Distancing folder, and that is it. I am ob Ubuntu 20.04, with CUDA 10.1 CuDNN 7.6.5, and my GPU is Nvidia GTX 1650 Max-Q.

Please advise on what I should do, thanks!

@dexmac221
Copy link
Collaborator

Hi

Try to add to command line --masked disabled

Gian luca

@Fe-56
Copy link
Author

Fe-56 commented May 22, 2021

Hello @dexmac221,

Thank you for the fast response.

As advised by you, I passed the following command, with the line --masked disabled:

python3 process_source.py --image disabled --video enabled --masked disabled --stream_in ./samples/video.mp4 --stream_out /samples/video_out.avi --horizontal_ratio 0.7 --vertical_ratio 0.7 --openpose_folder /home/user/Desktop/Social-Distancing/openpose/models

However, now I get a new error:

Starting OpenPose Python Wrapper...
[ERROR:0] global /tmp/pip-req-build-ms668fyv/opencv/modules/videoio/src/cap.cpp (561) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.1) /tmp/pip-req-build-ms668fyv/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): /samples/video_out.avi in function 'icvExtractPattern'


F0522 17:20:43.277675  3803 syncedmem.cpp:71] Check failed: error == cudaSuccess (2 vs. 0)  out of memory
*** Check failure stack trace: ***
    @     0x7f2af994d1c3  google::LogMessage::Fail()
    @     0x7f2af995225b  google::LogMessage::SendToLog()
    @     0x7f2af994cebf  google::LogMessage::Flush()
    @     0x7f2af994d6ef  google::LogMessageFatal::~LogMessageFatal()
    @     0x7f2af2da7a0a  caffe::SyncedMemory::mutable_gpu_data()
    @     0x7f2af2c43466  caffe::Blob<>::mutable_gpu_data()
    @     0x7f2af2c80830  caffe::BaseConvolutionLayer<>::forward_gpu_gemm()
    @     0x7f2af2de44b1  caffe::ConvolutionLayer<>::Forward_gpu()
    @     0x7f2af2d67892  caffe::Net<>::ForwardFromTo()
    @     0x7f2af55f33b7  op::NetCaffe::forwardPass()
    @     0x7f2af5610702  op::PoseExtractorCaffe::forwardPass()
    @     0x7f2af560b71b  op::PoseExtractor::forwardPass()
    @     0x7f2af56091d0  op::WPoseExtractor<>::work()
    @     0x7f2af563a49f  op::Worker<>::checkAndWork()
    @     0x7f2af563a62b  op::SubThread<>::workTWorkers()
    @     0x7f2af564826d  op::SubThreadQueueInOut<>::work()
    @     0x7f2af563f281  op::Thread<>::threadFunction()
    @     0x7f2ad5cebd84  (unknown)
    @     0x7f2aff0d2609  start_thread
    @     0x7f2aff20e293  clone
Aborted (core dumped)

May I know how should I go about fixing that? Thanks!

@dexmac221
Copy link
Collaborator

you're welcome!. This is due to openpose, it is very gpu memory hunger (Abovr sll in 1.7 release, try to use 1.6). I suggest you to reduce net size. Try to use --net_size 256x192 (less memory usage but less performance, also) or try to use another nvidia board to to get best performance.

Gian Luca

@Fe-56
Copy link
Author

Fe-56 commented May 23, 2021

you're welcome!. This is due to openpose, it is very gpu memory hunger (Abovr sll in 1.7 release, try to use 1.6). I suggest you to reduce net size. Try to use --net_size 256x192 (less memory usage but less performance, also) or try to use another nvidia board to to get best performance.

Gian Luca

Thank you very much, with that line of command, I could finally run the program!

Also, may I know what commands should I pass into the Ubuntu terminal so that I can run the Social Distancing program on the live video of a webcam, instead of running it by passing video files into the program?

@dexmac221
Copy link
Collaborator

Hi! I'm happy about that.

open process_source.py and change line 181 from self.cap = cv2.VideoCapture(args[0].stream_in) to self.cap = cv2.VideoCapture(0) this will get video stream directly from you webcam

Gian Luca

@Fe-56
Copy link
Author

Fe-56 commented May 26, 2021

Hi! I'm happy about that.

open process_source.py and change line 181 from self.cap = cv2.VideoCapture(args[0].stream_in) to self.cap = cv2.VideoCapture(0) this will get video stream directly from you webcam

Gian Luca

Hello! I tried that and it got the video stream from my webcam.

However, after some testing and experimenting, I found out that, whenever I wave my hand closely in front of the webcam, or if an object moves across the webcam while being very near to the webcam, such that the object covers almost the entire screen in the output video, the program stops abruptly and shows the following error:

Starting OpenPose Python Wrapper...
Traceback (most recent call last):
  File "process_source.py", line 713, in <module>
    process_source.analyze()
  File "process_source.py", line 599, in analyze
    self.analyze_video()
  File "process_source.py", line 463, in analyze_video
    image = self.process_source(image, background)
  File "process_source.py", line 350, in process_source
    skeletals = np.around(
  File "<__array_function__ internals>", line 5, in around
  File "/usr/local/lib/python3.8/dist-packages/numpy/core/fromnumeric.py", line 3293, in around
    return _wrapfunc(a, 'round', decimals=decimals, out=out)
  File "/usr/local/lib/python3.8/dist-packages/numpy/core/fromnumeric.py", line 55, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/usr/local/lib/python3.8/dist-packages/numpy/core/fromnumeric.py", line 44, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

May I know what can I do to resolve this error? Thank you for all your help so far, I really appreciate it!

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

2 participants