gustavz / realtime_object_detection

Plug and Play Real-Time Object Detection App with Tensorflow and OpenCV
MIT License
281 stars 148 forks source link

Error when run with video #5

Closed nvnnghia closed 6 years ago

nvnnghia commented 6 years ago

Hi, I tried your project for a video and I got a error. The video were captured successfully.

Error is OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/nghia/opencv/modules/imgproc/src/color.cpp, line 10606 Traceback (most recent call last): File "object_detection.py", line 304, in <module> main() File "object_detection.py", line 300, in main detection(graph, category, score, expand) File "object_detection.py", line 216, in detection image_expanded = np.expand_dims(cv2.cvtColor(image, cv2.COLOR_BGR2RGB), axis=0) cv2.error: /home/nghia/opencv/modules/imgproc/src/color.cpp:10606: error: (-215) scn == 3 || scn == 4 in function cvtColor

I also get this kind of error

2018-03-09 11:00:12.881476: E tensorflow/stream_executor/cuda/cuda_dnn.cc:385] could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR 2018-03-09 11:00:12.881514: E tensorflow/stream_executor/cuda/cuda_dnn.cc:352] could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM 2018-03-09 11:00:12.881528: F tensorflow/core/kernels/conv_ops.cc:667] Check failed: stream->parent()->GetConvolveAlgorithms( conv_parameters.ShouldIncludeWinogradNonfusedAlgo<T>(), &algorithms) pip install -U numpyAborted (core dumped)

I used Python3.5 Tensorflow 1.4.1

gustavz commented 6 years ago

the first is a opencv error that happens to appear from time to time, restarting the python editor if you use one helps, or rebooting the system. The problem is that openCV sometimes catches empty frames and this messes everything up.

The second i really dont know. maybe thats a python 3.5 related error, i only use 2.7. Which CUDA and cuDNN version do you use? I use CUDA 9 and CuDNN 7.

Where do you run the code? what kind of system and kernel architecture? For me i also sometimes get strange errors on the jetson as this system sucks naturally.

Often rebooting solves everything and i dont know why....

gustavz commented 6 years ago

is the error still occurring?

nvnnghia commented 6 years ago

Hi, I made few changes and now the errors is gone. What I've done is to replace WebcamVideoStream by CaptureVideo (from opencv lib). The problem is that I can not get high speed as reported. I run on a PC with Intel® Core™ i7-4770 CPU @ 3.40GHz, 16GB of RAM with GTX Titan X Graphic Card (split_model = False, using visualize = True) but only get about 17FPS. When I tried to set split_model = True, visualize = True, FPS ~ 90

gustavz commented 6 years ago

it is still too little for your system. But you see: Tensorflows implementation is shit. that's why i did this project, you wont find a faster tensorflow ssd pipline than mine.

Ah and WebcamVideoStream is my own class which is using CaptureVideo from openCV. Have a look at stuff/helper.py and you will see