# Channel Pruning-Based YOLOv7 Deep Learning Algorithm for Identifying Trolley Codes
## 2 Development of the Algorithm  
### Dataset Creation  
The object of research used in this study is a rectangular block of iron that simulates a trolley under normal working conditions. We used a Dahua A3504 MG100 industrial camera to capture images of the workpiece. We drew a horizontal line parallel to the longest side of the rectangular iron block and marked six points at 5 cm intervals. To create the desired configuration, it is necessary to create a large hole with a diameter of 2 cm at the initial point, and smaller holes with a diameter of 1 cm at subsequent points along the horizontal line. Alternatively, no holes should be made. As depicted in Figure 1, a large hole should be punched at the first point, while small holes should be punched at the second, third, and sixth points. No holes are required at the fourth and fifth points. Consequently, the distance between the small holes at the third and sixth points measures 15 cm.  
The study consists of four samples, namely 01111N, 01111L, 01111S, and 0111. Among these samples, 01111L and 01111S exhibit variations in the locations of small holes. Additionally, these two samples differ in length. The sample images can be observed in Figure 2. Detailed information regarding the collected dataset is presented in Table 1. A total of 1559 images were captured for four artifacts, with 423 images for sample 01111N, 426 images for sample 01111L, 302 images for sample 01111S, and 408 images for sample 0111. The resolution of these images was 778 pixels (horizontal) \(\times\) 583 pixels (vertical). Eighty percent of the dataset, consisting of 1248 images, was allocated as the training set for the YOLOv7 object detection algorithm. The remaining 20% of the dataset, comprising 311 images, was designated as the test set to evaluate and validate the algorithm's performance.  
The dataset utilized in this study possessed the following attributes: it consisted of images of four distinct workpieces that were captured for the purpose of target selection. This was to ensure that the proposed method had the capability to detect various trolley codes, thereby demonstrating its adaptability. Additionally, the lighting, lens, and position of the workpiece were consistently modified during the process of image acquisition. This deliberate adjustment resulted in a dataset comprising images with varying light intensities and the target positioned at different distances from the camera. The purpose of this approach was to ensure the method's adaptability to different illumination conditions and workpieces of varying sizes. The process of manually labeling the large and small holes in all images was conducted using the LabelMe tool. It was ensured that the holes were accurately positioned at the center of the bounding box during the labeling process. The label box used for this purpose was rectangular in shape and categorized into two distinct categories. One category of boxes with red labels designates large holes, while another category of boxes with green labels designates small holes. The corresponding text file was generated, and Figure 3 illustrates the markers present in one image within the dataset.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Sample Model Coding** & **Number of Samples** \\ \hline
01111N & 423 \\
01111L & 426 \\
01111S & 302 \\
01111 & 408 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Information from the dataset.  
Figure 1: Example of code 0111.  
Figure 2: Images sourced from the dataset. Samples (**a–d**) correspond to the following codes: 0111, 01111S, 01111L, and 01111, respectively.