Cellpose3: 一键恢复图像智能细胞伪彩标记

Cellpose是一种先进的细胞分割工具,专为处理多种类型的图像而设计,尤其在应对显微镜图像中常见的噪声、模糊或欠采样等问题时表现出色。其最新版本 Cellpose3 针对这些图像质量挑战进行了优化,显著提升了分割性能和图像质量。与传统方法不同,过去的模型通常专注于恢复图像的像素值,而 Cellpose3 采用了一种创新的训练策略:它训练模型生成能够被通用分割模型良好分割的图像,同时保持与原始目标图像的感知相似性。这种方法不仅优化了分割效果,还特别适用于显微镜图像中常见的复杂场景。为了确保对用户提供的各种图像具有良好的适应性,Cellpose3 在一个大型且多样化的数据集上进行了训练。这种广泛的训练基础赋予了它出色的泛化能力,使其能够“开箱即用”地处理不同来源的图像。此外,Cellpose3 的使用极为便捷。用户可以通过 Cellpose 的图形界面中的“一键”按钮轻松调用其功能,也可以通过 Cellpose API 集成到自己的工作流程中,为科研人员和开发者提供了极大的便利。

Cellpose3: 一键恢复图像智能细胞伪彩标记 Cellpose3: 一键恢复图像智能细胞伪彩标记 Cellpose3: 一键恢复图像智能细胞伪彩标记

v3.1+ update (Feb 2025)
pip install cellpose –upgrade to get all the new features and bug fixes!

support for big data
new options to improve 3D segmentation like flow3D_smooth and pretrained_model_ortho,
GPU-accelerated mask creation in 2D and 3D (benchmarks)
better support for Mac Silicon chips (MPS), although new mask creation code not supported by Mac yet

本地安装:

System requirements
Linux, Windows and Mac OS are supported for running the code. For running the graphical interface you will need a Mac OS later than Yosemite. At least 8GB of RAM is required to run the software. 16GB-32GB may be required for larger images and 3D volumes. The software has been heavily tested on Windows 10 and Ubuntu 18.04 and less well-tested on Mac OS. Please open an issue if you have problems with installation.

依赖包:
cellpose relies on the following excellent packages (which are automatically installed with conda/pip if missing):

pytorch
pyqtgraph
PyQt5
numpy (>=1.16.0)
numba
scipy
natsort
tifffile
imagecodecs
roifile
fastremap

 

Option 1: Conda安装

If you have an older cellpose environment you can remove it with conda env remove -n cellpose before creating a new one.

If you are using a GPU, make sure its drivers and the cuda libraries are correctly installed.

  1. Install a miniforge distribution of Python. Note you might need to use an anaconda prompt if you did not add anaconda to the path.
  2. Open an anaconda prompt / command prompt which has conda for python 3 in the path
  3. Create a new environment with conda create --name cellpose python=3.10. We recommend python 3.10, but python 3.9 and 3.11 will also work.
  4. To activate this new environment, run conda activate cellpose
  5. (option 1) To install cellpose with the GUI, run python -m pip install cellpose[gui]. If you’re on a zsh server, you may need to use ‘ ‘: python -m pip install 'cellpose[gui]'.
  6. (option 2) To install cellpose without the GUI, run python -m pip install cellpose.

To upgrade cellpose (package here), run the following in the environment:

python -m pip install cellpose --upgrade

Note you will always have to run conda activate cellpose before you run cellpose. If you want to run jupyter notebooks in this environment, then also python -m pip install notebook and python -m pip install matplotlib.

You can also try to install cellpose and the GUI dependencies from your base environment using the command

python -m pip install cellpose[gui]

If you have issues with installation, see the docs for more details. You can also use the cellpose environment file included in the repository and create a cellpose environment with conda env create -f environment.yml which may solve certain dependency issues.

If these suggestions fail, open an issue.

Option 2: Installation Instructions with python’s venv

Venv (tutorial, for those interested) is a built-in tool in python for creating virtual environments. It is a good alternative if you don’t want to install conda and already have python3 on your machine. The main difference is that you will need to choose where to install the environment and the packages. Cellpose will then live in this environment and not be accessible from other environments. You will need to navigate to the environment directory and activate it each time before running cellpose. The steps are similar to the conda installation:

