## 3 Proposed Method
### Model Training  
As discussed in the previous section, our model is based on the YOLOv3 architecture. A total of over 556 images were randomly distributed to the training dataset, which received 400 images, and 156 images were distributed to the validation dataset. A batch size of four and fixed momentum value of 0.9, as well as a learning rate of 0.0001, were considered. The training process was repeated 10 times independently, where the trainable weights were initialized. To track the best model for each execution, an early stopping method was applied when the loss on the validation set was not improved for five consecutive epochs. The validation loss results over the 10-time training process is summarized in Table 3. These results indicate that, on average, it took 10 to 11 epochs for the model to reach stability. Each process took over 12 h to complete 800 iterations across the 10 epochs, totaling 8000 iterations (Table 4). To overcome the limitation of the training dataset and obtain more accurate outcomes, a transfer learning approach was employed to train the YOLOv3 model. It offers the benefit of enabling a network trained on a limited ground-truth dataset to achieve significant accuracy in detection [20]. Trained weights from ImageNet for YOLOv3 darknet [33] were transferred to the model. During training, the model produced an output in every iteration and validation loss was minimized. The evaluation metrics used in this study are mean average precision (\(mAP\)), recall, and F1-score, defined by Equations (1), (2), and (3), respectively. The model with the highest precision among the 10 executions was chosen as the optimal model. \[mAP=\frac{1}{N}{\sum_{i=1}^{N}AP_{i}}=AP \tag{1}\]  
where \(N\) is the number of classes and \(AP_{i}\) is the average precision for class \(i\). In this study case, \(N=1\), which implies \(mAP=AP\). \[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{2}\] \begin{table}
\begin{tabular}{c c} \hline Iterations & 8000 \\ Batch size & 4 \\ Learning rate & 0.0001 \\ Epochs & 10 \\ Confidence threshold & 0.5 \\ \hline \end{tabular}
\end{table} 
Table 4: Model training hyperparameters. \begin{table}
\begin{tabular}{c c} \hline CPU & Intel® i7 8 th Gen \\ GPU & NVidia GTX 1070 \\
**Frequency** & 3.2 GHz \\
**RAM** & 16 GB \\
**Storage** & 500 Gb SSD \\
**Operating system** & Windows 10 \\
**Programming platform** & Python 3.8 \\ \hline \end{tabular}
\end{table} 
Table 2: Machine used for training. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline Training process & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline Best validation & 8.75 & 8.43 & 8.69 & 8.40 & 8.33 & 8.00 & 7.75 & 8.25 & 8.10 & 7.94 \\ \hline Epoch & 13 & 17 & 10 & 12 & 8 & 13 & 7 & 15 & 11 & 9 \\ \hline \end{tabular}
\end{table} 
Table 3: The validation loss results over 10 independent executions. \[\text{F1}=2\times\frac{\text{precision}\times\text{recall}}{\text{precision}+\text{ recall}} \tag{3}\]  
The loss function used in this study is given in (4), where \(loss_{1}\), \(loss_{2}\), and \(loss_{3}\) are the bounding box regression loss function, Smooth L1 loss, and classification loss, respectively. \[loss=loss_{1}+loss_{2}+loss_{3} \tag{4}\]  
For \(loss_{1}\), we utilize intersection over union (\(IoU\)) based on the provided annotations. These annotations include \(\left(x_{1}^{g},y_{1}^{g}\right)\) and \(\left(x_{2}^{g},y_{2}^{g}\right)\) for representing the top-left and bottom-right coordinates of the ground truth bounding box, respectively.