粒子pickツール
本家様https://cryolo.readthedocs.io/en/stable/index.html

crYOLOのバージョン履歴
https://pypi.org/project/cryolo/#history

convolutional neural networksを利用した粒子pickツール
提供されているモデルファイルを使って、あるいは自分自身でモデルファイルを作ってpickします.
そして結果を可視化するツールもそろっています

crYOLOは tensorflow 1.x を使用します。tensorflow の最新版は 2.21.0(2026.9時点)で 1.x系の最終版は 1.15.5 で既に開発は終わっているので最新のGPUには未対応です.
それを補う形でnvidia側で 1.x系の tensorflow を提供していたのですが、それも打ち切りになってしまいました.
現在、tensorflow 1.x を含むdocker コンテナが提供されていて、それをうまく使うしかないみたい

ここでは tensorflow 1.x のコンテナを取得して、その中で crYOLO を作り、apptainer に変換してみる
dockerのままでもいいのですが、apptainer の方が配布が楽.

まぁー何が言いたいかと言うと 50x0 な blackwell GPUでも計算できるって事。

tensorflow 1.x のコンテナ内でcrYOLOを使用する†

こちらを使います
https://catalog.ngc.nvidia.com/orgs/nvidia/-/containers/tensorflow/23.03-tf1-py3
github https://github.com/NVIDIA/tensorflow ドキュメント https://docs.nvidia.com/deeplearning/frameworks/tensorflow-release-notes/rel-23-02.html

dockerを参照して、NVIDIA Container Toolkitも有効にしておきます

[root@rockylinux9 ~]# docker pull nvcr.io/nvidia/tensorflow:23.02-tf1-py3
 
[root@rockylinux9 ~]# docker images
IMAGE                                     ID             DISK USAGE   CONTENT SIZE   EXTRA
nvcr.io/nvidia/tensorflow:23.02-tf1-py3   43d4cc62c526       25.9GB         8.53GB
[root@rockylinux9 ~]#
 
(確認)
[root@rockylinux9 ~]# docker run --rm --gpus all   nvcr.io/nvidia/tensorflow:23.02-tf1-py3   python -c "import tensorflow as tf; print(tf.__version__); print(tf.test.is_built_with_cuda()); print(tf.test.gpu_device_name())"
 :
1.15.5
True
/device:GPU:0
 
[root@rockylinux9 ~]#

作業場所を作って

[root@rockylinux9 ~]# mkdir -p /apps/cryolo-docker && cd $_
[root@rockylinux9 cryolo-docker]# 
[root@rockylinux9 cryolo-docker]# docker run --name cryolo-build \
  --gpus all \
  --ipc=host \
  --ulimit memlock=-1 \
  --ulimit stack=67108864 \
  -it \
  nvcr.io/nvidia/tensorflow:23.02-tf1-py3 \
  bash
 
root@225c00a365bf:/workspace# pip list | egrep -i 'tensorflow|numpy|scipy|keras|h5py|protobuf|matplotlib|wx'     <-- tensorflow コンテナ内のpipパッケージ一覧
h5py                          2.10.0
Keras-Applications            1.0.8
Keras-Preprocessing           1.1.2
matplotlib                    3.6.2
matplotlib-inline             0.1.6
numpy                         1.22.2
protobuf                      3.20.3
scipy                         1.6.3
tensorflow                    1.15.5+nv23.2
tensorflow-estimator          1.15.1
root@225c00a365bf:/workspace#

まずはcrYOLO依存パッケージを入れる.

root@225c00a365bf:/workspace# pip install --no-deps   cryolo==1.9.9 Keras==2.3.1 imageio==2.15.0 tifffile==2020.9.3 lineenhancer==1.0.9.dev2 GooeyDev==1.0.8b5 \
                                                      scikit-learn==0.23.2 pyStarDB==0.3.1 pandas==1.1.4 protobuf==3.20.0 cryoloBM==1.6.1 'janni>=0.3.0b5'
 
