DSFD-Pytorch-Inference icon indicating copy to clipboard operation
DSFD-Pytorch-Inference copied to clipboard

Memory keeps increasing

Open ghost opened this issue 5 years ago • 4 comments

Hi, during the inference of each model, the memory continuously increases with each image (only for single image inference). I have tried this on CPU as well as on GPU. Is there any way to solve this?

ghost avatar Jul 21 '20 14:07 ghost

Give code to reproduce the error

NikolayTV avatar Jul 21 '20 15:07 NikolayTV

def read_image(img_path):
    img = cv2.imread(img_path)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    return img

detector = face_detection.build_detector("DSFDDetector", confidence_threshold=.5, nms_iou_threshold=.3)
image_paths = ['img1.jpg', 'img2.png', ...]    # list of image paths

predictions = detector.detect(read_image(str(image_paths[0])))  
predictions = detector.detect(read_image(str(image_paths[1])))  
predictions = detector.detect(read_image(str(image_paths[2])))  

My RAM keeps on increasing as I do inference for more and more images. RAM is not getting freed.

ghost avatar Jul 22 '20 02:07 ghost

Hi, I don't have access to a GPU currently as I'm on vacation. Will be able to inspect the issue when I'm back. If anyone finds the issue, please submit a pull request and I should be able to review it.

hukkelas avatar Jul 28 '20 07:07 hukkelas

I also have this issue. On GPU it works fine, CPU inference loads the memory

NikolayTV avatar Jul 28 '20 13:07 NikolayTV