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

Goturn tracker fails to allocate 95GB of RAM #2426

Closed
mipko opened this issue Feb 8, 2020 · 10 comments
Closed

Goturn tracker fails to allocate 95GB of RAM #2426

mipko opened this issue Feb 8, 2020 · 10 comments

Comments

@mipko
Copy link

mipko commented Feb 8, 2020

System information (version)
  • OpenCV => 4.2.0
  • Operating System / Platform => Ubuntu 19.10 64bit
  • Compiler => gcc 8
Detailed description

I have tried to use goturn tracker and it fails with error not being able to allocate 95GB of memory.
I have compiled the OpenCV with CUDA enabled flags, however goturn fails with the same error if I use non CUDA enabled OpenCV build

I have used caffe prototxt and caffemodel files available.

Steps to reproduce
Ptr<Tracker> tracker = TrackerGOTURN::create()
tracker->init(frame, bbox)'

Error
  what():  OpenCV(4.2.0) /home/mirko/programiranje/ocv42install/opencv/modules/core/src/alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 95588562276 bytes in function 'OutOfMemoryError'
 
@AlexGatz
Copy link

AlexGatz commented Feb 9, 2020

Having the same issue with python as well. Same OpenCV version.

  • OS: Arch Linux 64bit
  • OpenCV: 4.2.0
  • Cuda: V10.2.89

I wonder what other similarities we have, we appear to be the other ones having this specific issue.

@AlexGatz
Copy link

AlexGatz commented Feb 9, 2020

Tested:

  • OpenCV: 3.4.8.29 Ran for a short time as expected then hit another memory error.

@AlexGatz
Copy link

AlexGatz commented Feb 9, 2020

So it appears that the bounding box is growing large enough to cause the memory issue. I'm going to try to limit its size and see if that fixes the issue (no clue how to actually do that).

  • Update: I put some limits on the box size by setting a new tuple once a limit was reached. It did prolong the display time but once the tracker lost interest on the object the bounding box hit the limits and after a few seconds it crashed with the same error. Only working with version 3.4.8.29 for me. I haven't tried an earlier version yet.

@mipko
Copy link
Author

mipko commented Feb 9, 2020

the culprit of the problem for OpenCV 4.2.0 is not in inference itself. Loading caffe model causes the error. It doesn't reach the inference at all.

@ghost
Copy link

ghost commented Feb 9, 2020

Works fine with python2.7 and openCV3.X.X

@berak
Copy link
Contributor

berak commented Feb 18, 2020

Loading caffe model causes the error.

can be reproduced with opencv4.x like:

net = cv2.dnn.readNet("goturn.caffemodel", "goturn.prototxt")

@Mortiniera
Copy link

Same issue with python as well :

OS: Arch Windows 64bit
OpenCV: 4.2.0

Any idea on how to fix this ?

@alalek
Copy link
Member

alalek commented Feb 19, 2020

Please try patch from here: opencv/opencv#16617

@dkurt
Copy link
Member

dkurt commented Feb 19, 2020

Hi! As a temporal workaround please try to comment the following lines:

input: "data1"
# input_dim: 1
# input_dim: 3
# input_dim: 227
# input_dim: 227

input: "data2"
# input_dim: 1
# input_dim: 3
# input_dim: 227
# input_dim: 227

Sorry for inconvenience!

import numpy as np
import cv2 as cv

net = cv.dnn.readNet('goturn.prototxt', 'goturn.caffemodel')
inp0 = np.random.standard_normal([1, 3, 227, 227]).astype(np.float32)
inp1 = np.random.standard_normal([1, 3, 227, 227]).astype(np.float32)
net.setInput(inp0, "data1")
net.setInput(inp1, "data2")
net.forward()

@ykchong45
Copy link

ykchong45 commented Mar 11, 2021

Hi! As a temporal workaround please try to comment the following lines:

The error dismissed once I commented on lines in the goturn.caffemodel.prototxt. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants