This project was originally created by the uwm-bigdata group from Milwaukee and written as jupyter-notebooks which need to be executed one by one (see original_README.md).
To make the code easier to use with the HPC, the training pipeline was combined in python files in the python_codes folder
To train the model
- first set up your virtual environment with all necessary packages
- create a
config.json
in the folderCodes
, copy theconfig_template.json
and adapt the paths to your setup - put the images in the folder, specify which images should be used for Training/Test/Evaluation in the txt files
- run
training100.py
As labeled data for tissue segmentation is rare, a semi-supervised approach was taken: First several segmentation models are being trained on the labeled data. Then the best of them (regarding the validation dataset) is used to generate pseudo-labels for unlabeled images.
After that, iteratively models are trained on the supervised labels and some pseudo-labels.
training100.py
first trains 8 models with the labeled data (train_supervised_model()
).
Then the one with the best validation_loss is used to create pseudo-labels for the unlabeled data.
In the next step 5 models are trained using the labeled images and 50 radomly chosen pseudo-labels. The best performing model ist used to generate new pseudo-labels, the 50 pseudo-labels that were used in the training are also used in the next iteration (as they led to the best performance, their quality is assumed to be ok).
This is repeated until no improvement in validation loss is achieved or the maximal number of iterations (12) is reached.
In each iteration, the child-generation trains on the 50 pseudo-labels used in the parent-models training and 50 independently chosen pseudo-labels generated by the parent-model (thus all the labeled data and 100 pseudo-labels).
As a second approach, training_pseudoLabels.py
works the same, just that the pseudo-labels that led to the best performance in one round are accepted as labels (not just for the next iteration, but for all following iterations). Thus the amount of training-images grows with every iteration.
The first approach led to a better performance.
The mdoel was trained first on the original dataset as described in the paper (reproduction).
Then CPT-Images were added to improve the performance on these images and the whole training process was repeated (starting from scratch).
test-set: 16 manually selected images from DFU & ComplexWoundDB dataset
validation-set: mix of 7 labeled CPT-images and 9 DFU/ComplexWoundDB-Images
Labeled Training-set: DFU-Dataset (labeled) + ComplexWoundDB + remaining labeled CPT-images
Unlabeled Training-set: DFU-Dataset (unlabeled) + Unlabeled CPT-Images
When training only on the original dataset:
Training-Performance for training100.py
Seed: 339
min val_loss: 1.7273963689804077
max test dice: 86.92803220280472
Training-Performance for training_pseudoLabels
Seed: 2081
min val_loss: 1.7325440645217896
max test dice: 85.97962911161207
As visible, training100 resulted in better performance.
Training-Performance for training100 on Data extended by CPT and Complex WoundDB images
Seed: 2242
min val_loss: 1.8066037893295288
max test dice: 71.31121941715304
The weight file for the best-performing Tissue-segmentation model (Trained on the combined data) can be found here: datashare.tu-dresden.de/JoshKowi