root@225c00a365bf:/workspace# pip install --no-deps   mrcfile   Cython   Pillow   networkx   terminaltables   ansi2html   trackpy   watchdog   tqdm   colored   psutil   pygtrie   eulerangles   pytz   joblib   threadpoolctl   looseversion   pyyaml

っでチェック

root@225c00a365bf:/workspace# pip check
janni 0.3.1 requires scikit-image, which is not installed.
janni 0.3.1 requires wxpython, which is not installed.
gooeydev 1.0.8b5 requires wxpython, which is not installed.
cryolo 1.9.9 requires wxpython, which is not installed.
janni 0.3.1 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.22.2.
cudf 22.12.0 has requirement protobuf<3.21.0a0,>=3.20.1, but you have protobuf 3.20.0.
cryolobm 1.6.1 has requirement matplotlib<3.5,>=3.4.2, but you have matplotlib 3.6.2.
cryolobm 1.6.1 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.22.2.
cryolo 1.9.9 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.22.2.
 
root@225c00a365bf:/workspace#

まだ不足の scikit-image を入れる。あとOSパッケージの「python3-wxgtk4.0」と「locales」も入れる

root@225c00a365bf:/workspace# pip install --no-deps scikit-image==0.17.2
 
root@225c00a365bf:/workspace# apt-get update
root@225c00a365bf:/workspace# apt-get install -y python3-wxgtk4.0 locales
root@225c00a365bf:/workspace# locale-gen en_US.UTF-8
root@225c00a365bf:/workspace# update-locale LANG=en_US.UTF-8

dockerからsifへ

[root@rockylinux9 ~]# docker commit 2cf4e9fa4a6d cryolo:1.9.9-tf1
[root@rockylinux9 ~]# apptainer build cryolo-1.9.9-tf1.sif docker-daemon://cryolo:1.9.9-tf1

これで「cryolo-1.9.9-tf1.sif」が得られる。あとは「apptainer shell --nv --bind /apps:/apps /apps/cryolo-1.9.9-tf1.sif」としてshellとして動かすか

tensorflow 1.x のコンテナを使わず、自力で tensorflow を作って使用する†

Tensorflow-1.xにて tensorflow を自作できます
作った「tensorflow-1.15.5+nv-cp38-cp38-linux_x86_64.whl」を使います

[root@rockylinux9 ~]# cat /etc/redhat-release
Rocky Linux release 9.8 (Blue Onyx)
[root@rockylinux9 ~]# cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX Open Kernel Module for x86_64  595.91.07  Release Build  (dvs-builder@U22-I3-B08-02-2)  Wed Jul 29 03:01:16 UTC 2026
GCC version:  gcc version 11.5.0 20240719 (Red Hat 11.5.0-14) (GCC)
[root@rockylinux9 ~]# nvidia-smi -L
GPU 0: NVIDIA RTX A2000 (UUID: GPU-23cc3ee7-31d3-a068-2f61-5aa00052d084)
 
[root@rockylinux9 ~]#

pyenv-conda環境を敷いて

git clone https://github.com/yyuu/pyenv.git /apps/pyenv
export PYENV_ROOT=/apps/pyenv
export PATH=$PYENV_ROOT/bin:$PATH
pyenv install miniforge3-26.7.2-0
source /apps/pyenv/versions/miniforge3-26.7.2-0/etc/profile.d/conda.sh
conda update -n base -c conda-forge conda
 
(既にあるなら)
source /apps/pyenv/versions/miniforge3-26.7.2-0/etc/profile.d/conda.sh
[root@rockylinux9 ~]# conda create -n cryolo -c conda-forge python=3.8 -y
 
[root@rockylinux9 ~]# conda activate cryolo
 
(cryolo) [root@rockylinux9 ~]# pip install /Public/em/tensorflow-1.15.5+nv-cp38-cp38-linux_x86_64.whl
 
