## 2 Methodology
### Basis of Classifier Voting Technique  
The recognition results of the target network may be in different categories, so the target classification needs a post-processing algorithm to make the final judgment and the final classification. The algorithm uses the result of target recognition and then performs a second operation to meet the classification requirements. The method can be an effective method of classifying the TNR dataset. Our post-processing algorithm uses a set vote classifier. This idea can classify the results of the target network, based on which the final decision is taken. Typical approaches are as follows: majority voting (also known as hard  
Figure 3: Structure of YOLOv4 [27] C1–C3 refer to the feature layers of the last three scales. SPP refers to spatial pyramid pooling, C3 layer are disposed with 5 \(\times\) 5, 9 \(\times\) 9, and 13 \(\times\) 13 pooling operations respectively.P1,P2,P3 (C1–C3 after aggregation of adjacent layers through down-sampling and up-sampling), \(\circled{\textregistered}\) refers to the aggregation operation. Figure 2: Structure of YOLOv3-Tiny [26] C1,C2 refer to the feature layers of the last two scale. P1,P2 (After superimposition of adjacent layers through upper sampling). \(\oplus\) refers (The superimposition operation). voting), weighted majority voting, and more robust algorithms based on bagging and boosting ideas [46; 47], such as a popular AdaBoost.M1 method [48]. \[GP=\{GP_{1},\ldots,\,GP_{k}\};\,k=1\ldots N \tag{3}\]  
In the following example, the group \(GP\) is a series usually composed of basic classifiers that are not too complicated. On the assumption that:  
Let the decision of the \(kth\)classifier that chooses the \(j\)th class be denoted as  
\[d_{k,j}\in\{0,1\};k=1,\ldots,N;j=1,\ldots,M, \tag{4}\]  
where \(N\) is the number of the prediction classifiers and \(M\) is the number of predicted classes. If the \(kth\) results of object detection choose the \(jth\) class, then \(d_{k,j}=1\), and \(d_{k,j}=0\) otherwise. The ensemble mechanism will then choose the featured class \(j\) that receives the largest total vote. The situation of weighted majority voting is different from hard voting, as weighted voting defines the factor \(\omega_{k}\) according to a certain performance index, which is the weight assigned to the \(kth\) classifier, denoted as \(GP_{k}\). Here, we define the simplest ensemble voting index \(DG\) is as follows. \[D_{G}=\underset{j=1,\ldots,M}{argmax}\sum_{k=1}^{N}\ \omega_{k}d_{k,j} \tag{5}\]  
where \(k\) is equivalent to the number of the associated classifier, while j is chosen as the featured class when the pattern recognition is computed. For example, suppose there is a set of three classifiers \(GP=\{GP_{1},\ldots,\,GP_{k}\}\), and three weights \(\omega\_1\), \(\omega\_2\), and \(\omega\_3\), which classify an observation as follows:  
\[ \begin{array}{l}\text{For}\ GP_{1}\rightarrow\ class\ A\ \text{and}\ \omega\_1=0.2.\\ \text{For}\ GP_{2}\rightarrow\ class\ A\ \text{and}\ \omega\_2=0.1.\\ \text{For}\ GP_{3}\rightarrow\ class\ B\ \text{and}\ \omega\_3=0.5.\\ \end{array} \]  
This means that each \(GP_{1}\), \(GP_{2}\), and \(GP_{3}\) classifier chooses the \(class\ A\) with \(\omega\_1=0.2\), \(class\ A\) with \(\omega\_2=0.1\), and \(class\ B\) with \(\omega\_3=0.5\), respectively. Then, following (5) we calculate the voting index \(D_{G}\) as:  
\[ \begin{array}{l}\sum\limits_{k=1}^{3}d_{K,A}=0.2\times 1+0.2\times 1+0.5 \times 0=0.4\\ \sum\limits_{k=1}^{3}d_{K,B}=0.2\times 0+0.2\times 0+0.5\times 1=0.5\\ \sum\limits_{k=1}^{3}d_{K,C}=0.2\times 0+0.2\times 0+0.5\times 0=0\\ \end{array}  \tag{6}\]  
Therefore, this maximum voting result will classify the sample as \"class B\". This algorithm will be used and is very suitable for our application. In this research, a calculated confidence score of detected featured class or category will be used as the weighting factor (\(\omega_{k}\)), while one of the four classes, say male dog, will be treated as 1 and 0 will be used for female dog, male cat, and female cat.