Object tracking: GOTURN - failed to allocate 90 GB cv::OutOfMemoryError
I am trying to implement the GOTURN object tracking algorithm as described in this link. The error occurs as the tracker gets initiallized with the first image is passed over:
bbox = cv2.selectROI(frame, False)
ok, frame = video.read()
ok = tracker.init(frame, bbox)
cv2.error: OpenCV(4.1.2-dev) \opencv\modules\core\src\alloc.cpp:73: error: (-4:Insufficient memory)
Failed to allocate 95588562276 bytes in function 'cv::OutOfMemoryError'
Well, apparently, the algorithm tries to allocate almost 90 GB of memory, which is somehow crazy. I use the caffe model and the prototxt files from here.
Does anyone have any idea?
I have no idea, but funny things tend to happen with bad data, so I'd check the sanity of the frame and bbox.
i tried on colab , 25gb ram wasn't enough ;(
edit: it seems to work with 3.4.8, so it's a regression.
i think, you should raise an issue here
we can also reproduce it with a simple:
@berak. The code will work under 3.x.x. Unfortunately doesn't work OpenCV 4.x.x. Fortunaltey, I managed to get it working for merely OpenCV 4.
Snippet:
@supra56, imho, the problem is a regression in the dnn, not the tracker code (or python specific)
@berak Thank you. I guess I am gonna have to open the issue...
any updates on this ? shall i move to a less recent version of opencv?
@aya sal -- unfortunately, no updates or fix so far.
You can look at this issue. It can help with most of the cases, but still, it is not working properly if the object is going out of the picture.