## 2 Proposed ARRS
### Character Recognition
#### 2.4.2 Recognition of Printed Characters through YOLOv4-s
Because the sizes of the receipt images in our dataset may differ, the width and height of each receipt image must be normalized to the width and height of the box. The normalization formula is expressed as follows:  
\[w=\frac{w_{box}}{w_{img}},\;\;h=\frac{h_{box}}{h_{img}} \tag{7}\]  
where \(w\) and \(h\) are normalized width and height, \(w_{box}\) and \(h_{box}\) are the box width and height, \(w_{img}\) and \(h_{img}\) are the image width and height. Step 2. \(K\) boxes are randomly selected as the initial anchor. Figure 6: Identifying a real object by using an anchor box. The YOLOv4 model contains three layers of different sizes, and each layer selects three anchor boxes. Therefore, the size of \(K\) can be set to 3 \(\times\) 3, implying a total of nine anchor boxes. Step 3. Intersection over union (IoU) is used as a metric, and each box is assigned to the anchor closest to it. IoU is more suitable as a metric than the Euclidean distance in the original k-means clustering method. If anchor = (\(w_{a}\), \(h_{a}\)) and box = (\(w_{b}\), \(h_{b}\)), then the IoU between the anchor and the box is as follows:  
\[ \begin{split} IoU(box,anchor)&=\frac{intersection( box,anchor)}{union(box,anchor)-intersection(box,anchor)}\\ &=\frac{\min(w_{a},w_{b})\cdot\min(h_{a},h_{b})}{w_{a}h_{a}+w_{ b}h_{b}-\min(w_{a},w_{b})\cdot\min(h_{a},h_{b})}\end{split}  \tag{8}\]  
where the \(w_{a}\) and \(h_{a}\) are the width and height of anchor, the \(h_{a}\) and \(h_{b}\) are the width and height of box. The final distance \(d\) formula is expressed as follows:  
\[d(box,anchor)=1-IoU(box,anchor) \tag{9}\]  
If the box and the anchor completely overlap, the IoU value is 1, and the distance between them is 0. Step 4. The average width and height of all the boxes in each cluster are calculated to update the anchor. Assume that \(n\) boxes exist in the cluster:  
\[cluster(box_{0},box_{1}\ldots box_{n}),\ box_{n}=(w_{n},h_{n}) \tag{10}\]  
where the \(w_{n}\) and \(h_{n}\) are the width and height of \(box_{n}\). The average width and height of all boxes can be derived as follows:  
\[mean(cluster)=\frac{\sum_{i=0}^{n}(w_{i},\ h_{i})}{n} \tag{11}\]  
where the \(w_{i}\) and \(h_{i}\) are the width and height of \(box_{i}\), \(n\) represent the total number of box. Step 5. Steps 2 and 3 are repeated until the anchor does not change or the maximum number of iterations is reached. Backbone Architecture Optimization for Small-Object Recognition  
The backbone of the YOLOv4 model is characterized by a 32\(\times\) downsampling, and features processed at 8\(\times\), 16\(\times\), and 32\(\times\) downsampling features are sent back to the FPN. A higher downsampling rate results in a smaller feature map but a larger object. In other words, the features transmitted from the backbone architecture tend to be larger objects. The feature s of small objects gradually disappears after the convolution and downsampling processes. To improve the accuracy of the YOLOv4 model in extracting the features of small objects, its backbone architecture must be modified. Accordingly, this study deleted the convolutional and bottleneck layers of CSPNet in the model. In addition, the downsampling features were modified to 4\(\times\), 8\(\times\), and 16\(\times\), thus yielding the optimized YOLOv4-s model that can retain more small-object features and send them to the FPN. The YOLOv4-s model is detailed as follows:  
1. The YOLOv4-s model does not contain the last layer of CSP4 in the backbone architecture of YOLOv4 (Figure 7a), as displayed in Figure 7b. 2. The shortcut connection between the backbone and the FPN is moved between CSP2 and the first CSP8, as illustrated in Figure 7b.