Closed limenglian closed 6 months ago
Hi @limenglian
Can you provide more detailed reports about the memory consumption of this code snippet? I need to know the following:
The current information is too general and doesn't pinpoint the problematic area effectively. However, I will do some research on this issue on my end.
Description: When utilizing Carvekit's interface with the provided configuration settings, particularly during the execution of the interface.segmentation_pipeline() and interface.postprocessing_pipeline.matting_module() functions, there appears to be a memory leak issue. Despite repeated usage, memory consumption continues to increase, indicating a potential problem within the implementation of these functions.
Code Segment: interface = HiInterface( object_type="object", batch_size_seg=1, batch_size_matting=1, device='cuda', seg_mask_size=640, matting_mask_size=2048, trimap_prob_threshold=231, trimap_dilation=30, trimap_erosion_iters=5, fp16=True, )
images = [img1,img2] mask = interface.segmentation_pipeline(images) trimap1 = interface.trimap_generator(original_image=images[0], mask=mask[0]) trimap2 = interface.trimap_generator(original_image=images[1], mask=mask[1]) interface.postprocessing_pipeline.matting_module(images, [trimap1, trimap2])
Issue Details: The interface.segmentation_pipeline() and interface.postprocessing_pipeline.matting_module() functions exhibit abnormal memory behavior, wherein memory consumption steadily increases over time, suggesting a memory leak. This behavior is observed despite adhering to recommended usage patterns and configuration settings provided by Carvekit.