## 2 Methods
### Target Area Screening Module  
In Mask R-CNN [8], the Anchors mechanism is applied in RPN, and the role of RPN is to generate candidate regions from images. The original Anchor setup is shown in Figure 4 below:  
Figure 3: SE module structure. (FC: fully connected layer, ReLU: rectified linear unit). In this paper, we first counted more than 2400 images, and fit the labeled image to the smallest circumscribed rectangle of the segmentation target. Table 1 shows the distribution of the aspect ratio of the smallest circumscribed rectangle. According to the characteristics of segmenting the TRUS image, the proportion of Anchor was changed to {2:1, 1:1}, and the Anchor size was {128, 256, 512}. In the case of the original Anchor mechanism, for a \(3\times 3\) sliding window, nine Anchors are generated at the center of the original image, and only six of them are active after modification. Therefore, the number of Anchors to get {p1, p2, p3, p4, p5} is {256 \(\times\) 2 \(\times\) 3, 128 \(\times\) 2 \(\times\) 3, 64 \(\times\) 2 \(\times\) 3, 32 \(\times\) 2 \(\times\) 3, 16 \(\times\) 2 \(\times\) 3}, which is {393216, 98304, 24576, 6144, 1536}. Among the obtained Anchors, we use the size of the Intersection-over-Union (IoU) to select samples, those with IoU \(>\) 0.9 are positive samples, those with IoU \(<\) 0.3 are subsamples, and the remaining Anchors are not used for final training. The scores of the positive samples calculated through the forward propagation of the RPN network are sorted from high to low, and the first 1000 Anchors with the highest score are taken out. The offsets calculated by the forward propagation of the 1000 Anchors via the RPN network are accumulated to On Anchor box, get more accurate Anchor box coordinates. Before returning the box coordinates, the obtained 1000 Anchors are subjected to a non-maximum suppression operation, and duplicate Anchors are eliminated to obtain a non-repeating ROI. ### Target Area Screening Module  
During the experiment, the accuracy of the target region can affect the final segmentation result to a certain extent. Even when the target region has a higher accuracy rate, the target will still cause the prostate segmentation result to be poor, as shown in Figure 5. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Aspect Ratio** & **\textgreater{}1:1** & **1:1** & **\textless{}1:1** \\ \hline Quantity & 2249 & 145 & 6 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Statistics of the ratio of target minimum circumscribed rectangle length to width. Figure 4: (**a**) The original Anchor mechanism (**b**) The modified Anchor mechanism. The blue line in the figure is the external contour of the prostate. The external contour can be clearly seen in the figure. We can see the border of the target area inside the prostate's contour will cause a large deviation in the entire segmentation result. The size of the Ground Truth is the smallest circumscribed rectangle of the prostate segmentation target. Although the accuracy of the border frame of the obtained target area will have higher accuracy, if the size of the target area is smaller than the true value, the image segmentation will decrease in accuracy. In order to avoid this situation, we propose a new anchor regression calculation method based on the anchor mechanism adopted in Mask R-CNN. The positions of the positive sample and the Ground Truth are shown in Figure 6.  
In the first step, a function is used to calculate the offset between the positive sample and the Ground Truth. This function, SmoothL1 Loss, characterized as  
\[Smooth_{\text{L1}}(x)= \begin{bmatrix}0.5x^{2}&\text{if}[x]<1\\ |x|-0.5\text{ otherwise}^{\prime}\end{bmatrix}  \tag{1}\]  
The corresponding loss function is shown in the formula  
\[\text{Loss}=\sum_{\text{i}\in\{x,y,w,h\}}\text{Smooth}_{\text{L1}}(t_{\text{ i}}), \tag{2}\]  
Figure 5: The border of the target area is inside the contour of the prostate. The blue line represents the outer contour of the prostate and the red dotted line represents the outer boundary of the target area.