sylvainprigent / spitfire

2D, 3D and 4D image denoising and deconvoution using sparsity based reglarization
GNU Affero General Public License v3.0
8 stars 1 forks source link

Python class missing #1

Open rohud91 opened 10 months ago

rohud91 commented 10 months ago

Hello, I am trying to run Spitfire from Jupiter notebook. I first tried just your code for Python users with C.elegans image and unfortunately, the code breaks and an error appears that the SPSFGaussian module is not present in the sdeconv.deconv library. Can you please help me with this error? thanks in advance Roman

Running code: from sdeconv.data import celegans from sdeconv.deconv import Spitfire, SPSFGaussian

load the blurry image

image = celegans()

create a PSF

psf_generator = SPSFGaussian((1.5, 1.5), (13, 13)) psf = psf_generator()

filter_ = Spitfire(psf, weight=0.6, reg=0.995, gradient_step=0.01, precision=1e-7, pad=13) deconvimage = filter(image)

Error: ImportError: cannot import name 'SPSFGaussian' from 'sdeconv.deconv'

sylvainmprigent commented 10 months ago

Hello, the PSF are in the sdeconv.psfs package. You then need to import it using "from sdeconv.psfs import SPSFGaussian"

Here is an example script: https://github.com/sylvainprigent/sdeconv/blob/main/examples/spitfire.py

rohud91 commented 10 months ago

Thank you for your help. I have a trivial question. Is the Python Spitfire algorithm running on GPU automatically or do I need to specify and install some GPU-related packages? I have TensorFlow running on my PC. Thank you for your answer. best Roman

sylvainmprigent commented 10 months ago

The Python Spitfire (in the sdeconv repository) is implemented using the pytorch library. So it runs automatically on the GPU as soon as pytorch finds the GPU. If pytorch does not find the GPU it is likely that a GPU driver is missing or a cuda or pytorch dependency is missing

Best, Sylvain