BiaPy

Accessible deep learning on bioimages

Latest release notes

🔥NEWS🔥: BiaPy's paper is finally out in Nature Methods!
[Preprint in bioRxiv]

  •   Download
    Get Additional Installers   |  

    Please install Docker to use the GUI following these instructions.
    Find instructions on how to use the GUI in this video.

    You can also install previous versions of BiaPy's graphical user interface.

  • For each workflow we have both 2D and 3D versions:

    Image classification
    (2D)
    Image denoising
    (2D)
    Image to image
    (2D)
    Instance segmentation
    (2D)
    Object detection
    (2D)
    Self-supervision
    (2D)
    Semantic segmentation
    (2D)
    Super-resolution
    (2D)
    Image classification
    (3D)
    Image denoising
    (3D)
    Image to image
    (3D)
    Instance segmentation
    (3D)
    Object detection
    (3D)
    Self supervision
    (3D)
    Semantic segmentation
    (3D)
    Super-resolution
    (3D)

    For just predicting/inference you can use the following notebook:

    Inference
    (2D/3D)
  • We have a container prepared to run BiaPy:

    Docker Engine is available for Windows, macOS, and Linux, through Docker Desktop. For instructions on how to install Docker Desktop, see:

  • You have three different options to install BiaPy. Choose one or another depending on your preferences:

    • To use BiaPy via the command line, you will need to set up a conda environment. To do this, you will first need to install Conda. Then you need to create a conda environment through a terminal:

      conda create -n BiaPy_env python=3.10
      conda activate BiaPy_env
      

      Then you will need to install BiaPy package and Pytorch:

      pip install biapy
      
      # To install with GPU support: Pytorch 2.4.0 + CUDA 11.8
      pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu118 
      
      # Only CPU support: Pytorch 2.4.0 
      pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cpu
      
      # Finally install some packages that rely on the Pytorch installation
      pip install timm==1.0.14 pytorch-msssim torchmetrics[image]==1.4.*
      

      The PyPI package does not install Pytorch because there is no option to build that package specifying exactly the CUDA version you want to use. There are a few solutions to set up pyproject.toml with poetry and specify the CUDA version, as discussed here, but then PyPI package can not be built (as stated here).

    • Before you begin, ensure you have Mamba installed. Mamba is a faster alternative to Conda and can be used to manage your conda environments. Install mamba in the base conda environment, allowing you to use it across all your environments.

      If you don’t have conda installed you can download the miniforge installer specific to your OS and run it. Otherwise, if you have conda already installed just type:

      conda install mamba -n base -c conda-forge
      

      Afterwards, create a new Conda environment with Python 3.10:

      mamba create -n BiaPy_env python=3.10
      mamba activate BiaPy_env
      

      Now you need to install Pytorch and related packages. Double check Pytorch’s official page for its specific installation. For example, to install the lastest version of Pytorch with conda installation in Windows OS under CUDA 12.1:

      mamba install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
      

      Alternatively, for macOS it would be like this:

      mamba install pytorch::pytorch torchvision torchaudio -c pytorch
      

      Then, add extra pytorch related packages:

      mamba install timm==1.0.14 torchmetrics
      

      Install BiaPy Dependencies:

      mamba install pytz asciitree tzdata typer tqdm torchinfo tifffile threadpoolctl
      mamba install six Shapely scipy ruamel.yaml.clib pyparsing protobuf numcodecs lazy_loader kiwisolver
      mamba install joblib h5py fonttools fastremap fasteners cycler contourpy zarr=2.16.1 scikit-learn=1.4.0
      mamba install scikit-image ruamel.yaml python-dateutil pydot=1.4.2 pandas matplotlib xarray imgaug yaml
      mamba install bioimageio.spec bioimageio.core=0.7.0
      

      Install packages not available on conda-forge, so install it via pip:

      pip install fill-voids pytorch_msssim opencv-python opencv-python-headless imagecodecs==2024.1.1 numpy==1.25.2 pooch tensorboardX==2.6.2.2 yacs==0.1.8 edt==2.3.2
      

      Install BiaPy:

      pip install --no-deps biapy
      
    • Set up a conda environment first by installing Conda. Then you need to create a conda environment through a terminal:

      conda create -n BiaPy_env python=3.10
      conda activate BiaPy_env
      

      To clone the repository you will need to install git, a free and open source distributed version control system. Git will allow you to easily download the code with a single command. You can download and install it here. For detailed installation instructions based on your operating system, please see the following links: Windows, macOS and Linux.

      Once you have installed Anaconda and git, you will need to open a terminal to complete the following steps. Then, you are prepared to download BiaPy repository by running this command in the terminal:

      git clone https://github.com/BiaPyX/BiaPy.git
      

      This will create a folder called BiaPy that contains all the files of the library’s official repository. Then you will need to install BiaPy dependencies:

      cd BiaPy
      pip install --editable .
      
      # Install Pytorch and GPU dependencies
      pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu118 
      pip install timm==1.0.14 pytorch-msssim torchmetrics[image]==1.4.*
      

    Verify installation:

    python -c 'import torch; print(torch.__version__)'
    >>> 2.4.0
    python -c 'import torch; print(torch.cuda.is_available())'
    >>> True