Skip to content

cbib/SalienceNet

 
 

Repository files navigation

SalienceNet

Deep Learning style transfert for nuclei enhancement : https://www.scitepress.org/Papers/2023/116235/116235.pdf

First version : https://www.biorxiv.org/content/10.1101/2022.10.27.514030v1.article-info

alt text

Prerequisites

  • Linux or macOS
  • Python 3
  • CPU or NVIDIA GPU + CUDA CuDNN

Getting Started

Installation

  • Clone this repo:
git clone https://github.com/ebouilhol/SalienceNet.git
cd SalienceNet
  • Install PyTorch and 0.4+ and other dependencies (e.g., torchvision, visdom and dominate).
    • For pip users : pip install -r requirements.txt.
    • For Conda users, you can create a new Conda environment using : conda env create -f env.yaml.

Download pre-trained model

SalienceNet pre-trained model V0 is available on zenodo : https://zenodo.org/record/7266921/files/salienceNet.zip?download=1

Once downloaded, move it to /SalienceNet/checkpoints and unzip it.

Dataset

To create a dataset please use the following architecture :

└── dataset_folder
    ├── testA
    ├── testB
    ├── trainA
    └── trainB
    

A being the source style dataset and B the target style dataset.

Pretrained model

A pretrained model is available, to use it for prediction use the model name salienceNet :

/!\ The pretrained model is trained on grayscale images with 1 channel, do not forget to use "--input_nc 1 --output_nc 1" as shown below.

#!./scripts/test_cyclegan.sh
python test.py --gpu_ids x --dataroot datasets/dataset_example/ --model cycle_gan --input_nc 1 --output_nc 1 --name salienceNet

CycleGAN train/test

  • To view training results and loss plots, run python -m visdom.server and click the URL http://localhost:8097.

  • To log training progress and test images to W&B dashboard, set the --use_wandb flag with train and test scrip

  • To train a new model:

#!./scripts/train_cyclegan.sh
python train.py  --gpu_ids x --dataroot datasets/dataset_example/ --n_epochs xxx  --model cycle_gan --gan_mode LSSSIMGRAD --name modelname --wcrit1 0.2 --wcrit2 0.2 --wcrit3 0.6

To see more intermediate results, check out ./checkpoints/maps_cyclegan/web/index.html.

  • Test the model:
#!./scripts/test_cyclegan.sh
python test.py --gpu_ids x --dataroot datasets/dataset_example/ --model cycle_gan --name modelname
  • The test results will be saved to a html file here: ./results/maps_cyclegan/latest_test/index.html.

Acknowledgments

Our code is inspired by pytorch-cycleGAN. For more information regarding the possible test and train option please refer to this github.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.2%
  • Other 1.8%