(cryolo) [root@rockylinux9 ~]# conda list | egrep -i 'tensorflow|numpy|scipy|keras|h5py|protobuf|matplotlib|wx'
h5py                       2.10.0           pypi_0                pypi
keras-applications         1.0.8            pypi_0                pypi
keras-preprocessing        1.1.2            pypi_0                pypi
numpy                      1.23.5           pypi_0                pypi
protobuf                   3.20.3           pypi_0                pypi
tensorflow                 1.15.5+nv        pypi_0                pypi
tensorflow-estimator       1.15.1           pypi_0                pypi
 
(cryolo) [root@rockylinux9 ~]#  conda install matplotlib==3.6.2
 
(cryolo) [root@rockylinux9 ~]# conda list | egrep -i 'tensorflow|numpy|scipy|keras|h5py|protobuf|matplotlib|wx'
h5py                         2.10.0           pypi_0                pypi
keras-applications           1.0.8            pypi_0                pypi
keras-preprocessing          1.1.2            pypi_0                pypi
matplotlib                   3.6.2            py38h578d9bd_0        conda-forge
matplotlib-base              3.6.2            py38hb021067_0        conda-forge
numpy                        1.23.5           pypi_0                pypi
protobuf                     3.20.3           pypi_0                pypi
tensorflow                   1.15.5+nv        pypi_0                pypi
tensorflow-estimator         1.15.1           pypi_0                pypi
 
(cryolo) [root@rockylinux9 ~]#
 
(cryolo) [root@rockylinux9 ~]# pip install --no-deps   cryolo==1.9.9 Keras==2.3.1 imageio==2.15.0 tifffile==2020.9.3 lineenhancer==1.0.9.dev2 GooeyDev==1.0.8b5 \
                                                      scikit-learn==0.23.2 pyStarDB==0.3.1 pandas==1.1.4 protobuf==3.20.0 cryoloBM==1.6.1 'janni>=0.3.0b5' \
                                                      numpy==1.22.2 scikit-image==0.17.2 scipy==1.6.3
 
(cryolo) [root@rockylinux9 ~]# pip install --no-deps   mrcfile   Cython   Pillow   networkx   terminaltables   ansi2html   trackpy   watchdog   tqdm   \
                                                       colored   psutil   pygtrie   eulerangles   pytz   joblib   threadpoolctl   looseversion   pyyaml
 
(cryolo) [root@rockylinux9 ~]# pip install --no-deps scikit-image==0.17.2 scipy==1.6.3
 
(cryolo) [root@rockylinux9 ~]# pip check
gooeydev 1.0.8b5 requires wxpython, which is not installed.
cryolo 1.9.9 requires wxpython, which is not installed.
janni 0.3.1 requires wxpython, which is not installed.
scikit-image 0.17.2 requires pywavelets, which is not installed.
cryolo 1.9.9 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.23.5.
cryolobm 1.6.1 has requirement matplotlib<3.5,>=3.4.2, but you have matplotlib 3.6.2.
cryolobm 1.6.1 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.23.5.
janni 0.3.1 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.23.5.
scipy 1.6.3 has requirement numpy<1.23.0,>=1.16.5, but you have numpy 1.23.5.
 
(cryolo) [root@rockylinux9 ~]#
 
(cryolo) [root@rockylinux9 ~]# conda install -c conda-forge "wxpython=4.2.1"
 
(cryolo) [root@rockylinux9 ~]# pip install PyWavelets
 
(cryolo) [root@rockylinux9 ~]# pip check
cryolo 1.9.9 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.22.2.
cryolobm 1.6.1 has requirement matplotlib<3.5,>=3.4.2, but you have matplotlib 3.6.2.
cryolobm 1.6.1 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.22.2.
janni 0.3.1 has requirement numpy<1.19.0,>=1.16.0, but you have numpy 1.22.2.
(cryolo) [root@rockylinux9 ~]#
 
 
 

modelファイルの準備†

modelファイルは本家様から頂いて、ここでは単純に「/apps/crYOLO」に配置してます
取得先はこちらhttps://cryolo.readthedocs.io/en/stable/installation.html#download-the-general-models

