Skip to main content

Algorithm 1 Training, validation and testing steps

From: Automatic detection and recognition of nasopharynx gross tumour volume (GTVnx) by deep learning for nasopharyngeal cancer radiotherapy through magnetic resonance imaging

1: Read training, validation, testing, and mask set, process them into tensor

2: For epoch from 1 to 200

3: For itertraining from 1 to trainingsize/batchsize

4: pass the training data to the training system (FCN, Deeplabv3, U-Net), getting the trainresult

5: accumulate the losstrain by the loss function between trainresult and ground truth mask

6: update weights Wtraining

7: End iter training

8: For iterval from 1 to valsize/batchsize

9: pass the validation data to the trained system, getting valresult

10: accumulate lossval by the loss function between valresult and ground truth mask

11: End iter validation

12: print the average loss by losstrain/(epoch + 1) and lossval/(epoch + 1)

13: End training and val

14: load the model with trained Wweights

15: pass testing data to the model and get testresult

16: compute the mIoU, and mPA

17: merge the images of raw data with testresult and ground truth