cvg / pixel-perfect-sfm

Pixel-Perfect Structure-from-Motion with Featuremetric Refinement (ICCV 2021, Best Student Paper Award)
Apache License 2.0
1.29k stars 132 forks source link

Release GPU memory after dense feature extraction is completed? #133

Open Bin-ze opened 5 months ago

Bin-ze commented 5 months ago

Note that pixsfm only uses the GPU to accelerate when performing dense feature extraction, and the remaining steps are completed on the CPU. However, the GPU will continue to be occupied until the entire reconstruction process is completed. I tried adding in Hierarchical-Localization/hloc/extract_features.py:

   del model
   torch.cuda.empty_cache()
   gc.collect()

However, the GPU occupied by the initialization network is still not released. Are there any methods to solve this problem?

Also, can hloc be further accelerated? For example, trading space for time, using all cores to run sfm, etc. If you can receive a reply, I would be grateful!