hammerlab / flowdec

TensorFlow Deconvolution for Microscopy Data
Apache License 2.0
89 stars 26 forks source link

Comparison with scikit-image / cupyimg #34

Closed chrisroat closed 4 years ago

chrisroat commented 4 years ago

I was starting to benchmark flowdec against this implemention in the cupyimg package, which aims to port ndimage and scikit-image onto the GPU using cupy.

I noticed that the scikit-image (and hence cupyimg's port) implementation suffer from problems with values near 0. I think it because it sometimes leads to a divide-by-zero. This explains why all the toy example code injects noise on the demo images!

Is flowdec a bit immune to this problem because of this filtering step or this clipping?

As a concrete example, the astronaut example you use to demonstrate edge ringing will not work directly in scikit-image's implementation without the added Poisson noise. Though, I've found it does reasonably well if you just rescale+shift the image from 0->1 to 0.5->1.

[My reason for trying cupyimg is that I'm already using cupy in my docker image, and adding tensorflow's 1.5GB is making my images even larger. For now, at least, I'm sticking with flowdec because it works on our data, since we hit the divide-by-zeros with the naive implementation.]

eric-czech commented 4 years ago

Hey @chrisroat, yea if I recall correctly the RL likelihood model is invalid if any of the intermediate arrays contain negative values (being based on poisson distributions). I saw both of those things (the filtering + clipping) in other implementations so I added them after some initial errors thrown from TF fft functions.

It's probably worth filing an issue on cupyimg given that it's more actively maintained. There is definitely precedent for that kind of adjustment in imagej and deconvolutionlab2 so I don't imagine they wouldn't want to incorporate it.

chrisroat commented 4 years ago

The cupyimg people are just mimicking scikit-image, so I may have to start there. Thanks for the info.