Skip to content

virtual staining instructions

Eduardo Hirata-Miyasaki edited this page Aug 8, 2024 · 4 revisions

VisCy Guide for Virtual Staining Models

This guide provides detailed instructions on how to train and run inference using the VisCy CLI or python scrips for the different virtual staining models: VSNeuromast, VSCyto2D, and VSCyto3D.

Prerequisites

Ensure you have followed the installation instructions here

Note: for all the following tasks you will need to activate the environment:

conda activate viscy

VSNeuromast

Setup

Choose a directory to download the data

# Create the directory to download the dataset
download_dir= ... # TODO: Change to your choice of directory (i.e /path/to/download)
mkdir -p "$download_dir"

# Navigate to the download directory
cd "$download_dir" || exit
# Download the model weights, configurations, and OME-Zarr dataset 
wget -m -np -nH --cut-dirs=3 -R "index.html*" "https://public.czbiohub.org/comp.micro/viscy/VS_datasets/VSNeuromast"
wget -m -np -nH --cut-dirs=3 -R "index.html*" "https://public.czbiohub.org/comp.micro/viscy/VS_models/VSNeuromast"

Training

To train the VSNeuromast model, use the following command:

cd ./VSNeuromast/timelapse_finetine_1hr_dT_downsample_lr1e-4_45epoch_clahe_v5 #TODO: Navigate to the directory you downloaded the model
viscy fit -c config.yml

Inference

To run inference with the VSNeuromast model, use the following command:

cd ./VSNeuromast #TODO: Navigate to the directory you downloaded the model
viscy predict -c config.yml

VSCyto3D

Setup

Choose a directory to download the data and run this shell script

# Create the directory to download the dataset
download_dir= ... # TODO: Change to your choice of directory (i.e /path/to/download)
mkdir -p "$download_dir"

# Navigate to the download directory
cd "$download_dir" || exit
# Download the model weights, configurations, and OME-Zarr dataset 
wget -m -np -nH --cut-dirs=3 -R "index.html*" "https://public.czbiohub.org/comp.micro/viscy/VS_datasets/VSCyto3D"
wget -m -np -nH --cut-dirs=3 -R "index.html*" "https://public.czbiohub.org/comp.micro/viscy/VS_models/VSCyto3D"

Training

To train the VSCyto3D model, use the following command:

cd ./VSCyto3D #TODO: Navigate to the directory you downloaded the model
viscy fit -c config.yml

Inference

To run inference with the VSCyto3d model, use the following command:

cd ./VSCyto3D #TODO: Navigate to the directory you downloaded the model
viscy predict -c config.yml

VSCyto2D

Setup

Choose a directory to download the data

# Create the directory to download the dataset
download_dir= ... # TODO: Change to your choice of directory (i.e /path/to/download)
mkdir -p "$download_dir"

# Navigate to the download directory
cd "$download_dir" || exit
# Download the model weights, configurations, and OME-Zarr dataset 
wget -m -np -nH --cut-dirs=3 -R "index.html*" "https://public.czbiohub.org/comp.micro/viscy/VS_datasets/VSCyto2D"
wget -m -np -nH --cut-dirs=3 -R "index.html*" "https://public.czbiohub.org/comp.micro/viscy/VS_models/VSCyto2D"

Training

Pre-training

cd ./VSCyto2D #TODO: Navigate to the directory you downloaded the model
python 

Fine-tunning

cd ./VSCyto2D #TODO: Navigate to the directory you downloaded the model
python 

Inference

To run inference with the VSCyto3d model, use the following command:

viscy predict -c config.yml

Additional resources

  • Checkout the library of virtual staining models here
  • Checkout the demos and other examples here
Clone this wiki locally