## 2 Related Research
### Visual Pattern Standardization Using Dimensionality Reduction
#### 3.2.1 Contour Image Denoising and Image Segmentation  
The contour of the breast cancer image identified through YOLO is detected. The contour detection method used in this paper is contour detection through median values using windows. Figure 9 shows the contour detection process. As shown in Figure 9, contour detection and noise removal are performed after changing the size of the detected image. In this paper, the image size is adjusted to be divided into 16 equal parts when the image size is partitioned with \(N\times N\). For example, an image sized \(256\times 256\) is divided into the size \(64\times 64\) to create 16 partitioned images.  
Figure 8: Breast cancer diagnosis model through normalized pattern transformation using RNN-based visual information.  
Figure 9: Image resize and edge detection.  
Its purpose is to facilitate calculation in the subsequent process, and after this process, the contour of the detected image is detected through Equation (3).  
\[M[x,y]=median\{I[x+n,y+m];(n,m)\in A\}(x,y)\in Z^{2} \tag{3}\]  
Equation (3) calculates the median value of the detected image \(I[\cdot]\) using a window of size \(n\times m\). \(median()\) is a function that calculates the median, and \((x,y)\) is an arbitrary coordinate. \((n,m)\) and \((x+n,y+m)\) have the range of \((n,m)\in A\) and \(1\leq x+n\leq N\), \(1\leq y+m\leq M\). The calculated median values generate the contour image \(G[\cdot]\) after calculating the inclination values for the vertical and horizontal directions through Equation (4). The vertical inclination image \(D_{v}[\cdot]\) and the horizontal inclination image \(D_{h}[\cdot]\) are created through \((x,y+1)\) present on the vertical line and \((x+1,y)\) present on the horizontal line based on the arbitrary coordinates \((x,y)\) of \(M[\cdot]\). \(|\cdot|\) is an absolute value function, and the two generated inclination images do not represent negative numbers. The grayscale image \(G[\cdot]\) is created by calculating the average of these two inclination images. \(E[\cdot]\) is created through the OTSU binarization algorithm [50] to convert \(G[\cdot]\) into a binary contour image.  
\[G[x,y]=\frac{D_{h}[x,y]+D_{v}[x,y]}{2} \tag{4}\] \[E[\cdot]=\mathrm{OTSU}(G[\cdot])\] \[\mathrm{where},D_{h}[x,y]=|M[x,y]-M[x+1,y]|\] \[D_{v}[x,y]=|M[x,y]-M[x,y+1]|\]  
Figure 10 shows the sequence of the images generated during the contour detection process of the original image without the ROI of the preprocessed image to help understand the noise removal of the inner region.  
Figure 10e is an image calculated through the contour detection and binarization process shown above and shows small dot-like noises. We remove the internal small dot-like noises through the labeling algorithm, as shown in Algorithm 2.  
Figure 10: Breast ultrasound image edge detection and noise removal.  
```
Input: X def Labeling:  A = X.copy()  H, W = X.shape[]  pPut, labelNum, LABEL, CHECK = [], {},0, False for h from 0 to H do  for w from 0 to W do if A[h, w] is 255:  pPut.put(h, w)  while \(\text{LEN(pPut)}>0\)do  CHECK = True  n, m = pPut.pop()  A[n, m] = 0 if LABEL in labelNum:  labelNum[LABEL] = labelNum[LABEL].put(n, m) for i from 0 to 3 do if j from 0 to 3 do if A[n+i, m+j] is 255:  pPut.put((n+i, m+j)) if CHECK:  CHECK = False  LABEL += 1 Output: labelNum
```  
**Algorithm 2** Labeling Algorithm