YoloV4 - Out of memory

17 vues (au cours des 30 derniers jours)
Thomas Cimiega
Thomas Cimiega le 13 Déc 2022
Commenté : Thomas Cimiega le 21 Déc 2022
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?

Réponse acceptée

Joss Knight
Joss Knight le 17 Déc 2022
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 commentaire
Thomas Cimiega
Thomas Cimiega le 21 Déc 2022
thank you, reducing the size of the input data actually works fine!

Connectez-vous pour commenter.

Plus de réponses (0)


En savoir plus sur Parallel and Cloud dans Help Center et File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by