# Research on Road Pattern Recognition of a Vision-Guided Robot Based on Improved-YOLOv8
## 4 Research on Road Pattern Recognition Based on YOLOv8  
### Construction of pavement Pattern Recognition Model Based on YOLOv8n  
YOLO (You Only Look Once) can get the detection box and category of all targets in the picture through one inference, so it has the advantages of fast recognition speed and strong generalization ability. In order to achieve faster and more accurate image classification, target monitoring, and instance segmentation, Ultralytics launched YOLO v8, a new target detection model, in 2023. The model realizes real-time adjustment of the number of channels of different scale models by designing a C2f structure, and by referring to the design of the ELAN module, the YOLO v8 network has the advantages of lightweight and rich gradient information.  
The C2f module consists of a Conv module, a Split, and several Bottlenecks. The beginning of C2f is a Conv module. The input feature image of C2f first passes through Conv and outputs a feature image with a shape of h \(\times\) w \(\times\) c. The Split divides the feature image into two groups of h \(\times\) w \(\times\) 0.5c feature images in the channel dimension to increase the richness of feature information. The two divided sets of feature images are used as independent branches for cross-layer concat stitching, and one set of feature images is used as the input of n Bottlenecks. Bottleneck is a residual structure. In C2f, n Bottlenecks are stacked continuously to form a main branch, and the output of each Bottleneck is used as an independent branch for cross-layer concat stitching. The feature images output by the main branch of Bottleneck, the two sets of feature images output by Split and the feature images output by n Bottlenecks are stitched in dimensions. Finally, the feature image with a channel number of 0.5 \(\times\) (n + 2)c is obtained, and the height and width of the feature image remain unchanged. The h \(\times\) w \(\times\) 0.5 \(\times\) (n + 2)c feature image passes through a terminal Conv, and the final obtained feature image is used as the output of C2f.  
YOLOv8 has a faster speed, higher accuracy, and fewer parameters. The model is divided into different versions, such as n, s, m, l, and x, according to the depth and width. As the size of the model increases from n to x, the time and computation required for training gradually increase. Although the smaller model has lower accuracy, it has fewer parameters and a faster speed, making it suitable for the application of small computing equipment or models. Our dataset contains more than 3000 images, which cannot be counted as a large model, so YOLO v8n will be used as the main model for relevant research.  
In this section, the AGV pavement classification model is based on the YOLO v8n backbone network [42; 43]. As shown in Figure 4, different pavement images with an input size of 640*640*3 are processed for feature extraction. The calculation formula for the feature map is as follows:  
Feature_new = (Feature_old \(-\) kernel + 2* padding)/stride + 1  
i.e.:  
\[H_{n}=\frac{H-f+pad*2}{stride}+1\]  
\[W_{n}=\frac{W-f+pad*2}{stride}+1\]Further, through global average pooling and linearization processing, it is converted into a one-dimensional vector input to a linear classifier to accurately and efficiently classify 21 categories of images of different pavements.