Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust n_tiles to prevent OOM error #24

Open
postnubilaphoebus opened this issue Jan 31, 2024 · 3 comments
Open

Adjust n_tiles to prevent OOM error #24

postnubilaphoebus opened this issue Jan 31, 2024 · 3 comments

Comments

@postnubilaphoebus
Copy link

postnubilaphoebus commented Jan 31, 2024

Hi, thank you for providing this great plugin for Napari!
Unfortunately, tensorflow crashed for me with a tif volume of dimensions 195 x 666 x 1024 and a size of 133MB:

2024-01-31 09:59:52.515119: W tensorflow/core/framework/op_kernel.cc:1839] OP_REQUIRES failed at conv_ops_3d.cc:167 : RESOURCE_EXHAUSTED: OOM when allocating tensor with shape[1,32,195,666,1024] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

Could you add some input windows to adjust the argument n_tiles?
I suspect it may be able to help with OOM issues.

@maweigert
Copy link
Member

maweigert commented Jan 31, 2024

Hi @postnubilaphoebus ,

It seems you ran model.predict_instances with the default n_tiles, which doesn't do any tiling at all. Try n_tiles=(1,2,4) (or something higher).

@postnubilaphoebus
Copy link
Author

Hi @maweigert
Thank you for the quick reply.
I will try different tile arrangements. Am I correct to assume that tiling such that 64^3 images result is best because the model was trained on such data?
I.e. I would use input_scale = (0.985, 0.96, 1) and n_tiles = (3, 10, 16) for my case (195 x 666 x 1024).

@maweigert
Copy link
Member

No, the size of tiles should not affect the result very much and thus should be as large as possible (ie. small values of n_tiles) such that it still fits into your GPU, which typically is on the order of 192^3 (thus n_tiles=(1,2,4) in your case).
Additionally, I would not scale the input as its almost isotropic anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants