Cloned from the cut repo
This repo contains all the code used in my bachelor thesis, to train, test, and evaluate adding style adaptation to the cut model.
- Create and activate the venv:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
-
Store a dataset under
dataset
. -
Training and testing is organized in experiments which are a collection of hyperparameters each. All experiments reside in
launcher.py
. They can be configured here and given anexperiment_id
. An experiment might look like this:
16: Options(
name="resnet_atn_16_from_02_multiple_atn_spectral_norm",
netG="resnet_atn",
netD="basic_spectral_norm",
ada_norm_layers="12,13",
continue_train="",
pretrained_name="baseline_14_start_spectral_norm",
epoch=2,
lr=0.00002,
),
Mostly these are the hyperparameters from cut with a few additions.
Choose an experiment and train it:
./launcher.py train 16
- When training is finished you can infere from a test split:
./launcher.py test_all 16
This will infere 50 images for every epoch trained.
- If you want to evaluate label preservation performance with a segmentation model, you have to train one first. In our work cholec8K segmentations were used.
./launcher.py train_seg test cholec8K
- After this is finished copy its weights from
logs/cholec8K/version_0/checkpoints/some_name.ckpt
tologs/weights/default.ckpt
and run an evaluation on the images generated by cut:
./launcher.py eval_all cut 16
- Show the evaluation scores:
./launcher.py vis 16
Hyperparameter | Effect |
---|---|
no_random_mask | Omit the oval mask on the image to mimic the tube occlusion on a laparoscope. This mask is added to counter domain missmatch. |
netG | Option from the base model. Additional networks resnet_adain or resnet_atn are available. |
netD | Option from the base model. Additional network basic_spectral_norm is available. |
dataset_mode | Option from the base model. Additional mode pretrain is available. |
ada_norm_layers | Comma seperated list of layer which will apply the style normalization. May only be used in conjunction with netG="resnet_adain" or netG="resnet_atn" . |