If you are using a GPU, make sure its drivers and the cuda libraries are correctly installed.

  1. Install python3.8 or later from python.org. This will be the version of python that will be used in the environment. You can check your python version with python --version.
  2. Navigate to the directory where you want to create the environment and run python3 -m venv cellpose to create a new environment called cellpose.
  3. Activate the environment with source cellpose/bin/activate on Mac/Linux or cellpose\Scripts\activate on Windows. A prefix (cellpose) should appear in the terminal.
  4. Install cellpose into the cellpose venv using pip with python -m pip install cellpose.
  5. Install the cellpose GUI, with python -m pip install cellpose[gui]. Depending on your terminal software, you may need to use quotes like this: python -m pip install 'cellpose[gui]'.
  6. You can now run cellpose from this environment with python -m cellpose or cellpose if you are in the cellpose directory.
  7. To deactivate the environment, run deactivate.

GPU version (CUDA) on Windows or Linux

If you plan on running many images, you may want to install a GPU version of torch. To use your NVIDIA GPU with python, you will need to make sure the NVIDIA driver for your GPU is installed, check out this website to download it. You can also install the CUDA toolkit, or use the pytorch cudatoolkit (installed below with conda). If you have trouble with the below install, we recommend installing the CUDA toolkit yourself, choosing one of the 11.x releases here.

With the latest versions of pytorch, as long as the NVIDIA drivers are installed, the GPU version is installed by default with pip. You can check if the GPU support is working by opening the GUI. If the GPU is working then the GPU box will be checked and the CUDA version will be displayed in the command line.

If it’s not working, we will need to remove the CPU version of torch:

pip uninstall torch

To install the GPU version of torch, follow the instructions here. The conda install is strongly recommended, and then choose the CUDA version that is supported by your GPU (newer GPUs may need newer CUDA versions > 10.2). For instance this command will install the 11.6 version on Linux and Windows (note the torchvision and torchaudio commands are removed because cellpose doesn’t require them):

conda install pytorch pytorch-cuda=11.6 -c pytorch -c nvidia

If the latest CUDA versions don’t work, try an older version like cuda 11.3:

conda install pytorch==1.12.0 cudatoolkit=11.3 -c pytorch

Info on how to install several older versions is available here. After install you can check conda list for pytorch, and its version info should have cuXX.X, not cpu.

如若转载,请注明出处:https://www.ouq.net/3463.html

(0)
上一篇 02/20/2025 22:36
下一篇 02/21/2025 00:13

相关推荐

  • CUT&Tag and CUT&RUN

    CUT&Tag: An Introduction  CUT&RUN, Cleavage Under Targets & Tagmentation (CUT&Tag) is a faster, more cos…

    02/26/2025
    95
  • CUT&Tag技术和原理

    CUT&Tag(Cleavage Under Targets and Tagmentation)技术是一种用于细致地研究蛋白质与DNA相互作用的方法,特别适用于研究转录因子、组蛋白修饰等蛋白质在基因组上的精确结合位置。许多染色质特征…

    02/26/2025
    104
  • 免疫荧光细胞化学染色方法

    免疫荧光细胞化学染色方法 一、标本制作 可制作涂片、印片、细胞单层培养物、组织切片,经适当固定或不固定,作免疫荧光染色用。 二、荧光抗体染色方法 (一)直接法 1.染色 切片经固定后,滴加经稀释至染色效价如1:8或1:16的荧光抗体(如兔抗…

    实验技术 02/26/2025
    85
  • 荧光原位杂交技术原理及操作步骤

     1974年Evans首次将染色体显带技术和染色体原位杂交联合应用,提高了定位的准确性。20世纪70年代后期人们开始探讨荧光标记的原位杂交,即FISH技术。1981年Harper成功地将单拷贝的DNA序列定位到G显带标本上,标志着染色体定位…

    实验方法 02/26/2025
    185
  • 免疫组化常见问题的处理

    免疫组化常见问题的处理

    实验技术 02/26/2025
    105