Coder Social home page Coder Social logo

royerlab / aydin Goto Github PK

View Code? Open in Web Editor NEW
138.0 138.0 13.0 154.77 MB

Aydin — User-friendly, Fast, Self-Supervised Image Denoising for All.

Home Page: https://royerlab.github.io/aydin/

License: BSD 3-Clause "New" or "Revised" License

Python 99.89% Shell 0.07% Batchfile 0.03%
deep-learning denoising image image-processing machine-learning neural-network python

aydin's People

Contributors

abdur-rahmaanj avatar ahmetcansolak avatar keithchev avatar li-li-github avatar royerloic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aydin's Issues

Classic wavelet algorithm not working great

I feel like after #114 our classic wavelet algorithm started to work not-so-good @royerloic . I know it was not one of the stronger algorithms we have to start with but still wanted to drop this reminder for us to discuss to see if we can improve its denoising performance.

installation fails

Dear all,
I have tried to install Aydin.
When executing " pip install aydin",
I get the following error-message:
File "C:\Users\kirsch\Miniconda3\envs\aydin_env\lib\site-packages\pip_vendor\urllib3\response.py", line 442, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
WARNING: There was an error checking the latest version of pip.

Help would be greatly appreciated. Thanks and best,
Matthias

Changing the default save location

Is your feature request related to a problem? Please describe.
There are some users giving us feedback that default save location is making their life harder sometimes. I can understand it would be useful to see all resulting images and models etc in one folder sometimes. Currently, we are writing the resulting images/models all next to the input image in the file system. This behavior is same for all operating systems we run on.

