dorverbin / fieldofjunctions

Implementation of paper: Field of Junctions
http://vision.seas.harvard.edu/foj/
20 stars 8 forks source link

Running out of memory #1

Open ariel415el opened 2 years ago

ariel415el commented 2 years ago

Hi,

I'm using the foj_demo.ipynb code to run FOJ on my images but I run out of memory with the default parameters even though running with 40G of GPU memory.

For example a 128x128 image takes ~25G of GPU memory for the Initialization steps and ~36G for the Refinement Is this normal? I can't run with larger images.

I would love to learn how did you generate the demo images from the project site

ariel415el commented 2 years ago

I just saw you mentioned this in the Readme.

When setting the parallel_mode config to False a 128x128 image needs ~2.5G for Initialization and ~4.8G for Refinement.

But what about big images? I still want to hear how you menaged to work on such big images like the ones in project site

Thanks

dorverbin commented 2 years ago

The memory footprint is proportional to (R / s)^2 * H * W, where R is the patch size, s is the stride, and HxW is the image size. In general, a stride of ~R/3 is usually sufficient, especially at relatively low noise levels. The images in the project page were run using s > 1 and parallel_mode = False in order for them to fit in memory. It's not implemented at the moment, but it's also possible to reduce memory consumption during initialization by initializing a subset of the patches at one time instead of all of them at once.