mkkellogg / GaussianSplats3D

Three.js-based implementation of 3D Gaussian splatting
MIT License
1.09k stars 134 forks source link

The CPU memory usage reaches approximately 800MB after running a 320MB PLY file. #249

Closed lucylucy27 closed 2 weeks ago

lucylucy27 commented 3 weeks ago

I don't have a concept of this value. Is there potential to optimize this space? Thanks~

mkkellogg commented 3 weeks ago

I'm definitely aware of the excessive memory usage; it's been on my radar for a while but I just haven't had time to address it yet. I know for a fact there are opportunities for optimization :) Hopefully I'll find some time soon!

mkkellogg commented 3 weeks ago

I'm also adding some updates with this PR that should help with memory usage: https://github.com/mkkellogg/GaussianSplats3D/pull/242 This is just a preliminary effort, I'll do more of a deep-dive into optimizing memory usage in a future PR.

lucylucy27 commented 2 weeks ago

Great~ I can see that this modification has a significant impact on the CPU memory usage value after PLY loading. At the same time, we have found that the CPU memory usage peaks during the PLY file loading process. In this modification, the peak value does not seem to have improved. The plyInMemoryCompressionLevel variable in the code appears to only affect the case where streamView (progressiveLoad) is not used.

mkkellogg commented 2 weeks ago

The reason you still see the memory peaking during the PLY loading process is that the entire PLY has to be loaded into memory, then parsed into an intermediate format that can be used for compression. In the future I will try to make some improvements so that in-memory PLY files can be compressed directly, but the entire PLY will still have to be in memory before compression can happen. That's why when the progressiveLoad option is used, the PLY cannot be compressed, and theplyInMemoryCompressionLevel parameter has no effect.

lucylucy27 commented 2 weeks ago

Thank you for your explanation. :) I found that converting to *.ksplat format has a slight effect on the peak, and I guess it's because the file size itself is reduced. The peak in loading seems to be unavoidable at the moment. :)

mkkellogg commented 2 weeks ago

I plan to spend more time addressing memory consumption, so hopefully in a future PR that peak memory usage will come down.