# Airwave Noise Identification from Seismic Data Using YOLOv5
## 3 The Basic Principles of YOLOv5
### Output Layer and Loss Function  
In this study, the model outputs three feature maps, corresponding to grid sizes of 80 \(\times\) 80 \(\times\) C, 40 \(\times\) 40 \(\times\) C, and 20 \(\times\) 20 \(\times\) C, enabling the detection of objects of varying dimensions. Here, C represents the number of channels in the output layer (see Figure 2), calculated as [45]:  
\[C=3\times(n_{clas}+5) \tag{1}\]  
where \(n_{clas}=1\) indicates the number of object classes. Since this paper focuses exclusively on airway noise as a single class, the output layer consists of 18 channels. The number 5 refers to the five parameters associated with each predicted bounding box: the x-coordinate, y-coordinate, width, height, and confidence score. Together, the coordinates and dimensions define the predicted bounding box (also known as the scaled anchor box). The model predicts three different sizes of bounding boxes for each grid cell. Anchor boxes function as the model's initial reference frames, facilitating the YOLOv5m model's ability to detect objects across various grid cells. Prior to training, the network automatically optimizes the sizes and dimensions of these anchor boxes using labeled data and clustering algorithms (such as K-means), which is why they are referred to as prior anchor boxes. During the training process, the model predicts the position and size of objects relative to the anchor boxes, with the network output essentially representing the offsets, width-height scaling factors, and class probabilities in relation to these anchor boxes. After undergoing a series of transformations, these outputs yield the final coordinates for the object bounding boxes. Each grid cell in the model is tasked with detecting the presence of an object within its designated area (confidence) and predicting the corresponding bounding box and category. Each output layer comprises cells that each generate three predicted bounding boxes to  
Figure 2: The YOLOv5m network architecture (modified from [PERSON], 2022 [44]). Conv refers to two-dimensional convolution operations, while BN (Batch Normalization) accelerates network convergence during training and reduces sensitivity to parameter initialization. Concat denotes the concatenation operation used to merge features from different sources. SiLU is the activation function, defined as \(SiLU(x)=\frac{x}{1+\epsilon^{\prime}}\), which is a smooth, nonlinear activation function. This means that it does not introduce discontinuity at zero like ReLU (Rectified Linear Unit), thereby avoiding gradient instability issues. MaxPool refers to the max pooling layer used for downsampling, which reduces the size of the feature map by selecting the maximum value within local regions of the feature map, while preserving the most significant features. accommodate objects of various sizes. Each predicted bounding box is transformed from anchor box and contains a confidence score and multiple class probabilities. For this work, only one class is considered. When computing the loss function, the predictions from all grid cells are considered, with the losses from each cell accumulated to yield an overall loss value. However, if the Intersection over Union (IoU) between the anchor boxes and the corresponding ground truth boxes falls below a specified threshold (e.g., 40%), these anchor boxes are deemed to represent background. Consequently, we can disregard their contribution to the bounding box loss in the loss function and assign a label of 0 for confidence loss. During the prediction phase, the model may output low-confidence bounding boxes, indicating potential background areas. The grid structure allows each grid cell to concentrate solely on the objects within its respective region (see Figure 3) using non-max suppression, thereby streamlining the object detection process and enhancing the model's ability to learn features from diverse areas effectively. Furthermore, identical or adjacent grid cells may produce multiple overlapping anchor boxes.