## 3 Improved YOLOv8s Network Model
### CGC2f Module  
In the actual open-pit mine environment, the location distribution of obstacles and the complex background often make it easy to ignore the relationship between local information, surrounding information and global information when detecting obstacles, which leads to errors and missed detection in a detection task. Therefore, a Context-Guided Block (CGBlock [21]) is introduced. This module augments a model's capacity to obtain features. It decreases the number of parameters and calculations to achieve lower storage and higher calculation speed, thereby improving the efficiency of the obstacle detection model. GBlock consists of four main components: local feature extractor \(F_{\text{loc}}\), context feature extractor \(F_{\text{sur}}\), joint feature extractor \(F_{\text{jo}}\), and global feature extractor \(F_{\text{glo}}\), as shown in Figure 3. The processing flow of CGBlock can be divided into two main steps. In the first step, the role of \(F_{\text{loc}}\) and \(F_{\text{sur}}\) is to learn local features and their corresponding context features. Among them, \(F_{\text{loc}}\) is defined as a \(3\times 3\) standard convolution layer, which is responsible for extracting local features from eight adjacent feature vectors, reflected in the green area in Figure 3a. The local features here play a key role in accurately identifying the details of obstacles, such as the specific shape contours and texture features of people or construction machinery, and can provide a basic basis for subsequent accurate judgment of the obstacle type. At the same time, \(F_{\text{sur}}\) is set as a \(3\times 3\) extended convolution layer. Due to its large receptive field, it can effectively capture the surrounding context features. The relevant area is marked in orange in Figure 3b. This surrounding context feature covers  
Figure 2: Improved YOLOv8 structure: the improved modules are highlighted in bold, where the red dashed box represents CGC2f, the orange dashed box represents CGBlock, and the green dashed box represents ESE. information such as the relative position relationship between obstacles and surrounding objects, spatial distribution, etc. For example, in an open-pit mine scene, this includes the relative position of construction machinery and the surrounding scattered ore, the position of people relative to the construction machinery, etc. This information helps the model understand the local environment where the obstacle is located so as to better locate and distinguish different obstacles in complex scenes. Therefore, \(F_{\text{joi}}\) generates joint features by integrating the outputs of \(F_{\text{loc}}\) and \(F_{\text{sur}}\). Subsequently, \(F_{\text{joi}}\) is used as a connection layer and is processed by batch normalization (BN) and parameterized PReLU. This step not only makes the data distribution more stable but also enhances the expressiveness of the joint features through the nonlinear transformation of PReLU, making it more adaptable to subsequent processing steps. In the second step, \(F_{\text{glob}}\) is responsible for extracting global context to further enhance the joint features. The global context is treated as a weighted vector and applied to feature channels to refine joint features, highlight useful information, and suppress irrelevant information. This global context information includes the entire macroscopic features of the sensor collection content, such as the overall obstacle distribution, the visual feature differences in different obstacle sizes (construction machinery, pedestrians, potholes, etc. ), the possible impact of background structure information on obstacle detection, etc. Then, a multi-layer perceptron is used to further extract the global context, and through the deep feature extraction capability of the multi-layer perceptron, more representative and discriminative global feature information is mined.