I installed opencv-python and opencv-contrib-python:
~$ pip install opencv-python
~$ pip install opencv-contrib-python
Both installations went smoothly, and I now have:
In [1]: import cv2
In [2]: cv2.__version__
Out[2]: '3.4.0'
However, If I try to use the GOTURN
tracker, I get the following error:
cv2.error: /io/opencv/modules/dnn/src/caffe/caffe_io.cpp:1119: error: (-2) FAILED: fs.is_open(). Can't open "goturn.prototxt" in function ReadProtoFromTextFile
It seems like my installation is missing the model files goturn.prototxt
and goturn.caffemodel
.
I can manually download the missing files from git, but I don't know where to place them locally so opencv can read them.
Alternatively, is there a pip install ...
or similar action that can automatically "install" these missing files in the right place for me?
With the rise of deep learning, OpenCV started integrating more functionalities that support deep learning based tasks by introducing a new module called DNN (Deep Neural Networks). This DNN module was designed to make it easy to integrate deep learning models that have already been trained.
GOTURN is one such offline learning tracker based on convolutional neural network which doesn't learn online at all. First, the tracker is trained using thousands of videos for general object tracking.
This tracker works by training a filter with patches containing the object as well as nearby patches that do not. This allows the tracker to search the area around the previous position and exploit the fact that nearby patches are likely to contain the object.
You need to download the goturn.prototxt file and goturn.caffemodel from the net and put it in same folder as your current working directory to run it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With