opencv_contrib: GOTURN Tracker results in errors
System information (version)
- OpenCV => 3.2.0 & opencv_contrib 3.2
- Operating System / Platform => Windows 10 64 Bit
- Compiler => Visual Studio 2015
Detailed description
I have been trying to run the GOTURN tracker OpenCV implementation. I was firstly not able to find the goturn.prototxt and goturn.caffemodel (pretrained versions) on the opencv_extra github site, but was able to pull them from other github repos.
The program fails on execution with the following error, as soon as you select a ROI :
OpenCV Error: Assertion failed (input.dims() == 4 && (input.type() == CV_32F || input.type() == CV_64F)) in cv::dnn::ConvolutionLayerImpl::allocate, file E:\opencv3.2.0_sources\opencv_contrib-master\modules\dnn\src\layers\convolution_layer.cpp, line 90 OpenCV Error: Assertion failed (The following error occured while making allocate() for layer “conv11”: input.dims() == 4 && (input.type() == CV_32F || input.type() == CV_64F)) in cv::dnn::ConvolutionLayerImpl::allocate, file E:\opencv3.2.0_sources\opencv_contrib-master\modules\dnn\src\layers\convolution_layer.cpp, line 90
I tried fixing this by updating the following lines of code in gtrtacker.cpp as follows :
dnn::Blob targetBlob = dnn::Blob(targetPatch); dnn::Blob searchBlob = dnn::Blob(searchPatch);
TO
dnn::Blob targetBlob = dnn::Blob::fromImages(targetPatch); dnn::Blob searchBlob = dnn::Blob::fromImages(searchPatch);
NOW,
I get a different error altogether that seems to have something to do with OpenCL, i get this error in the allocate() function in dnn.cpp ::
OpenCV Error: Assertion failed (dims <= 3) in cv::ocl::OpenCLAllocator::checkContinuous, file E:\opencv3.2.0_sources\3.2.0\opencv-3.2.0\modules\core\src\ocl.cpp, line 4899
OpenCV Error: Assertion failed (The following error occured while making forward() for layer “concat1”: dims <= 3) in cv::ocl::OpenCLAllocator::checkContinuous, file E:\opencv3.2.0_sources\3.2.0\opencv-3.2.0\modules\core\src\ocl.cpp, line 4899
0x00007FFD18AC7788 (0x000000AAD070BBF8 0x000000AAD070BC00 0x000000AAD070BC08 0x00007FFD18D38CC1), RaiseException() + 0x68 bytes(s)
0x00007FFCF5F74582 (0x00007FFCDBED0000 0x000000AAD071BD50 0x0000021C8281D384 0x00007FFD18D30000), _CxxThrowException() + 0xC2 bytes(s)
0x00007FFCDC53A45A (0x0000000000000029 0x0000000000000000 0x0000000000000000 0x0000000000000000), cv::error() + 0x15A bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv-3.2.0\modules\core\src\system.cpp, line 661 + 0x1E byte(s)
0x00007FFCDC53A5A0 (0x000000AAD071E3D0 0x0000000000000000 0x000000AAD071CB90 0x0000021C81BB9E64), cv::error() + 0x140 bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv-3.2.0\modules\core\src\system.cpp, line 666 + 0x109 byte(s)
0x00007FFCDD71E173 (0x00007FFCDD71E0F0 0x000000AAD072ECD0 0x000000AAD072ECD0 0x0000000000000000), cv::dnn::Net::Impl::forwardLayer'::
1’::catch$0() + 0x83 bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv_contrib-3.2.0\modules\dnn\src\dnn.cpp, line 423 + 0x75 byte(s)
0x00007FFCF5F7C720 (0x00007FFCDD71E0F0 0x000000AAD071D1A8 0x0000000000000100 0x0000000000000000), __C_specific_handler() + 0x230 bytes(s)
0x00007FFCF5F72AE2 (0x0000000000000000 0x0000000000000000 0x000000AAD071E250 0x0000000000000000), __FrameUnwindFilter() + 0x432 bytes(s)
0x00007FFD1B94A193 (0x0000021CEA99E8B0 0x0000021CEAADBE08 0x0000021CE832FFE0 0x0000021C8222F7F0), RtlCaptureContext() + 0x3C3 bytes(s)
0x00007FFCDD601006 (0x0000021CEAADB720 0x0000021CEAADB748 0x0000000000000001 0x0000021CE8330008), cv::dnn::Net::Impl::forwardLayer() + 0x156 bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv_contrib-3.2.0\modules\dnn\src\dnn.cpp, line 419 + 0x1B byte(s)
0x00007FFCDD600E4F (0x0000000000000000 0x000000AAD072ED90 0x0000021CE828CE70 0x0000021CE832FFE0), cv::dnn::Net::Impl::forwardAll() + 0x8F bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv_contrib-3.2.0\modules\dnn\src\dnn.cpp, line 435
0x00007FFCDD600D7E (0x0000000000000046 0x000000AAD072EFA8 0x000000AAD072EEB0 0x0000000000000001), cv::dnn::Net::forward() + 0x9E bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv_contrib-3.2.0\modules\dnn\src\dnn.cpp, line 503
0x00007FFCDD85CB5E (0x000000C3CD82EBAD 0x0000000000000001 0x00007FF679A68700 0x000000C3CD82EBAD), cv::gtr::TrackerGOTURNImpl::updateImpl() + 0xA5E bytes(s), e:\opencv3.2.0_sources\3.2.0\opencv_contrib-3.2.0\modules\tracking\src\gtrtracker.cpp, line 170 + 0x31 byte(s)
0x00007FF679A61FFB (0x00007FFD18E169F8 0x0000000000000000 0x00007FFD18E16A08 0x0000000000000000), main() + 0x5FB bytes(s), e:\tracking_goturn\tracking_goturn\source.cpp, line 168 + 0x1B byte(s)
0x00007FF679A632E8 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x124 bytes(s), f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl, line 264 + 0x22 byte(s)
0x00007FFD1AC98364 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFD1B9070D1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
Not sure if there is a problem in my environment -_ i tried reverting builds to 3.1.0 , with no success. Or maybe I dont have the correct *.prototxt and *.caffemodel.
Am using the model and prototxt file given here : https://github.com/opencv/opencv_extra/tree/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking
Let me know what you guys think !
Steps to reproduce
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 33 (5 by maintainers)
Thanks to @LorenaGdL for the PR about this bug, I didn’t meet this issue with latest code. But I met another error below:
OpenCV Error: Requested object was not found (Requested blob ".data1" not found) in cv::dnn::Net::setBlob, file C:\opencv3_2\opencv_contrib-master\modules\dnn\src\dnn.cpp, line 516
It seems that there’s something wrong in gtrTracker.cpp line 167:I just download *.ptototxt and *.caffemodel, and put them to my VS program folder. Then add “path to test video” in Command Arguments. BTW, my main.cpp is below:
I don’t know how to fix it, I will be appreciate if anyone can help me.
[libprotobuf ERROR /opt/opencv/320deb/modules/dnn/3rdparty/protobuf/sources/protobuf-3.1.0/src/google/protobuf/text_format.cc:298] Error parsing text-format caffe.NetParameter: 7:1: Expected identifier, got: < OpenCV Error: Unspecified error (FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse NetParameter file: goturn.prototxt) in ReadNetParamsFromTextFileOrDie, file /opt/opencv/opencv_contrib-3.2.0/modules/dnn/src/caffe/caffe_io.cpp, line 1101 /opt/opencv/opencv_contrib-3.2.0/modules/dnn/src/caffe/caffe_io.cpp:1101: error: (-2) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse NetParameter file: goturn.prototxt in function ReadNetParamsFromTextFileOrDie
OpenCV Error: Unspecified error (GOTURN network loading error…) in cv::gtr::InitImpl, file gtrTracker.cpp, line 117 terminate called after throwing an instance of ‘cv::Exception’ what(): gtrTracker.cpp:117: error: (-2) GOTURN network loading error… in function cv::gtr::InitImpl
Take a closer look at the solution in the tutorial.
Dear Author: I got this error:
Thank for your reply. I spent one day to get goturn to work. But not success. I got this error: OpenCV Error: Assertion failed ((bias && l->blobs.size() == 2) || (!bias && l->blobs.size() == 1)) in initConvDeconvLayerFromCaffe, file /home/nghia/opencv/modules/dnn/src/layers/convolution_layer.cpp, line 1204 terminate called after throwing an instance of ‘cv::Exception’ what(): /home/nghia/opencv/modules/dnn/src/layers/convolution_layer.cpp:1204: error: (-215) (bias && l->blobs.size() == 2) || (!bias && l->blobs.size() == 1) in function initConvDeconvLayerFromCaffe.
I got the model here: https://github.com/opencv/opencv_extra/tree/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking
Could you please share your model and a test code. Or do you have any suggestion. Thank you very much.
In goturn.prototxt, replace all “data1” to “.data1” & “data2” to “.data2” It’s working for me
I get the following exotic errors when trying to run GOTURN via OpenCV:
OpenCV Error: Assertion failed ((bias && l->blobs.size() == 2) || (!bias && l->blobs.size() == 1)) in initConvDeconvLayerFromCaffe, file /opencv/opencv_contrib-3.2.0/modules/dnn/src/caffe/layer_loaders.cpp, line 27 OpenCV Error: Assertion failed (The following error occured while making allocate() for layer "conv11": (bias && l->blobs.size() == 2) || (!bias && l->blobs.size() == 1)) in initConvDeconvLayerFromCaffe, file /opencv/opencv_contrib-3.2.0/modules/dnn/src/caffe/layer_loaders.cpp, line 27 Traceback (most recent call last): File "pipeline.py", line 32, in <module> ok, bbox = tracker.update(im) cv2.error: /opencv/opencv_contrib-3.2.0/modules/dnn/src/caffe/layer_loaders.cpp:27: error: (-215) The following error occured while making allocate() for layer "conv11": (bias && l->blobs.size() == 2) || (!bias && l->blobs.size() == 1) in function initConvDeconvLayerFromCaffe
I am also a bit confused by the comment here https://github.com/opencv/opencv_contrib/blob/master/modules/tracking/samples/goturnTracker.cpp where it says
As the OpenCV Extra repo doesn’t seem to contain any Goturn caffemodel, pretrained or otherwise. I downloaded it from http://cs.stanford.edu/people/davheld/public/GOTURN/trained_model/tracker.caffemodel instead. Is that is what is intended, or is it some other .caffemodel file one is supposed to use?
@ChaselS314, @xiaochus OpenCV Error: Requested object was not found (Requested blob “.data1” not found) in cv::dnn::Net::setBlob, file C:\opencv3_2\opencv_contrib-master\modules\dnn\src\dnn.cpp, line 516
The above error seems to be caused by the mismatching of the goturn.prototxt file. I received the file from the following site. Https://github.com/opencv/opencv_extra/tree/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking
The following command merge four files into one.
cat goturn.caffemodel.zip.001 goturn.caffemodel.zip.002 goturn.caffemodel.zip.003 goturn.caffemodel.zip.004 > goturn.caffemodel
However, an error still occurs. The error message is as follows.OpenCV Error: Assertion failed ((bias && l-> blobs.size () == 2) || (! Bias && l-> b Lobs.size () == 1)) in cv :: dnn :: initConvDeconvLayerFromCaffe, file D: \ Program \ ope Ncv-dnn \ opencv_contrib-master \ opencv_contrib-master \ modules \ dnn \ src \ caffe \ layer_ Loaders.cpp, line 30
in my case : l-> blobs.size () is 0.
Hello. I am still working on this bug, apparently there is some issue with dnn/tracking modules used in combo. For now you can try GOTURN outside of the OpenCV tracking API, using an example on my Github: https://github.com/Auron-X/GOTURN-Example It also work on GPU ~100 FPS (on my GTX 1080) as the original paper stated
I’m getting exactly the same error on OpenCV 3.2.0 & opencv_contrib 3.2.0 (Ubuntu 16.04) after the selection of a bounding box:
Could it be related to the .prototxt and .caffemodel files from opencv_extra repository? I used the same files as basamarshad.