#author("2025-03-20T01:30:43+00:00","default:sysosa","sysosa") #author("2025-08-08T17:27:25+00:00","default:sysosa","sysosa") 本家様 [[https://github.com/apeck12/denoiset>+https://github.com/apeck12/denoiset]] 「An implementation of Noise2Noise for cryoET data」 ***インストール [#n51186e5] ***環境 [#f4d588ca] #code(nonumber){{ source /apps/pyenv/versions/anaconda3-2024.10-1/etc/profile.d/conda.sh [root@rockylinux9 ~]# cat /etc/redhat-release Rocky Linux release 9.6 (Blue Onyx) [root@rockylinux9 ~]# cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 570.181 Release Build (dvs-builder@U22-I3-AF02-20-5) Wed Jul 30 18:41:07 UTC 2025 GCC version: gcc version 11.5.0 20240719 (Red Hat 11.5.0-5) (GCC) (pyenv/anacondaが未構築なら下記で構築) [root@rockylinux9 ~]# }} ***pyenv-anacondaの設置 [#t1c137a6] #code(nonumber){{ git clone https://github.com/yyuu/pyenv.git /apps/pyenv export PYENV_ROOT=/apps/pyenv export PATH=$PYENV_ROOT/bin:$PATH pyenv install anaconda3-2024.10-1 source /apps/pyenv/versions/anaconda3-2024.10-1/etc/profile.d/conda.sh pyenv install anaconda3-2025.06-1 pyenv global anaconda3-2025.06-1 source /apps/pyenv/versions/anaconda3-2025.06-1/etc/profile.d/conda.sh conda update conda (その後に) (既に環境があるなら) cd /apps git clone https://github.com/apeck12/denoiset.git cd denoiset source /apps/pyenv/versions/anaconda3-2025.06-1/etc/profile.d/conda.sh }} conda create --name denoiset python=3.11.4 conda activate denoiset っと準備を終わらせます pip install . ***構築 [#f9053361] gitのドキュメントの記載通りに作ります #code(nonumber){{ [root@rockylinux9 ~]# cd /apps/ [root@rockylinux9 apps]# git clone https://github.com/apeck12/denoiset.git [root@rockylinux9 apps]# cd denoiset/ [root@rockylinux9 denoiset]# ls -CF LICENSE models/ pyproject.toml README.md src/ tests/ [root@rockylinux9 denoiset]# conda create --name denoiset python=3.11.4 [root@rockylinux9 denoiset]# conda activate denoiset (denoiset) [root@rockylinux9 denoiset]# pip install . [ちょいと確認] (denoiset) [root@rockylinux9 denoiset]# conda list : denoiset 0.1.0 pypi_0 pypi : numpy 1.26.4 pypi_0 pypi nvidia-cublas-cu12 12.8.4.1 pypi_0 pypi nvidia-cuda-cupti-cu12 12.8.90 pypi_0 pypi nvidia-cuda-nvrtc-cu12 12.8.93 pypi_0 pypi nvidia-cuda-runtime-cu12 12.8.90 pypi_0 pypi nvidia-cudnn-cu12 9.10.2.21 pypi_0 pypi nvidia-cufft-cu12 11.3.3.83 pypi_0 pypi nvidia-cufile-cu12 1.13.1.3 pypi_0 pypi nvidia-curand-cu12 10.3.9.90 pypi_0 pypi nvidia-cusolver-cu12 11.7.3.90 pypi_0 pypi nvidia-cusparse-cu12 12.5.8.93 pypi_0 pypi nvidia-cusparselt-cu12 0.7.1 pypi_0 pypi nvidia-nccl-cu12 2.27.3 pypi_0 pypi nvidia-nvjitlink-cu12 12.8.93 pypi_0 pypi nvidia-nvtx-cu12 12.8.90 pypi_0 pypi : python 3.11.4 h955ad1f_0 : torch 2.8.0 pypi_0 pypi : (denoiset) [root@rockylinux9 denoiset]# conda deactivate [root@rockylinux9 denoiset]# }} 事前学習済みモデルも同封されている様子 ***environment-modules [#n897664f] 「/apps/modulefiles/DenoisET」 #code(nonumber){{ #%Module1.0 module load AreTomo3 set root /apps/pyenv/versions/anaconda3-2025.06-1/envs/denoiset prepend-path PATH $root/bin }} ***Run [#yd3d0464] 事前学習済みモデルは git に同封されているようで、この場合は 「/apps/denoiset/models/」に用意されています #code(nonumber){{ denoise3d --help [root@rockylinux9 ~]# ls -l /apps/denoiset/models/ total 56736 -rw-r--r--. 1 root root 11615396 Aug 9 01:44 cilia.pth -rw-r--r--. 1 root root 11617622 Aug 9 01:44 lysosome.pth -rw-r--r--. 1 root root 11617622 Aug 9 01:44 minicell.pth -rw-r--r--. 1 root root 11618002 Aug 9 01:44 phantom.pth -rw-r--r--. 1 root root 11617736 Aug 9 01:44 synaptosome.pth [root@rockylinux9 ~]# }} っでコマンド denoise3d を使用します #code(nonumber){{ [saber@rockylinux9 ~]$ module use /apps/modulefiles [saber@rockylinux9 ~]$ module load DenoisET [saber@rockylinux9 ~]$ denoise3d --help usage: denoise3d [-h] --input INPUT [--model MODEL] --output OUTPUT [--pattern PATTERN] [--metrics_file METRICS_FILE] [--min_selected MIN_SELECTED] [--max_selected MAX_SELECTED] [--sort_by SORT_BY] [--tilt_axis TILT_AXIS] [--thickness THICKNESS] [--global_shift GLOBAL_SHIFT] [--bad_patch_low BAD_PATCH_LOW] [--bad_patch_all BAD_PATCH_ALL] [--ctf_res CTF_RES] [--ctf_score CTF_SCORE] [--odd_pattern ODD_PATTERN] [--odd_extension ODD_EXTENSION] [--n_extract N_EXTRACT] [--seed SEED] [--optimizer OPTIMIZER] [--learning_rate LEARNING_RATE] [--batch_size BATCH_SIZE] [--val_fraction VAL_FRACTION] [--n_epochs N_EPOCHS] [--n_denoise N_DENOISE] [--length LENGTH] [--train_only] [--ch_threshold CH_THRESHOLD] [--train_all_epochs] [--exclude_tags EXCLUDE_TAGS [EXCLUDE_TAGS ...]] [--inf_length INF_LENGTH] [--inf_padding INF_PADDING] [--live] [--t_interval T_INTERVAL] [--t_exit T_EXIT] options: -h, --help show this help message and exit --input INPUT Input directory of tomograms or a text file specifying their full path (minus extension) --model MODEL Pre-trained UNet3d model file --output OUTPUT Output directory for denoised volumes --pattern PATTERN Glob pattern for file basename --metrics_file METRICS_FILE AreTomo3 TiltSeries_Metrics.csv file --min_selected MIN_SELECTED Minimum number of selected tomograms if in_path is a metrics file --max_selected MAX_SELECTED Maximum number of selected tomograms if in_path is a metrics file --sort_by SORT_BY Metric for sorting tomograms if selected set exceeds max_selected --tilt_axis TILT_AXIS Maximum deviation from median tilt axis in degrees --thickness THICKNESS Minimum sample thickness in Angstrom --global_shift GLOBAL_SHIFT Maximum global shift in Angstrom --bad_patch_low BAD_PATCH_LOW Maximum fraction of bad patches at low tilt angles --bad_patch_all BAD_PATCH_ALL Maximum fraction of bad patches across the full tilt range --ctf_res CTF_RES Maximum resolution of CTF score in Angstrom --ctf_score CTF_SCORE Minimum CTF score --odd_pattern ODD_PATTERN Glob pattern for ODD tomograms --odd_extension ODD_EXTENSION suffix for ODD tomograms --n_extract N_EXTRACT Number of subvolumes to extract per tomogram --seed SEED Fixed random seed value --optimizer OPTIMIZER Optimizer --learning_rate LEARNING_RATE Learning rate --batch_size BATCH_SIZE Number of paired subvolumes per batch --val_fraction VAL_FRACTION Fraction of tomograms for validation --n_epochs N_EPOCHS Number of training epochs --n_denoise N_DENOISE Number of tomograms to denoise per epoch for visual inspection --length LENGTH Side length of cubic subvolumes to extract in pixels --train_only Only perform training and not inference on the full dataset --ch_threshold CH_THRESHOLD Checkerboard metric threshold for terminating training --train_all_epochs Continue training past ch_threshold for diagnostic purposes --exclude_tags EXCLUDE_TAGS [EXCLUDE_TAGS ...] Volumes containing these substring(s) will not be denoised --inf_length INF_LENGTH Side length of cubic subvolumes to extract in pixels during inference --inf_padding INF_PADDING Padding length in pixels during inference --live Live processing mode to denoise tomograms on-the-fly --t_interval T_INTERVAL Interval in seconds between checking for new files --t_exit T_EXIT Exit after this period in seconds if new files are not found [saber@rockylinux9 ~]$ }} ***めも [#rb126f65] DenoisETに使用される torch に cuda 12.8 のライブラリが用意されている. 12.8って nvidia driver 570.xx が必要かなと思う。 もし動かない場合は nvidia driver を 570.xx 以上に上げるか、torchを下げる #code(nonumber){{ conda env remove --name denoiset conda create --name denoiset python=3.11.4 cd /apps/denoiset/ pip install . pip install torch==2.7.1 --index-url https://download.pytorch.org/whl/cu118 conda list torch 2.7.1+cu118 pypi_0 pypi }}