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

Float precision #45

Open
lacan opened this issue Mar 10, 2020 · 1 comment
Open

Float precision #45

lacan opened this issue Mar 10, 2020 · 1 comment

Comments

@lacan
Copy link

lacan commented Mar 10, 2020

Hi all,

I notice on things like care, Stardist and n2v that my images are opened as 64bit numpy arrays.
Whick leads me to the question: is TensorFlow in there using 64-bit float precision? Wouldn't 32 bit be enough and reduce the memory footprint by a factor of 2?
Thanks for the discussion!

Oli

@maweigert
Copy link
Contributor

Hi Oli,

my images are opened as 64bit numpy arrays

Imo csbdeep/stardist should and will convert everything to float32 by default, as double precision is not necessary (and would be slower as you observe). Where do you see 64 bit floats generated?

E.g.

import numpy as np
from csbdeep.data import RawData, create_patches                       

x = np.random.randint(0,10,(10,100,100))                               
raw_data = RawData.from_arrays(x,x,axes = "YX")                        
X, Y, XY_axes = create_patches(raw_data, patch_size=(64,64), n_patches_per_image=10)                                                          

print(X.dtype)

dtype('float32')

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