Describe the solution you'd like
I believe ultimate solution would be being able to specific the output paths on all interfaces of Aydin which is currently work in progress (see #85 and #84). Also, default location should be adjusted if needed.

Describe alternatives you've considered

  • Saving all resulting files(images/models/etc) next to the input image in file system 🚀
  • Saving everything in a 'denoised/result' folder next to the input image in the file system 🎉
  • Your ideas?

Feel free to react with the emojis accordingly and we can use that as a poll.

ImportError with scipy 1.8.0

Describe the bug

  File "...\anaconda3\envs\aydin_env\lib\site-packages\aydin\it\deconvolution\lr_deconv_scipy.py", line 4, in <module>
    from scipy.signal.signaltools import _init_freq_conv_axes, _apply_conv_mode
ImportError: cannot import name '_init_freq_conv_axes' from 'scipy.signal.signaltools' (C:\Users\csommer\anaconda3\envs\aydin_env\lib\site-packages\scipy\signal\signaltools.py)

To Reproduce
I followed installation instructions: pip install aydin installed newest scipy (=1.8.0). Aydin attempts to import from sicpy.signal.signaltools, which does not exist anymore. Pinning scipy==1.7.1 resolved issue

Desktop (please complete the following information):

  • OS: Win10

Changing the saved model objects

Is your feature request related to a problem? Please describe.
Currently we are saving aydin.it level objects when we save a trained model. This is working out well so far but it will be a bigger convenience if we can switch to aydin.restoration level objects. That way, we can incorporate selections on specific pre/post-processing options as well. Also this will help us to simplify some of the GUI and CLI related code pieces. Important to note: This will be a breaking change and users will not be able to use their previously trained models on the earlier versions of Aydin. We are promoting use of restoration level API, we use restoration level API both on CLI and GUI ourselves. We can make our saved models compatible at restoration level API too.

Describe the solution you'd like
Moving the business logic in aydin.it.base to aydin.restoration.denoise.base or maybe somewhere else to comfort deconvolution restorations too.

Describe alternatives you've considered
An alternative could be not making such breaking change but as we want to implement further features regarding saving/loading models, it only introduces more complications due to nature of our client code(which tries to stick to restoration level API).

Can CatBoost Regressor tests finish faster?

After merging #124 , I started to observe some denoising performance and test duration issues with cb regressor tests. With the help of a minor tuning I introduced in #129, I was able to make cb regressor tests more robust and pass each time we run them. I am questioning if we can still shorten the test durations while keeping the robustness we gained. Any ideas @royerloic ?

scale/zoom GUI (Aydin Studio)

Hi
I think it's a good idea to add a zoom or scale to the Aydin Studio in some parts the text is very small and you can't read it!
And I'm the real Aydin 😉.

Catboost is not choosing the bigger GPU

I started to observe that Catboost is not choosing the bigger(one with more free memory) GPU available on multi-gpu machines. Dropping this reminder here to look into this later on.

cannot convert float NaN to integer

Traceback (most recent call last):
File "C:\Users\xxxxxx\Miniconda3\envs\aydin_env\lib\site-packages\aydin\gui_qt\job_runners\worker.py", line 60, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\xxxxxx\Miniconda3\envs\aydin_env\lib\site-packages\aydin\gui_qt\job_runners\denoise_job_runner.py", line 67, in start_func
denoised = self.denoiser.denoise(
File "C:\Users\xxxxxx\Miniconda3\envs\aydin_env\lib\site-packages\aydin\restoration\denoise\classic.py", line 349, in denoise
response = self.it.translate(
File "C:\Users\xxxxxx\Miniconda3\envs\aydin_env\lib\site-packages\aydin\it\base.py", line 393, in translate
tilling_strategy, margins = self._get_tilling_strategy_and_margins(
File "C:\Users\xxxxxx\Miniconda3\envs\aydin_env\lib\site-packages\aydin\it\base.py", line 569, in _get_tilling_strategy_and_margins
spatiotemp_tilling_strategy = tuple(
File "C:\Users\xxxxxx\Miniconda3\envs\aydin_env\lib\site-packages\aydin\it\base.py", line 570, in
max(1, min(rest_split_factor, int(math.ceil(split_per_dim * s))))
ValueError: cannot convert float NaN to integer

System:
Intel Xeon Gold 6256 CPU 3.6Ghz
RAM 1TB

Windowns Server 2016 ver1607

Aydin

BUG: snr_estimate

Describe the bug
snr estimate tests/demos are broken. @royerloic do you have any ideas what might be wrong?

To Reproduce
To reproduce, one can run the aydin/analysis/demo/demo_snr_estimate.py or the snr estimate test, which is calling the demo file.

Expected behavior
Asserts to execute successfully.

Desktop (please complete the following information):

  • OS: OSX, Ubuntu 20.04]
  • Version: latest master

Additional context
Probably some changes introduced in #144 changed the behavior of the aforementioned part of the code.

Problem with Aydin installation

I get the following code when I try to launch aydin 0.0.15:
``(aydin_env) C:\Users\Mary Brown>aydin
Traceback (most recent call last):
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Mary Brown.conda\envs\aydin_env\Scripts\aydin.exe_main
.py", line 4, in
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\aydin\cli\cli.py", line 16, in
from aydin.gui.gui import run
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\aydin\gui\gui.py", line 7, in
from aydin.gui.main_page import MainPage
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\aydin\gui\main_page.py", line 27, in
from aydin.gui.tabs.qt.denoising_cropping import DenoisingCroppingTab
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\aydin\gui\tabs\qt\denoising_cropping.py", line 1, in
from aydin.gui.tabs.qt.base_cropping import BaseCroppingTab
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\aydin\gui\tabs\qt\base_cropping.py", line 2, in
from napari.qt.qt_viewer import QtViewer
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari_qt_init
.py", line 6, in
from ..utils.translations import trans
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils_init
.py", line 2, in
from .colormaps import Colormap
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils\colormaps_init.py", line 2, in
from .colormap import Colormap
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils\colormaps\colormap.py", line 7, in
from ..events import EventedModel
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils\events_init_.py", line 1, in
from .event import ( # isort:skip
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils\events\event.py", line 73, in
from ..translations import trans
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils\translations.py", line 13, in
from ._base import _DEFAULT_CONFIG_PATH, _DEFAULT_LOCALE
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\napari\utils_base.py", line 14, in
_DEFAULT_CONFIG_PATH = user_config_dir(_APPNAME, _APPAUTHOR, _FILENAME)
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\appdirs.py", line 196, in user_config_dir
path = user_data_dir(appname, appauthor, None, roaming)
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\appdirs.py", line 81, in user_data_dir
path = os.path.normpath(_get_win_folder(const))
File "C:\Users\Mary Brown.conda\envs\aydin_env\lib\site-packages\appdirs.py", line 480, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.

I am not learned in computer coding and I'm not sure how to interpret this. What is wrong with my Aydin 0.1.15 installation? Will you create an exe or msi Windows installation file for this new version of Aydin? Thank you.

aydin_0.1.11_linux.zip needs glibc >= 2.18

Describe the bug
The linux bundled version is not compatible with CentOS-7 x86_64. Missing documentation requirement...

To Reproduce
Steps to reproduce the behavior:

  1. wget https://github.com/royerlab/aydin/releases/download/v0.1.11/aydin_0.1.11_linux.zip
  2. unzip aydin_0.1.11_linux.zip
  3. cd aydin_0.1.11_linux/
  4. ./run_aydin.sh

Expected behavior
aydin starting as explained https://royerlab.github.io/aydin/getting_started/install.html#install-aydin-bundle-on-linux

Screenshots

[tru@sillage aydin_0.1.11_linux]$ ./run_aydin.sh 
Traceback (most recent call last):
  File "build/linux/runtimehooks/hook-splash.py", line 1, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
  File "matplotlib/__init__.py", line 107, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
  File "matplotlib/rcsetup.py", line 26, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
  File "matplotlib/colors.py", line 82, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
  File "matplotlib/scale.py", line 18, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
  File "matplotlib/ticker.py", line 179, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
  File "matplotlib/transforms.py", line 46, in <module>
ImportError: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /dev/shm/aydin_0.1.11_linux/aydin/libstdc++.so.6)
[13014] Failed to execute script 'hook-splash' due to unhandled exception!

Desktop (please complete the following information):

  • OS: CentOS-7 x86_64 (up to date)
  • Version: 7.9.2009

Additional context

[tru@sillage aydin_0.1.11_linux]$ rpm -q glibc
glibc-2.17-325.el7_9.x86_64
glibc-2.17-325.el7_9.i686

Installation Issue with cudatoolkit, installed after Aydin in Conda environment

I found that installation of Aydin prior to CUDA support causes issues in the installation of the Cudatoolkit, resulting an aborted install.

To Reproduce
Steps to reproduce the behavior:

  1. Create the conda environment and install Aydin

conda create -n aydin_env python=3.9
conda activate aydin_env
pip install aydin

  1. Install cudatoolkit

conda install cudatoolkit

Expected behavior
The cudatoolkit install will take a very long time and then abort with a setup script error and then will roll back the installation.

Desktop (please complete the following information):

  • Windows 10
  • Anaconda 4.6.8

Solution
I was successful in installing CUDA support and Aydin by installing the cudatoolkit and python 3.9 at the same time during the creation of the aydin environment and THEN installing Aydin via pip, by doing the following:

  1. Create the conda environment and install cudatoolkit and then installing Aydin

conda create -n aydin_env python=3.9 cudatoolkit
conda activate aydin_env
pip install aydin

Migration to PyQt6

As discussed in #297 , switching to PyQt6 can benefit us on portability end. Creating this issue to collect observations/suggestions around this migration.

Add algorithm variants to docstring

Is your feature request related to a problem? Please describe.
I was just using aydin.restoration.denoise.classic.classic_denoise and received an error because I didn't specify the variant parameter. When trying to find out what variants exist, I had to go to the source code.

Describe the solution you'd like
Would it be possible to add the available variants to the docstring?

Also this docstring appears misleading.

rep_crop ZeroDivisionError

Describe the bug
We get a ZeroDivisionError with an image shape of (2, 84, 580, 576). This issue is a reminder to our future selves.

To Reproduce
Steps to reproduce the behavior:

  1. Get two 3D timepoints
  2. Make hyperstack with t=2
  3. Run denoising
  4. See error

Expected behavior
No error, smooth run.

Screenshots

Traceback (most recent call last):
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/gui/_qt/job_runners/worker.py", line 60, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/gui/_qt/job_runners/denoise_job_runner.py", line 60, in start_func
    self.denoiser.train(
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/restoration/denoise/noise2selffgr.py", line 279, in train
    self.it.train(
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/it/base.py", line 280, in train
    self.blind_spots, autocorrelogram = auto_detect_blindspots(
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/analysis/blind_spot_analysis.py", line 105, in auto_detect_blindspots
    image = representative_crop(image, crop_size=int(1e6), favour_odd_lengths=True)
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/util/crop/rep_crop.py", line 235, in representative_crop
    translation = tuple(
  File "/Users/ahmetcan.solak/Dev/AhmetCanSolak/aydin/aydin/util/crop/rep_crop.py", line 236, in <genexpr>
    (randrange(0, max(1, (s - cs) // g)) * g if cs != s else 0)
ZeroDivisionError: integer division or modulo by zero

Additional context
Add any other context about the problem here.

issue with setting up the development environment.

Describe the bug
Have errors running the test case after setting up the development environment following instructions described here: https://github.com/royerlab/aydin/blob/master/CONTRIBUTING.md

The following steps were successful (see screenshots below for details).

conda create -n aydin python=3.9
conda activate aydin
pip install -e .
pip install -r requirements/development.txt

Two problems were encountered after the installation (following the instructions):

  1. Running the tests using python -m pytest . --disable-pytest-warnings --show-capture=stderr results in error reports. (Please see tests errors under "Additional context" below for details.).
  2. Directly starting Aydin from the mac terminal by typing "aydin" resulted in errors. (Please see "Aydin starting up error" under "additional context" below for details) .

To Reproduce
To reproduce, one can follow the instructions to setup development environment in the contributing guidelines. (assuming the error is not system dependent).

Expected behavior
Get error messages described above and shown in "additional context" below.

Desktop

  • OS: macOS Monterey
  • Version: 12.3.1

Additional context
The following message shows that the installation is successful:
Screen Shot 2022-06-12 at 4 53 17 PM

tests errors
Here are the error messages after running the tests:
Screen Shot 2022-06-12 at 4 54 14 PM
Screen Shot 2022-06-12 at 4 55 54 PM
Screen Shot 2022-06-12 at 4 56 18 PM
Screen Shot 2022-06-12 at 4 57 30 PM

Aydin starting up error
Here are the error messages after trying to start Aydin under the development environment:
Screen Shot 2022-06-12 at 4 58 44 PM
Screen Shot 2022-06-12 at 4 59 42 PM

Dataflow and class hierarchy diagrams

Is your feature request related to a problem? Please describe.
The feature is to help new developers:
It would be nice to have a data flow diagram and a class hierarchy diagram to provide a quick and concise overview of the Aydin architecture. It would be helpful for a new developer to keep track of the many layers of parent/child classes when attempting to decipher the package structure by tracing the code in an execution).

Describe the solution you'd like
Two pictures describing the data flow and class hierarchy diagrams might be enough.

Describe alternatives you've considered
If it gets too complicated to capture the architecture using static diagrams, it would be nice to have a website like VTK's documentation page. VTK is quite complicated, I'm only using it as an example to explain the idea, but please don't perceive it as an expectation :D.

Additional context
N.A.

Installation issues on Windows 10 enterprise

Describe the bug
Hello Aydin Team. I have been trying to get Aydin to work on my labs processing station equipped with high end processor and GPU. I have been able to download and extract the Zip file without issue. However, when I try to run the Batch file, my terminal pops open for ~1s the first time after install and then for milliseconds on subsequent attempts at running the batch file. The terminal then closes itself and Aydin never opens.

To Reproduce
Steps to reproduce the behavior:

  1. download Aydin windows package
  2. extract all from zip file
  3. open uncompressed folder
  4. Click on run_aydin windows batch file (on Windows 10 enterprise)

Expected behavior
Windows terminal opens for between 0 and 1 second before closing. Nothing occurs after

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise
  • Version 10.0.18362 Build 18362

Additional context
Add any other context about the problem here.

Not finding model zipped folder

Hi,
It seems that, for some reason I cannot figure out, Aydin cannot find the zipped model file.
It does not happen every time, so I do not think it is an installation issue.
I would say it is rather a problem with zipping the folder, as the folder is in place and with a bunch of files inside:

/home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_options3.json
/home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_denoised3.tif
/home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3
  /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/channel0
    /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/channel0/lgbm_model.txt
    /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/channel0/regressor_model.json
  /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/channel1
    /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/channel1/lgbm_model.txt
    /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/channel1/regressor_model.json
  /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/feature_generation.json
  /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/image_translation.json
  /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3/regressor.json
DONE, options json written in /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_options3.json 
├╗ Saving 'fgr' image translator to /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3 
│├  Saving image translator to: /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3 
│├  Saving feature generator to: /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3 
│├  Saving regressor to: /home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3 
│┴« 6.02 seconds 
│ 
├  Previously existing model will be deleted before saving the new model 
Traceback (most recent call last):
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/shutil.py", line 815, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '20211103_Aux-async_1225_p008_training.ome_model3.zip' -> '/home/julio/temp/Aydin_tests/20211103_Aux-async_1225_p008_training.ome_model3.zip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/site-packages/aydin/gui/_qt/job_runners/worker.py", line 67, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/site-packages/aydin/gui/_qt/job_runners/denoise_job_runner.py", line 81, in start_func
    self.denoiser.save_model(model_path)
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/site-packages/aydin/restoration/denoise/base.py", line 167, in save_model
    self.archive_model(model_path, os.path.dirname(model_path))
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/site-packages/aydin/restoration/denoise/base.py", line 153, in archive_model
    shutil.move(f"{name}.{format}", destination)
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/shutil.py", line 835, in move
    copy_function(src, real_dst)
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/shutil.py", line 444, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/julio/.conda/envs/aydin_env/lib/python3.9/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '20211103_Aux-async_1225_p008_training.ome_model3.zip

OS is Fedora34
installation through conda

Do you have an idea of something I could try?

aydin bundle fails to start on linux with fontconfig 2.13/2.14

Describe the bug
Unpacking the aydin bundle and trying to run ./run_aydin.sh on a linux (fedora or arch) box with fontconfig 2.13 or fontconfig 2.14 installed at the OS level fails with

Fontconfig warning: "/etc/fonts/fonts.conf", line 5: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/11-lcdfilter-default.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/30-metric-aliases.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/40-nonlatin.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/45-generic.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/45-latin.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/48-spacing.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/49-sansserif.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/51-local.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/60-generic.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/60-latin.conf", line 4: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/65-nonlatin.conf", line 4: unknown element "description"
Fontconfig warning: FcPattern object weight does not accept value [40 210)

(even though these are listed as "warnings", they seem to break the process).
(@AhmetCanSolak You may remember that I communicated this issue to you privately as well.)

To Reproduce
See above.

Expected behavior
No error.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Fedora 35 or Arch Linux (rolling)
  • Version: N/A

Additional context
I believe this occurs because the aydin process from the bundle uses the bundled libfontconfig.so (which is 2.12.06), but the fontconfig config files that comes with the OS (at /etc/fonts/conf.d), which use elements ("description") that are only understood by newer versions of fontconfig. Forcing the use of OS-level fontconfig (and the corresponding dependencies freetype and harfbuzz) via LD_PRELOAD =/usr/lib/libfreetype.so:/usr/lib/libharfbuzz.so:/usr/lib/libfontconfig.so solves the issue, for example; perhaps it could work to just not vendor these shared objects and assume that the host OS has recent enough versions of them? (possibly pre-running a small check that this is indeed the case)

Disabling spatial features in the presence of a cropped training image

We need a feature that will disable spatial features when training image is cropped. Otherwise indexing on the training crop not necessarily matching the global indexing on the whole image and spatial features become useless. I tagged as bug also as currently a user can make a training crop and enable spatial features without any problem.

aydin fails to install on Windows

Describe the bug
Installing aydin via conda or pip on a Windows installation fails because of an incompatibility error with napari and pydantic.

To Reproduce
Steps to reproduce the behavior:

  1. Run conda installation instructions from (https://github.com/royerlab/aydin).
  2. Run aydin in the bash.

Expected behavior
A clear and concise description of what you expected to happen.
Expect aydin GUI, but instead the following error appears:

> [...]
>     raise AttributeError(f'module {module!r} has no attribute {name!r}')                                                                                                                                                                                                                                                                                  AttributeError: module 'pydantic.main' has no attribute 'ModelMetaclass'

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • Windows 10 Education Version 10.0.19045 Build 19045
  • GPU: NVIDIA GeForce RTX 2080 Super - Cuda compilation tools, release 11.4, V11.4.100 Build cuda_11.4.r11.4/compiler.30188945_0

Additional context
Add any other context about the problem here.

Running pip install napari --upgrade resolves the issue.

Possible error on random patch generation method

Upon some discussion with @li-li-github today, we realized behavior of the current random patch generation method might be different than what was desired. We wrote the pseudo-code below as a reference for desired behavior. I will be implementing it to compare with existing implementation and then we can possibly discover opportunities for code optimization.

List[slice_objects] generate_random_patches(
    image:BXYZC,
    adoption_rate,
    patch_size,
    nb_patches_per_image, 
):
    list_of_slice_objects = []

    for b in B:
        patches_per_b = generate_patches_per_b(nb_patches_per_image / adoption_rate)

        sorted_patches = sort_entropies_of_histograms_of_patches_per_b()

        result = filter(sorted_patches, adoption_rate)

        list_of_slice_objects.append(make_slice_object(result))

    response = vstack(list_of_slice_objects)

    return response

Documentation refers to inexistent command "noise2self". CLI proposes "denoise".

<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ aydin noise2self image.tif

<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ aydin noise2self image.tif --lower-level-args<span class="o">=</span>image_options.json

<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ aydin noise2self image.tif --model-path<span class="o">=</span>image_model.zip --use-model

CLI saveload test

Currently, we do not have a test case for CLI where we denoise and saved the model and load it back and denoise an image to verify such usage. We should implement it but it is not urgent. This is issue created as a reminder.

Use a pyside2-based approach instead of pyqt5

PyQt5 does not provide commercial support by default. PySide2 is PyQt5 with a commercial-friendly lib. Migrating means only renaming imports mainly and few refinements here and there.

QDarkStyle==3.0.2 and qtpy==1.11.2 both supports pyside2 even pyside6. Switching to pyside might provide an even better business adoption.

[SUGGESTION] More algos, more fun ? (plugins ?)

Since aydin is THE defacto more comprehensive denoising suite, it would be great to implement all useful/efficient/functional algorithms available on "the scene" - or, at least, on github - in it (note: could a "plugins-like approach" stimulate respective authors to release them independently?).

Here's some (re)sources we've collected some time ago (some are certainly already implemented in aydin, sorry):

Hope that inspires and, if you like, more will come.

EDIT: forgot to add some "awesome lists":

Unable to load pre-trained model using the api

Hello,
I am trying to denoise a batch of images with a pre-trained FGR (CatBoost) model.

To Reproduce

from aydin.restoration.denoise.noise2selffgr import Noise2SelfFGR
from tifffile import imread

noisy_image_path = 'path/to/noisy_im.tif'
noisy_image = imread(noisy_image_path)
n2s = Noise2SelfFGR(variant = 'cb', use_model = True, input_model_path = "path/to/pretrained_model.zip")
denoised = n2s.denoise(noisy_image)

Expected behavior
I can run the equivalent command through the command line:

aydin denoise *.tif --model-path=path/to/pretrained_model.zip --model-model

and see that aydin quickly generates denoised images with the pretrained model.

Screenshots
image

Desktop (please complete the following information):

  • The error repeats on both Ubuntu 22.04.2 LTS and Windows 11
  • Version: aydin 0.10.15 installed with pip

Additional context
I tried installing the main github branch in a separate environment and the error persisted.

This is amazing software, thank you to all the developers!

Removing numexpr and refactoring related code with Numba

Out of curiosity, I benchmarked our normalisation code(which currently uses numexpr) against vanilla numpy implementation and Numba CPU implementation. Here are the results:

Array size 2560:
numba CPU 7.586696507001761
numexpr 246.33255801402265
numpy 191.35872586001642

Array size 256:
numba CPU 5.624689556017984
numexpr 32.61893176403828
numpy 24.161521231988445

Given these results, I like to suggest a refactor where we replace numexpr code with numba code. Refactor PR will include a more complete benchmark result as well.

import in API docs gives error

Describe the bug
Thanks for the great library! As described in the API docs, I tried from aydin.restoration.denoise.noise2self_fgr import noise2self_fgr and received a ModuleNotFoundError. Perhaps it should be from aydin import noise2self_fgr?

To Reproduce
Steps to reproduce the behavior:

  1. Open python terminal
  2. Try from aydin.restoration.denoise.noise2self_fgr import noise2self_fgr
  3. See error

Expected behavior
Should import the noise2self_fgr() function

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

aydin fails to install on Apple M1

Describe the bug
Installing aydin via pip on an Apple M1 fails because of an error installing pyqt5.

To Reproduce
Obtain a 2021 Apple M1 Macbook Pro and attempt to install aydin:

conda create -y -n aydin-env python=3.
conda activate aydin-env
pip install aydin

This results in an error when installing pyqt5:

Collecting PyQt5>=5.15.6
  Using cached PyQt5-5.15.9.tar.gz (3.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

Desktop (please complete the following information):
macOS Monterey (12.5) on Apple M1 (arm64)

Torch does not have access to GPU after Aydin installation

Describe the bug
After following the conda installation instructions from (https://github.com/royerlab/aydin) pytorch does not have access to the GPU.

To Reproduce
Steps to reproduce the behavior:

  1. Run conda installation instructions from (https://github.com/royerlab/aydin).
  2. Run python in the bash.
  3. Run import torch.
  4. Run torch.cuda.is_available().

Expected behavior
Expected True but gives False

Screenshots
image

Desktop (please complete the following information):

  • Windows 10 Enterprise LTSC
  • GPU: NVIDIA Quadro P1000
  • Cuda compilation tools, release 11.6, V11.6.124
    Build cuda_11.6.r11.6/compiler.31057947_0

Additional context
Interestingly after also installing cudnn with conda install cudnn, tensorflow successfully can find the GPU using:
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

Using Aydin on Mac BigSur Chip M1

Describe the bug
I installed Aydin on my Mac, but can't open it (while worked well on a PC). I got this error on the terminal:

Last login: Thu Nov 11 12:10:33 on ttys001
/Applications/aydin_0.1.9.app/Contents/MacOS/aydin ; exit;
(base) -MacBook-Pro ~ % /Applications/aydin_0.1.9.app/Contents/MacOS/aydin ; exit;
zsh: illegal hardware instruction  /Applications/aydin_0.1.9.app/Contents/MacOS/aydin
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

Not sure what the problem is. I wonder if it could be a problem of compatibility with Apple M1 chip. Could you help me please?

Desktop (please complete the following information):

  • OS: macOS BigSur
  • Version 11.2.1 (20D74)

[REQ] SCUNet and colab

Hi there, 1st of all thanks for your (voluntary) work !

It would be cool to have the "Practical Blind Denoising via Swin-Conv-UNet and Data Synthesis" implemented in aydin:

git: https://github.com/cszn/SCUNet
online demo: https://replicate.com/cszn/scunet
vs-implementarion: https://github.com/HolyWu/vs-scunet

Last but not least it would be also cool to "transpose" aydin into a Jupiter notebook like these:
https://colab.research.google.com/github/jantic/DeOldify/blob/master/ImageColorizerColabStable.ipynb
https://github.com/XPixelGroup/BasicSR/tree/master/colab
https://replicate.com/cszn/scunet
...

Hope that inspires !

note: just pushed aydin @ Doom9 too

Refactoring aydin.it.cnn to aydin.it.torch

Is your feature request related to a problem? Please describe.
We are planning to drop tensorflow/keras dependencies and switch to pytorch. This is a big breaking change and it will be on multiple critical pivot points in the code base. One of those points is the aydin.it level API that we use to serve current tensorflow/keras models. Currently, aydin.it.cnn has so much business logic that is tightly bounded with current unet/jinet keras implementations. For the sake of a more modular design we are planning to change this. Also we can refine our aydin.it level API to comfort any model that might be implemented with pytorch, not only CNNs.

Describe the solution you'd like
I am here suggesting to refactor/re-write a new API on aydin.it level to serve all models implemented with torch right now and future models. As a complementary change, also, I am suggesting to rename our module to a more generic name such as aydin.it.torch.

Describe alternatives you've considered
An alternative idea could be implementing a new module for each new pytorch model in aydin.it level package. This would clutter the aydin.it subpackage and cause code-duplication (probably) often. Another alternative could be sticking to old approach and keep extending the amount business logic implemented in aydin.it.cnn but as we already experience this is not really a sustainable option.

MAC installation with libomp installed

Describe the bug
Unable to start AydinStudio even with libomp installed with brew.
It seems to me that aydin is looking for the libomp in /usr/local/opt/libomp instead of /Users/tl10/homebrew/Cellar/libomp/ where brew by default install libraries to ?

To Reproduce
Steps to reproduce the behavior:

  1. Following this section: https://royerlab.github.io/aydin/getting_started/install.html#install-aydin-in-a-conda-environment-with-cuda-support
  2. Run aydin in termal
❯ aydin
<class 'OSError'> dlopen(/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so
  Reason: image not found <traceback object at 0x7f834cb109c0>
Traceback (most recent call last):
  File "/Users/tl10/miniconda3/envs/aydin_env/bin/aydin", line 8, in <module>
    sys.exit(cli())
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/click/core.py", line 1637, in invoke
    super().invoke(ctx)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/cli/cli.py", line 47, in cli
    run(VERSION)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/gui/gui.py", line 123, in run
    ex = App(ver)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/gui/gui.py", line 37, in __init__
    self.main_widget = MainPage(self, self.threadpool)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/gui/main_page.py", line 60, in __init__
    "Denoise": DenoiseTab(self),
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/gui/tabs/qt/denoise.py", line 63, in __init__
    ) = get_list_of_denoiser_implementations()
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/restoration/denoise/util/denoise_utils.py", line 59, in get_list_of_denoiser_implementations
    descriptions += denoiser_class().implementations_description
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/restoration/denoise/noise2selffgr.py", line 148, in implementations_description
    response = importlib.import_module(regression.__name__ + '.' + module.name)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/aydin/regression/lgbm.py", line 6, in <module>
    import lightgbm
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/__init__.py", line 8, in <module>
    from .basic import Booster, Dataset, Sequence, register_logger
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/basic.py", line 110, in <module>
    _LIB = _load_lib()
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/basic.py", line 101, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/ctypes/__init__.py", line 460, in LoadLibrary
    return self._dlltype(name)
  File "/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/tl10/miniconda3/envs/aydin_env/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so
  Reason: image not found

Expected behavior
AydinStudio running with GUI

Screenshots
Where the current libomp is installed:

❯ brew info libomp
libomp: stable 13.0.0 (bottled)
LLVM's OpenMP runtime library
https://openmp.llvm.org/
/Users/tl10/homebrew/Cellar/libomp/13.0.0 (9 files, 1.6MB) *
  Poured from bottle on 2021-12-14 at 12:15:36
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libomp.rb
License: MIT

Desktop (please complete the following information):

  • OS: OSX
  • Version : catalina 10.15.7

Exposing off-core array arguments at higher level APIs and interfaces

We have a beautiful piece of code that enables us allocating off-core arrays either with numpy.memmap or using zarr-backed arrays, however, I found it pity that we are not exposing the choice on this in our interfaces to our users. We can address this situtation in it level API I believe, after further confirmation I will make a PR to address this.

GUI: Cropping Tabs Showing Range of Sliders

I noticed sometimes the representative_crop we computed is only slightly smaller than the original image(for small images like lizard_noisy for example). This disables the spatial_features, as it should, but it is not clear enough for user to notice they are actually cropping their image on the cropping tabs. To make these kind of situations easier to interpret, I here suggest adding a static range label to our XYZT sliders on the cropping tabs. I don't think this is urgent but wanted to drop this issue as a reminder to address later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.