[root@rockylinux10 ~]# ls -lh /apps/crYOLO/
total 194M
-rw-r--r--. 1 root 2001 194M Apr 15  2021 gmodel_phosnet_202005_N63_c17.h5
[root@rockylinux10 ~]#

EnvironmentModules†

ここではEnvironmentModulesを使って実行環境を整備してます。
作ったmoduleファイルは下記URLを参照して
http://sphire.mpg.de/wiki/doku.php?id=pipeline:window:cryolo:integration_into_module_system

「/apps/modulefiles/crYOLO」と用意して、中身は下記にします

#%Module1.0
set          root       /apps/pyenv/versions/miniforge3-26.7.2-0/envs/cryolo
setenv       CRYOLOPATH $root
prepend-path PATH       $root/bin

計算してみる†

まずはcrYOLOのmoduleファイルをロードしてcrYOLO実行環境を準備します

[saber@rockylinux10 ~]$ module use  /apps/modulefiles/
 
[saber@rockylinux10 ~]$ mkdir -p test/crYOLO
[saber@rockylinux10 ~]$ cd test/crYOLO
 
[saber@rockylinux10 crYOLO]$ 
[saber@rockylinux10 crYOLO]$ module load crYOLO

これでcrYOLOのアプリが使えます。
*「/apps/pyenv/versions/anaconda3-2025.06-1/envs/cryolo/bin」にcrYOLO関連のアプリがあります

本家様で提供されているmodelファイルは下記ですが、ここでは「For cryo images (low-pass filtered)」のmodelを使って粒子pickを試してみます
General PhosaurusNet models

手始めにコマンドラインでテスト的に.

初めに「configファイル」を準備します
チュートリアルにも記載されてますが、下記を実行してconfigファイルを作ります

[saber@rockylinux9 crYOLO]$ cryolo_gui.py config config_cryolo_.json 220 --filter LOWPASS --low_pass_cutoff 0.1
#####################################################
Important debugging information.
In case of any problems, please provide this information.
#####################################################
/apps/pyenv/versions/anaconda3-2024.02-1/envs/cryolo/bin/cryolo_gui.py config config_cryolo_.json 220
--filter LOWPASS
--low_pass_cutoff 0.1
#####################################################
 
 Wrote config to config_cryolo_.json
[saber@rockylinux9 crYOLO]$
[saber@rockylinux9 crYOLO]$ ls -l
total 4
-rw-r--r--. 1 saber saber 344 Mar 20 19:26 config_cryolo_.json
[saber@rockylinux9 crYOLO]$

「config_cryolo_.json」の中身はこんな感じ

[saber@rockylinux9 crYOLO]$ cat config_cryolo_.json
{
    "model": {
        "architecture": "PhosaurusNet",
        "input_size": 1024,
        "anchors": [
            220,
            220
        ],
        "max_box_per_image": 700,
        "norm": "STANDARD",
        "filter": [
            0.1,
            "filtered_tmp/"
        ]
    },
    "other": {
        "log_path": "logs/"
    }
}
[saber@rockylinux9 crYOLO]$

configファイルのたたき台を作るくらいでしょうか。別に手動で作成しても宜しいかと思う。
各項目の説明は下記URL参照
https://cryolo.readthedocs.io/en/stable/other/other.html#cryolo-configuration-file

pick対象はGautomatchに付属のribosomeのmrcファイルです.
っで実際にpickさせてみます。

[saber@rockylinux9 crYOLO]$ cryolo_predict.py -c config_cryolo_.json -w /apps/crYOLO/gmodel_phosnet_202005_N63_c17.h5 -i /apps/GCTF_Gautomatch_Cu10.1/ribosome/test[78].mrc -o .
[saber@rockylinux9 crYOLO]$

そのpickした座標データは形式に合わせてCBOX、EMAN、STAあと1.9.xになってからCRYOSPARC向けも用意されたみたい
EMANのbox形式を見てみると

