## 4 Discussion

Table 3: Comparison of autocontouring performance for different HPO scenarios using training and validation datasets from various numbers of patients. autocontour both P12 and P16 (or 22), which included and excluded seminal vesicles (SVs), respectively, in the contours. This suggests that the algorithm can accommodate varying clinical scenarios in which SVs may or may not be included in the treatment volume. If SVs are excluded, autocontouring becomes more challenging as there is no visible boundary between the prostate and SVs. Comparing the three segmentation methods, HP-optimized U-Net achieved the best overall contouring performance in terms of all three evaluation metrics, while non-optimized U-Net showed the worst performance. Despite the fact that both non-optimized U-Net and nnU-Net achieved mean DC values comparable to the intra- and interobserver DC values, their mean HD values were both larger than the intra- and interobserver HD values of 4.3 (1.7) and 4.7 (1.6) mm [49]. The contours from nnU-Net mostly included holes, ragged edges, and/or small islands. nnU-Net applies post-processing, i.e., removing small islands, only if the DC of its contours on the validation images is improved by removing those islands [27]. As there were no small islands found in the validation results, post-processing was not applied to the testing images, resulting in the observed islands. Although applying post-processing ourselves would improve its performance for these cases, the results were left as they were for a fair comparison of the three methods. Furthermore, as can be seen in Figures 6 and 7, contours by non-optimized U-Net for P19 and 21 largely deviated from the manual contours and differed considerably from those of the other two methods. Considering that the autocontouring accuracies in the training images for these patients were much higher (~0.9 DC) than the accuracies in testing images, the network might have overfit to the training images because non-optimized U-Net did not utilize early stopping. Employing a regularization technique such as early stopping may improve its performance for these patients. For autocontouring speed, HP-optimized U-Net was the fastest method while nnU-Net was the slowest. The large difference in inference time between nnU-Net and the other two methods may have come from the fact that nnU-Net additionally performed test time augmentation, which was applied by mirroring along all axes, as well as instance normalization, which was applied after each convolution. Also, nnU-Net used whole images as input, while image patches were used in the other two methods. Using whole images as input results in performing more matrix computations (during operations such as convolutions) in the network, which may lead to prolonged inference time. The autocontouring time of HP-optimized U-Net was 54.2 ms for each dynamic image. The American Association of Physicists in Medicine (AAPM) Task Group 76 report recommends a maximum delay time of 500 ms for real-time tumor tracking [67]. This delay includes times for image acquisition, reconstruction, contouring, and MLC repositioning. With the rate of intrafractional 2D MR imaging of linac-MR being 4 frames/s (i.e., 250 ms per frame), 54.2 ms is within the clinically feasible range. The autocontouring time, along with the time taken for HPO, can be further reduced using higher-end hardware and optimized coding technique and GPU performance. Studies have shown that an autocontouring time of 1-25 ms is also possible on standard workstation computers [68; 24]. Additionally, even though the HPO of each patient takes 3-9 h on average, this will be performed several days prior to the actual treatment, allowing the autocontouring algorithm to be ready for use at the time of the treatment. In clinical practice, typically ~2 weeks of treatment planning is allowed before treatment, assuming no drastic anatomical change takes place during this period.