BiaPy

Accessible deep learning on bioimages

Latest release notes

🔥NEWS🔥: Check out our last bioRxiv preprint!

  •   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 just predicting/inference you can use the following notebook:

    Inference
    (2D/3D)

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

    Semantic segmentation
    (2D)
    Instance segmentation
    (2D)
    Detection
    (2D)
    Denoising
    (2D)
    Super-resolution
    (2D)
    Self supervised learning
    (2D)
    Classification
    (2D)
    Semantic segmentation
    (3D)
    Instance segmentation
    (3D)
    Detection
    (3D)
    Denoising
    (3D)
    Super-resolution
    (3D)
    Self supervised learning
    (3D)
    Classification
    (3D)
  • We have two container prepared to run BiaPy, one for the actual NVIDIA driver versions and another container for old drivers:

    You need to check the CUDA version that you NVIDIA driver can handle. You can do that with nvidia-smi command in Linux/macOS or by running NVIDIA Control Panel in Windows. The driver information will tell you the maximum CUDA version it can handle. Select one of the above containers depending on your GPU driver. For instance, if the CUDA version it can handle is 12.0 you can use biapyx/biapy:latest-11.8 container.

    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 pytorch-msssim torchmetrics[image]
      

      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 pytorchpytorch torchvision torchaudio -c pytorch
      

      Then, add extra pytorch related packages:

      mamba timm torchmetrics
      

      Install BiaPy Dependencies:

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

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

      pip install fill-voids pytorch_msssim opencv-python==4.8.0.76 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 and for that you need to check the CUDA version that your NVIDIA driver can handle. You can do that with nvidia-smi command in Linux/macOS or by running NVIDIA Control Panel in Windows. The driver information will tell you the maximum CUDA version it can handle. We here provide two stable installations, one based in CUDA 11.8 and another one with an older version of Pytorch and with CUDA 10.2 (BiaPy will work anyway). Once you have checked it, proceed with the installation depending on the CUDA version:

      • 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 pytorch-msssim torchmetrics[image]
        
      • cd BiaPy
        pip install --editable .
        
        # Install Pytorch and GPU dependencies
        pip install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=10.2 -c pytorch
        pip install timm pytorch-msssim torchmetrics[image]
        

    Verify installation:

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