[saber@rockylinux9 crYOLO]$ less EMAN/test7.box
2018.828857421875       3801.8345489501953      220     220
2233.00439453125        3829.3297119140625      220     220
2733.330078125  3819.460433959961       220     220
 :
[saber@rockylinux9 crYOLO]$

CRYOSPARC向けのは

[saber@rockylinux9 crYOLO]$ less CRYOSPARC/cryosparc.star
 
data_
 
loop_
_rlnMicrographName #1
_rlnCoordinateX #2
_rlnCoordinateY #3
_rlnAutopickFigureOfMerit #4
test7.mrc 2128.828857421875 3911.8345489501953 0.8078545928001404
test7.mrc 2343.00439453125 3939.3297119140625 0.7854877710342407
test7.mrc 2843.330078125 3929.460433959961 0.728760838508606
 :
[saber@rockylinux9 crYOLO]$

な感じで書かれています。

cryolo_gui.pyを使ってみる†

[saber@c crYOLO]$ cryolo_gui.py

実行するとcrYOLOの画面が表示されます。その左側には「Actions」として「config」「train」「predict」「ecaluation」があります。
2020y02m13d_022916652.png
「config」を選ぶとその右側には複数のタブが並びます。
2020y02m13d_023250324.png
先ほどコマンドラインで作成した「config_cryolo_.json」をGUIで作っているだけなのですが、個々の項目の説明があるので
こちらで欄を埋めてconfigファイルを用意された方がいいのかと思う。
ただ「predict」の実行なら「General arguments」タグの「config_out_path」「boxsize」、「Model options」タグのすべて、
「Denoising option」を埋めて、「Start」ボタンを押下すればconfigファイルは得られる。

っで、次にpredictを選択
2020y02m13d_025846210.png
「Required arguments」タグでconf欄は前段で作ったconfigファイル。inputはmrcファイルを指定します。
weightsがmodelファイルを指定して、outputはそのばでいいなら「./」とします。
2020y02m13d_030217762.png

「Optional auguments」タグは説明を読み定義すれば宜しいかと。そのままで動きます。
「Filament」タグはパス
「Deprecated/Experimental/Special」タグもパス
そして「Start」ボタンを押下すればpickしてくれます。

pick結果を見たい†

crYOLO-1.9.xになってから「cryolo_boxmanager」は従来版の「cryolo_boxmanager_legacy.py」と新型の「napari_boxmanager」に分かれたみたい.

メモ†

下記メッセージが表示されるときがある。リモートアクセスの際はないのだが、計算機をモニターに繋げて操作している際はあるみたい
「Qt: Session management error: None of the authentication protocols specified are supported」
っで回避方法はそのcrYOLOを使うターミナルで

unset SESSION_MANAGER

を行うと回避される

めも2†

(削除)

めも3†

2023.03時点で rockylinux 8.7 は対応しているが、rockylinux9.1 ではエラーが発生します. 原因はよく分からんが
「Number of processes must be at least 1」とメッセージが表示される. pyenv/anaconda環境なのでOS側の影響は少ないと思うのだが...
2023.04. anacondaを2023.03に変更したらrockylinux9.1 でも動いた

最新の60件
2026-10-16 2026-10-12 2026-10-08 2026-10-07 2026-10-06 2026-10-05 2026-10-04 2026-10-02 2026-10-01 2026-09-30 2026-09-28 2026-09-27 2026-09-26 2026-09-22 2026-09-17 2026-09-11 2026-09-06 2026-08-31 2026-08-27 2026-08-24 2026-08-20 2026-08-19 2026-08-18 2026-08-17 2026-08-16 2026-08-15 2026-08-13 2026-08-12 2026-08-11 2026-08-09 2026-07-30 2026-07-25 2026-07-24 2026-07-20 2026-07-18 2026-07-17 2026-07-16 2026-07-08 2026-07-06

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2026-10-01 (木) 06:20:29