YoloV4 - Out of memory

조회 수: 23(최근 30일)
Thomas Cimiega
Thomas Cimiega 2022년 12월 13일
댓글: Thomas Cimiega 2022년 12월 21일
I am trying to run YoloV4 example object detection using yolov4 deep learning on my local computer (GeForce GTX 1060, 16Gb RAM, Windows) using the local .mlx script and get the following error in line 95:
detectionResults = detect(detector,testData);
Error using dlnetwork/predict
Layer 'mish_2': Invalid input data. Error using the predict function in layer nnet.cnn.layer.FunctionLayer. The function
threw an error and could not be executed.
Error in yolov4ObjectDetector>iPredictActivations (line 1152)
[features{:}] = predict(network, dlX, 'Acceleration',acceleration);
Error in yolov4ObjectDetector/predict (line 517)
features = iPredictActivations(network, imgBatch, anchorBoxes, predictParams.Acceleration);
Error in vision.internal.detector.ObjectDetector/performDetect (line 72)
features = this.predict(Ipreprocessed, params);
Error in yolov4ObjectDetector/detect (line 404)
[varargout{1:nargout}] = performDetect(detector, I, params);
Caused by:
Error using gpuArray/max
Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice()'. If the problem
persists, reset the GPU by calling 'gpuDevice(1)'.
Error in dlarray/max (line 96)
zdata = max(matlab.lang.internal.move(xdata), matlab.lang.internal.move(ydata), varargin{:});
Error in vision.cnn.mish (line 22)
Z1 = max(X,0) + log(1 + exp(-abs(X)));
Error in nnet.cnn.layer.FunctionLayer/predict (line 61)
[varargout{1:layer.NumOutputs}] = feval(layer.PredictFcn, varargin{:});
Of course I researched and tried to decrease the minibatch size to 1 (line 75) or to reset the gpu device according to [1]. I also tried to run this code on different devices like a gpu server with 4 TITAN RTX GPUs, 1TB RAM and Arch Linux. Still the same error.
Do I miss some other settings that could cause this error?

채택된 답변

Joss Knight
Joss Knight 2022년 12월 17일
Generally the best solution here is to reduce the size of the input data.
Still, these object detector networks do seem to be unusually large. You could try a smaller one (yolov3tiny?) or you could see if you get good enough performance for your purposes on the CPU.
You could also try the Acceleration="none" option if available to you, since older versions of MATLAB had an issue that would cause memory usage to spike during optimization.
  댓글 수: 1
Thomas Cimiega
Thomas Cimiega 2022년 12월 21일
thank you, reducing the size of the input data actually works fine!

댓글을 달려면 로그인하십시오.

추가 답변(0개)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by