I'm using a c++ version of dlib to extract positions of the facial landmarks in an image. I would like to reduce the execution time. Now it takes around 2.5 seconds to run a complied file and detect landmark on a single image.
After an analysis, I found that the main bottleneck is the deserialize function which takes a path to a shape predictor and loads this file to a shape predictor object. This function takes 1.5 seconds.
The code snippet is below.
shape_predictor sp;
deserialize("shape_predictor_68_face_landmarks.dat") >> sp;
I wonder if there could be a way to speed up the deserialize function.