cvg / DeepLSD

Implementation of the paper "DeepLSD: Line Segment Detection and Refinement with Deep Image Gradients"
MIT License
487 stars 62 forks source link

Memory leak in pytlsd. #13

Closed lnexenl closed 1 year ago

lnexenl commented 1 year ago

I am trying to train your network on some other dataset. However, when generating groundtruth with LSD, I found that there's a heavy memory leak in pytlsd. My PC has 32G ram, and my PC will OOM in several minutes when generating groundtruth. Shown in image: image

I found that your pytlsd code is forked from https://github.com/iago-suarez/pytlsd, and I substitute your version with iago-suarez's version, and there is no memory leak anymore. I think it might be useful by merging iago-suarez's repository into yours.

rpautrat commented 1 year ago

Hi, yes I was aware of this issue and it is on my todo list to fix it. As a quick workaround, one can substitute the original pytlsd when generating the ground truth. However, when using DeepLSD at test time, the fork is necessary to be able to use the new 'grad_nfa' option, which keeps the NFA check proposed in LSD, based on the image gradient. This can filter out many noisy lines. I will try to look into this once I find the time for it.

lnexenl commented 1 year ago

Hi, I dived into the code and found some problem. Memory leak is solved now on my PC, and I open a PR for this: https://github.com/rpautrat/pytlsd/pull/1

rpautrat commented 1 year ago

Sorry for the late reply, and thanks a lot for the fix!!