## 3 Methodology  
### YOLOv4 Model Improved by Channel Pruning Technology  
Previous research [9] by our team found that from comparative experiments of various target detection algorithms, YOLOv4 was the most suitable algorithm for detecting complex form stem nodes so far. However, the disadvantages of this algorithm are also obvious. It has a very complex network structure and a large number of network parameters, which requires high GPU processing power and is not suitable for transplanting to the embedded chip of a harvesting robot. Therefore, the model needs to be compressed. Channel Pruning Technology (CPT) [15] greatly reduces the size of the model but hardly affects the identification accuracy by means of eliminating the ineffective channels and their related inputs and outputs after identifying network channels. In this paper, the CPT was adopted to simplify the YOLOv4 algorithm model, and the Gamma (\(\gamma\)) coefficient of the Batch Normalization (BN) layer was selected as the evaluation index of the channel importance. According to the distribution of the \(\gamma\) coefficient and the pruning rate set by the optimal solution, the network channels of the algorithm were reduced by reserving the channels that played a greater role (blue part) and deleting the channels with \(\gamma\) coefficients approaching zero (orange part), as shown in Figure 6.  
The experimental environment used in this improved experiment is as follows: Hardware: Intel Xeon Gold 5218 CPU @ 2.3 GHz processor, 64 GB memory; NVIDIA RTX 2080 Ti GPU, 11 GB memory; Environment: CUDA10.2, cuDNN7.6.5, python3.6, pytorch1.8.1; Windows10 64 bit operating system. The dataset used in this improved experiment was sugarcane node images self-collected from the sugarcane planting base in Agricultural New Town, Guangxi University, China. The sugarcane variety was Guitang No. 49, and the average stem diameter was about 2.5 cm. To collect the complex field environment data, images of sugarcane nodes completely wrapped, half wrapped and unwrapped by sugarcane leaves from different angles and distances of the camera were collected at different time periods, as shown in Table 1. The stem node samples collected in different modes are shown in Figure 7. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Time**} & **Fully** & **Half** & **Not** & **45** & **90** & **135** & **30 cm** & **40 cm** & \\  & **Wrapped** & **Wrapped** & **Wrapped** & **Degrees** & **Degrees** & **Degrees** & **Distance** & **Distance** & **Total** \\ \hline
08:00 a.m. & 50 & 50 & 50 & 50 & 50 & 50 & 50 & 50 & 400 \\
13:00 p.m. & 100 & 100 & 100 & 100 & 100 & 100 & 100 & 100 & 800 \\
18:00 p.m. & 50 & 50 & 50 & 50 & 50 & 50 & 50 & 50 & 400 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Data collection of stem nodes in a complex field environment. Figure 6: The process of channel pruning in this paper. At the same time, the samples were expanded by changing the saturation, sharpness, contrast and brightness of the images, and rotating them by 30 degrees. The dataset consisted of single sugarcane images with a single stem node, single sugarcane images with three stem nodes averagely and multiple sugarcane images with more than five stem nodes averagely. Finally, a dataset of 8000 images was obtained, of which 7200 were used as training sets and 800 as test sets. The method of the YOLOv4 model improved by CPT is as follows. 1. Normal training. A convergent and accurate YOLOv4 sugarcane node identification model is trained normally. 2. Sparse training. The L1 regularisation training is carried out on the BN layer of the normal training model, so that the \(\gamma\) coefficient of the BN layer is as close to 0 as possible, and the sparse weights are redistributed to other effective layers of the network. 3. Pruning. The channels in the BN layer with the \(\gamma\) coefficients approaching zero are picked out, and the channels are pruned according to the set pruning ratio to generate a simplified model that occupies less memory space. 4.