## 4 Discussion  
As shown in Figure 3, the proposed method correctly detected early gastric cancer lesions, and the shape of the segmented gastric cancer region was also similar to that of the ground truth. FPs were detected in the shadowed areas caused by endoscopic illumination. Regarding false negatives, lesions with subtle changes in pattern or lesions on the side of the image were not often detected.  
Figure 4 shows that the FROC curve of the lesion-based evaluation was better than that of the image-based evaluation. In the case of endoscopy, the number of images collected in one examination varied. During the image-based evaluation, cases with a large number of images were biased. However, in the lesion-based evaluation, the variation in the number of images due to the case could be ignored. In FROC curve (b), if the occurrence of FPs was allowed, the detection sensitivity was 97.9% with 0.4 FPs per image. Furthermore, if it was necessary to balance the detection sensitivity and the number of FPs, it was possible to select a parameter that had a detection sensitivity of 95.0% with 0.1 FPs per image. It can be said that these results are sufficiently favorable.  
Figure 4: Free-response receiver operator characteristics (FROC) curves of (**a**) image-based evaluation and (**b**) lesion-based evaluation.  
Figure 5: Histogram of the Dice index.  
The accuracy of the segmentation area was better with Mask R-CNN than with U-Net. Mask R-CNN first conducted rough detection of an object and performed segmentation inside it. The training of segmentation could be performed only around the gastric cancer region, and it can be inferred that the segmentation was more accurate.  
The FPs were classified into four categories: (a) lesion of the pyloric ring included images (33.9%), (b) gastric angle included images (11.8%), (c) non-pathological small structures or changes such as bubbles, water, scratches, and redness (25.2%), and d) others (29.1%). To reduce FPs, we will develop a classification algorithm for the abovementioned objects in the future.  
Although an accurate comparison is not possible because a different database was used, the proposed method using Mask R-CNN had a better detection sensitivity than those in previous studies using an SSD [14]. In addition, SSD detects lesions with a bounding box, whereas the proposed method can obtain the bounding box and the segmentation results simultaneously. The average value of Di calculated in the detected region was 72%, which indicates that the proposed method can accurately segment the invasive region of gastric cancer. Regarding FPs, this study is intended for use as a diagnostic support tool during endoscopy. Therefore, an FP that the physician can easily recognize is acceptable. We believe that the current number of FPs has reached a sufficient level.  
Regarding the limitations of this method, training and evaluation of the proposed method were carried out using the data collected at a single facility only. We plan to evaluate the performance using images collected at other facilities. Furthermore, we used preoperative examination images in this study because it was important that the ground truth be accurate. However, in the future, we would like to use image data such as screening endoscopic images and movies.