Skip to content

CAREamics/MicroSplit-reproducibility

Repository files navigation

MicroSplit

Library License Image.sc

What is MicroSplit

MicroSplit is a deep learning-based computational multiplexing technique that enhances the imaging of multiple cellular structures within a single fluorescent channel, allowing to image more cellular structures, image them faster, and at reduced overall light exposure.

MicroSplit is based on a hierarchical variational auto-encoder (LVAE) using lateral context.

MicroSplit is implemented in the CAREamics library, and this repository contains example notebooks and utilities for reproducing the results of the MicroSplit paper.

How to use this repository

Important

A GPU is necessary for training the models from scratch. For users interested in testing the examples from the paper, our notebooks allow loading pre-trained models and running the inference even without GPU access.

Set up a Python environment

In order to run the examples, you will need to install PyTorch, CAREamics and the utilities in this repository.

  1. Create a new environment with the package manager of your choice, we recommand mamba, but you can also use conda (in which case, substitute mamba for conda in the following bash commands).
    mamba create -n microsplit python=3.9
    mamba activate microsplit

Tip

If you are on a mac, and wish to make use of Mac silicon GPU (using M1, M2 and M3 chips), create the environment using the following commands:

CONDA_SUBDIR=osx-arm64 conda create -n microsplit python=3.9
conda activate microsplit
conda config --env --set subdir osx-arm64
  1. ⚠️ Install PyTorch following the instructions on the official website.

  2. You can test that you have GPU access by running the following command:

    python -c "import torch; print([torch.cuda.get_device_properties(i) for i in range(torch.cuda.device_count())])"

    To confirm that mac silicon is available do:

    python -c "import torch; import platform; print(platform.processor() in ('arm', 'arm64') and torch.backends.mps.is_available())"
  3. Install MicroSplit utilities from this repository by cloning and navigating into it, then by installing all the necessary packages using pip.

    git clone https://github.com/CAREamics/MicroSplit-reproducibility.git
    cd MicroSplit-reproducibility
    pip install .

Tip

If you are on a Windows machine and have trouble running unix-like commands, check out Git for Windows. This tool installs Git Bash, a terminal that you can use to run the commands above.

Clone the repository to access the examples

  1. You can now open the notebooks in jupyter by running the following command and navigating to the example folder:

    jupyter notebook

Note

The Jupyter notebooks in each example are numbered by their order in the MicroSplit pipeline:

  • 00: Create the noise models for the dataset
  • 01: Train the MicroSplit model
  • 02: Apply MicroSplit to data
  • 03: Calibrate the MicroSplit errors

The notebooks are designed to be run in order, but we designed them so that each notebook, except the calibration, has entry points using pre-trained models.

Troubleshooting

A list of problems that might be encountered and suggestions on how to solve them.

  1. Problem: An error saying that your NVIDIA Drivers are too old.

    Solution: Try downgrading your PyTorch version, for example:

    pip3 install torch==2.2 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  2. Problem: Test for Mac silicon GPU above returns False.

    Solution: Make sure you install PyTorch with pip, installing it with conda might not work. Make sure you installed the macOS-arm64 release of Anaconda or Mamba.

Useful links

Cite MicroSplit

(soon)

Links to all datasets used in the manuscript

License

This project is licensed under BSD-3-Clause License - see the LICENSE for details.