1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
6.92k stars 1.33k forks source link

Memory not cleansed on CPU #185

Open ibmua opened 4 years ago

ibmua commented 4 years ago

When I use face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, device='cuda') or face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, face_detector='dlib') everything's fine. However, when I use face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, device='cpu') some garbage accumulates in memory and with every use the process that runs get_landmarks_from_image starts consuming more and more memory.

Kitty-sunray commented 2 years ago

you can put detector in separate file and run as python detector.py input.jpg output.npy garbage collector will do the job to free memory notice it would require additional file write/read, but no other solution seems to be easy