Search code examples
c++windowsmemory-managementbad-allocdlib

DLIB: train_shape_predictor_ex.exe for 194 landmarks with halen dataset gives runtime error: bad allocation


I am trying train dlib's shape_predictor for 194 landmarks with halen dataset

but it gives bad allocation exception when I run it command prompt

D:\Facial Feature Extraction>train_shape_predictor_ex.exe face_detector
Program is started
exception thrown!
bad allocation

, I reduced the number of image to only 50 then it run successfully but the result is not satisfactory. So I tried to train with 64 GB RAM System but bow I increased the parameter

trainer.set_nu(0.05);
trainer.set_tree_depth(2);

but now it is still showing bad allocation error. If I train with less data and for smaller parameter the train model is not correct.


Solution

  • Build your application in Release Mode and target to 64-bit Windows plateform.

    • Also Enable \LARGEADDRESSAWARE Flag in your Project.

    Here is a link to your question: Answer