Street garbage detection method based on improved YOLOv8s
By improving the YOLOv8s model, integrating the self-attention mechanism and improving the loss function, the problem of low detection accuracy in street litter detection is solved, achieving efficient identification and localization of small targets, and making it suitable for real-time detection in complex backgrounds.
Patent Information
- Application Number
- CN202411585399.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2026-05-08
AI Technical Summary
In street litter detection scenarios with complex backgrounds and numerous small targets, the existing YOLO algorithm has low detection accuracy and struggles to effectively identify and locate small litter targets.
An improved YOLOv8s model is adopted, which integrates the FocusedLinearAttention self-attention mechanism to form the C2f-FLA module, introduces the AIFI module of RT-DETR, and improves the loss function to Focal-EIoU to enhance the model's ability to extract global context information and detect small objects.
It improves the accuracy and efficiency of street litter detection, enabling more accurate identification and location of small litter targets, and is suitable for real-time detection in complex backgrounds.
Smart Images

Figure CN121999424A_ABST
Abstract
Description
Technical Field
[0001] This invention is a street litter detection method based on an improved YOLOv8s, belonging to the field of target detection. Background Technology
[0002] Research on street litter detection algorithms can help improve urban environmental sanitation management and achieve intelligent and precise waste sorting and disposal. At the same time, the application of these algorithms can significantly reduce labor costs, promote resource recycling, and provide strong support for building a green, smart, and livable urban environment. However, in street litter detection scenarios with complex backgrounds and numerous small targets, detection accuracy and speed still have shortcomings.
[0003] The YOLO algorithm, as a one-stage object detection algorithm, treats object detection as a regression problem, directly converting the input image into the output bounding box and category. It completes all predictions in one go, without generating candidate regions, directly locating and classifying objects across the entire image. It is significantly faster than two-stage detection algorithms like Faster R-CNN in terms of detection speed. However, because it prioritizes speed, it sacrifices some ability to capture detailed features and global contextual information. Therefore, designing an efficient and reliable street litter image detection method for complex backgrounds and numerous small objects has become an urgent technical problem to be solved. Summary of the Invention
[0004] Purpose of the invention: To address the shortcomings of existing technologies, this invention proposes a street litter detection method based on an improved YOLOv8s, which solves the problem of low detection accuracy in street litter detection scenarios with complex backgrounds and many small targets, and improves the detection efficiency and accuracy of small targets.
[0005] Technical Solution: To achieve the above objectives, the present invention provides a street litter detection method based on an improved YOLOv8s, comprising the following steps:
[0006] Step 1: Acquire street garbage images, label and preprocess them, construct a dataset based on the preprocessed data, and divide the dataset into training set and test set according to the proportion;
[0007] Step 2: Based on the YOLOv8s model, the C2f-FLA module is formed by integrating the FocusedLinearAttention self-attention mechanism to enhance the model's expressive power, obtain a larger receptive field, and improve the model's ability to extract global contextual information.
[0008] Step 3: Introduce the AIFI module of RT-DETR into the neck layer of YOLOv8s. The AIFI module enhances the feature representation capability through multi-head self-attention mechanism and feedforward network layer, thereby improving the detection capability of small targets.
[0009] Step 4: Improve the CIoU loss function of YOLOv8s to the Focal-EIoU loss function to solve the problem of inaccurate localization of street garbage detection.
[0010] Preferably, in step 2, the addition of the FocusedLinearAttention self-attention mechanism specifically includes:
[0011] (1) FocusedLinearAttention uses linear attention, which is different from the SoftMax attention of the Transformer model. Linear attention decouples SoftMax into two independent functions, thereby changing the order of attention calculation from (query·key)·value to query·(key·value), which reduces the overall computational complexity to linear.
[0012] (2) Linear attention has a very even distribution, which makes the output features close to the average of all features, making it impossible to focus on more informative features. The focus function in Flatten Transformer solves this problem:
[0013]
[0014]
[0015] Where x**p represents raising x to the power of p digits. It can be proven that, under easily satisfyable assumptions, this focusing function can make the inner product of similar vectors larger and the inner product of dissimilar vectors smaller, thus achieving focusing;
[0016] (3) Linear attention cannot produce a full-rank attention matrix. The rank of the linear attention matrix is limited by the smaller of the dimension d of each head and the number of features N, as expressed below:
[0017]
[0018] Generally, d is smaller than N. For example, in DeiT, d = 64 and N = 196; in Swin Transformer, d = 32 and N = 49. Therefore, linear attention matrices typically cannot achieve full rank N, which means there is redundancy between weights in different rows. Since the output of self-attention is obtained by weighting these weights on the same set of values, the homogenization of weights inevitably leads to a decrease in the diversity of model outputs, thus affecting model performance. To address this issue, lightweight depthwise separable convolution (DWC) is used to restore the rank of the attention matrix. The mathematical formula is as follows:
[0019]
[0020] In depthwise separable convolution, each query only focuses on a few spatially adjacent features, rather than all values. Therefore, even if two queries in linear attention have similar outputs, the model can still obtain different outputs from the local features proposed by DWC, thus ensuring feature diversity. The role of DWC can also be explained from the perspective of matrix rank, as shown in the following mathematical formula:
[0021]
[0022] As shown in the formula, the equivalent attention matrix is the sum of the original linear attention matrix and the sparse matrix corresponding to DWC. The sparse matrix corresponding to DWC is capable of achieving full rank, so the entire equivalent matrix can achieve full rank. After introducing DWC, the equivalent attention matrix reaches full rank, which can maintain feature diversity.
[0023] Preferably, in step 3, the AIFI module specifically comprises:
[0024] (1) The multi-head self-attention mechanism layer is used to capture global context information in the image and improve the self-attention layer; the multi-head self-attention mechanism layer sets up multiple sets of weight matrices composed of query vector, key vector and value vector, maps the query, key and value through h different linear transformations, then concatenates different attentions, and finally performs a linear transformation. Each set of attention is used to map the input to different sub-representation spaces, which allows the model to focus on different positions in different sub-representation spaces;
[0025] (2) The feedforward network layer is a fully connected feedforward network, and each position passes through this identical feedforward neural network alone; the feedforward network layer consists of two linear transformations, that is, two fully connected layers, and the activation function of the first fully connected layer is the ReLU activation function;
[0026] Preferably, in step 4, the model uses the Focal-EIoU (Focal Enhanced Intersectionover Union) loss function, which explicitly measures the differences in the three elements of overlapping area, center point, and side length. Its mathematical expression is as follows:
[0027] L EIoU =L IoU +L dis +L asp ,
[0028]
[0029] Among them, L IoU For IoU loss, L dis For the center point distance loss, L asp is the length and width loss; w and h are the width and height of the minimum bounding box that covers both the predicted and ground truth boxes.
[0030] Beneficial effects
[0031] (1) Based on the YOLOv8s model, improvements were made to solve the problem of low detection accuracy in street garbage detection scenarios with complex backgrounds and many small targets.
[0032] (2) The C2f-FLA module is formed by integrating the Focused LinearAttention self-attention mechanism, the AIFI module with RT-RETR is introduced, and the loss function is optimized. The introduction of these techniques aims to improve the model's ability to express global contextual information, and to improve the detection accuracy of small targets and the model's ability to locate garbage.
[0033] (3) The provided method has broad application scenarios in the field of street litter detection. In summary, this invention is an effective and efficient street litter detection method based on improved YOLOv8s, with strong practical value and application prospects. Attached Figure Description
[0034] Figure 1 This is a flowchart of the steps of the present invention;
[0035] Figure 2 This is a model framework diagram of the present invention;
[0036] Figure 3 This is a structural diagram of the C2f-FLA module of the present invention;
[0037] Figure 4 The training results of the improved YOLOv8s detection method described in this invention on a street litter detection dataset;
[0038] Figure 5The detection results of the improved YOLOv8s detection method described in this invention are shown in various categories.
[0039] Figure 6 The results of the ablation experiment mAP value comparison for the detection method of the improved YOLOv8s of this invention; Detailed Implementation
[0040] To provide a better understanding of the structural features and effects achieved by the present invention, a detailed description is provided below, accompanied by preferred embodiments and accompanying drawings:
[0041] like Figure 1 As shown, the street litter detection method based on the improved YOLOv8s described in this invention includes the following steps:
[0042] Step 1: Construction of the street litter detection dataset: Collect street litter image data samples involving six categories: garbage bags, foam, bottles, cardboard boxes, and aluminum cans through on-site shooting and online crawling. The collected images are uniformly numbered and labeled to construct a street litter detection dataset, which contains approximately 3,000 images.
[0043] In the process of detecting street litter, a large amount of data is usually required to continuously train the model in order to improve the recognition accuracy. However, currently, there are very few publicly available street litter datasets online, and most of them are unsuitable for the experiments in this invention. Therefore, it is necessary to establish a dataset specifically for litter detection tasks in the complex backgrounds of real-world streets.
[0044] The specific steps are as follows:
[0045] (1) Obtain street image data sources through on-site shooting and online crawling.
[0046] (2) Collected images are uniformly numbered and labeled. The categories include six categories: garbage bags, foam, bottles, cardboard boxes, and aluminum cans, resulting in labeled image data sources and labels.
[0047] (3) The labeled image data sources and labels are augmented to increase the data volume. The data augmentation methods include mirroring and random cropping to obtain the final street garbage detection dataset.
[0048] Step 2: Based on the YOLOv8s model, the C2f-FLA module is formed by integrating the FocusedLinearAttention self-attention mechanism to enhance the model's expressive power, obtain a larger receptive field, and improve the model's ability to extract global contextual information.
[0049] The specific steps are as follows:
[0050] (1) FocusedLinearAttention uses linear attention, which is different from the SoftMax attention of the Transformer model. Linear attention decouples SoftMax into two independent functions, thereby changing the order of attention calculation from (query·key)·value to query·(key·value), which reduces the overall computational complexity to linear.
[0051] (2) Linear attention has a very even distribution, which makes the output features close to the average of all features, making it impossible to focus on more informative features. The focus function in Flatten Transformer solves this problem, as shown in the following formula:
[0052]
[0053] Where x**p represents raising x to the power of p digits. It can be proven that, under easily satisfyable assumptions, this focusing function can make the inner product of similar vectors larger and the inner product of dissimilar vectors smaller, thus achieving focusing;
[0054] (3) Linear attention cannot produce a full-rank attention matrix; in fact, the rank of a linear attention matrix is limited by the smaller of the dimension d of each head and the number of features N, as expressed below:
[0055]
[0056] Generally, d is smaller than N. For example, in DeiT, d = 64 and N = 196; in Swin Transformer, d = 32 and N = 49. Therefore, linear attention matrices typically cannot achieve full rank N, which means there is redundancy between weights in different rows. Since the output of self-attention is obtained by weighting these weights on the same set of values, the homogenization of weights inevitably leads to a decrease in the diversity of model outputs, thus affecting model performance. To address this issue, lightweight depthwise separable convolution (DWC) is used to restore the rank of the attention matrix. The mathematical formula is as follows:
[0057]
[0058] In depthwise separable convolution, each query only focuses on a few spatially adjacent features, rather than all values. Therefore, even if two queries in linear attention have similar outputs, the model can still obtain different outputs from the local features proposed by DWC, thus ensuring feature diversity. The role of DWC can also be explained from the perspective of matrix rank, as shown in the following mathematical formula:
[0059]
[0060] As shown in the formula, the equivalent attention matrix is the sum of the original linear attention matrix and the sparse matrix corresponding to DWC. The sparse matrix corresponding to DWC is capable of achieving full rank, so the entire equivalent matrix can achieve full rank. After introducing DWC, the equivalent attention matrix reaches full rank, which can maintain feature diversity.
[0061] Step 3: Introduce the AIFI module of RT-DETR into the neck layer of YOLOv8s. The AIFI module enhances the feature representation capability through multi-head self-attention mechanism and feedforward network layer, thereby improving the detection capability of small targets.
[0062] The specific steps are as follows:
[0063] (1) The AIFI module uses a multi-head self-attention mechanism layer to capture global context information in the image and improve the self-attention layer. The multi-head self-attention mechanism layer sets up multiple sets of weight matrices composed of query vector, key vector and value vector. The query, key and value are mapped through h different linear transformations. Then, different attentions are concatenated and finally a linear transformation is performed. Each set of attention is used to map the input to different sub-representation spaces, which allows the model to focus on different positions in different sub-representation spaces.
[0064] (2) The feedforward network layer of the AIFI module is a fully connected feedforward network, and each position passes through this identical feedforward neural network individually; the feedforward network layer consists of two linear transformations, namely two fully connected layers, and the activation function of the first fully connected layer is the ReLU activation function.
[0065] Step 4: Improve the CIoU loss function of YOLOv8s to the Focal-EIoU loss function to solve the problem of inaccurate localization of street garbage detection.
[0066] The specific steps are as follows:
[0067] (1) In object detection tasks, the loss function of bounding box regression has a significant impact on model performance. The original YOLOv8s model uses the CIOU (Complete Intersection over Union) loss function, which, while improving aspect ratio similarity to some extent, has limitations in optimizing the overlapping area between predicted and ground truth boxes and reducing their differences. To further improve the model's localization accuracy and convergence speed, this chapter proposes replacing the CIOU loss function with the Focal-EIoU (Focal Enhanced Intersection over Union) loss function, changing the bounding box regression loss function to Focal-EIoU. The original YOLOv8s model uses CIoU as the loss function, defined as follows:
[0068]
[0069] In the formula: IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box; b and b gt Here, ρ represents the center points of the two boxes; ρ is the Euclidean distance between them; c is the diagonal length of the smallest bounding box containing both the predicted and ground truth boxes; a and v are the differences in aspect ratio. Two cases are considered: 1) the predicted and ground truth boxes are scaled proportionally; 2) v only reflects the difference in aspect ratio, which may optimize similarity in an unreasonable way. Although CIoU loss improves aspect ratio similarity, it hinders the model from reducing the difference between the ground truth and predicted boxes, thus negatively impacting model optimization.
[0070] (2) The improved YOLOv8s network model adopts the Focal-EIoU (Focal Enhanced Intersectionover Union) loss function, which explicitly measures the differences in the three elements of overlapping area, center point, and side length. Its mathematical expression is as follows:
[0071] L EIoU =L IoU +L dis +L asp ,
[0072]
[0073] Among them, L IoU For IoU loss, L dis For the center point distance loss, L asp is the length and width loss; w and h are the width and height of the minimum bounding box that covers both the predicted and ground truth boxes.
[0074] The Focal-EIoU loss function explicitly measures the differences in overlap area, center point, and side length, and combines this with the Focal mechanism to enhance attention to difficult samples, enabling the model to more accurately locate street litter targets. In street litter detection tasks, litter targets are typically of varying sizes and shapes, making localization challenging. The Focal-EIoU loss function effectively addresses this issue, improving localization accuracy and reducing detection errors. Furthermore, the imbalance between positive and negative samples is a significant problem in street litter detection. The Focal-EIoU loss function, by focusing on difficult samples, effectively balances the ratio of positive to negative samples, improving model training and overall detection performance. By weighting samples with lower IoU, the model can better handle complex backgrounds and diverse street litter targets, improving detection accuracy and reliability. The EIoU loss function directly reduces the width and height differences between the predicted and ground truth boxes, increasing the model's convergence speed. Building on this, the Focal-EIoU loss function adjusts the focus on samples of varying difficulty through a factor γ, allowing the model to learn effective features more quickly and accelerating the training process. In practical applications, especially when dealing with large-scale street litter detection tasks, this can significantly shorten the model training time and improve efficiency.
[0075] Experimental Results and Analysis
[0076] 1. Simulation experimental conditions:
[0077] The experiments of this invention were implemented on the Anaconda3 platform. The hardware environment used in the test was an AMD R5-5500 CPU @ 3.60Hz, 32GB RAM, 1TB hard drive, and RTX 3090 GPU; the operating system was Microsoft Windows 10; and the software configuration was Python 3.8, PyTorch 2.0.1, and cudal 1.8. All subsequent training and testing experiments were based on this platform.
[0078] The dataset used in the simulation experiment of this invention is a self-built dataset, obtained through street image data sources obtained from on-site photography and online crawling. This invention uniformly numbers and labels the collected images, categorizing them into six types: garbage bags, foam, bottles, cardboard boxes, and aluminum cans, resulting in labeled image data sources and tags. The labeled image data sources and tags are then augmented to increase the data volume. Data augmentation methods include mirroring and random cropping, resulting in the final street garbage detection dataset, approximately 3000 street garbage scene images.
[0079] 2. Classification accuracy evaluation indicators:
[0080] To evaluate the detection performance of the detection method of the present invention, the present invention uses mean accuracy (mAP) and frames per second (FPS) as evaluation indicators.
[0081] The mean precision (mAP) is the average of the average precision (AP) across all categories in the detection process. Assuming n different confidence thresholds are assigned to Recall, the average precision is the sum of the precision values across these n thresholds. The calculation formula is as follows:
[0082]
[0083] Precision, which measures the probability that the model will successfully predict positive samples, and Recall, which measures the probability that the model will accurately identify all positive samples.
[0084] The number of frames transmitted per second (FPS) indicates that the more frames transmitted per second, the smoother the displayed motion. The calculation formula is as follows:
[0085]
[0086] Where frameNum represents the total number of frames processed, and totalTime represents the total processing time in seconds. A higher FPS value indicates a faster detection speed.
[0087] 3. Simulation Experiment Content and Result Analysis:
[0088] Example 1:
[0089] To verify the detection accuracy of the proposed method, the analysis will focus on the detection results on a self-built dataset. Before the experiment, the self-built street litter detection dataset was divided, and positive and negative pedestrian sample units were trained separately. The labeled dataset was randomly partitioned into training, test, and validation sets in a ratio of 8:1:1 using code. The model used was the original YOLOv8s model and the improved YOLOv8s model. The input image size was set to 640*640, the batch size was set to 16, and the training was conducted for 300 iterations. One iteration means that all images in the training set are propagated forward and backward once in the constructed network. Figure 4 This is the training result of the improved YOLOv8s detection method described in this invention on a self-built dataset.
[0090] Table 1. Detection results for each category before and after the improvement.
[0091]
[0092] Table 1 shows the mAP values of various types of waste on YOLOv8s and the improved YOLOv8s. According to the experimental data, the improved mAP reached 78.9%, which is 4% higher than the original YOLOv8s. The detection accuracy of various types of waste has been improved. For example, the accuracy of cardboard waste reached 88.3%.
[0093] Figure 5 The results of the improved YOLOv8s detection method described in this invention are shown for various categories. Figure 5 (a) shows the original YOLOv8s detection results. Figure 5 (b) shows the detection results of the improved YOLOv8s. Figure 5 It can be seen that, Figure 5 Although garbage was detected in (a), there were cases of missed detection and false detection. Figure 5 (b) The model detected all the garbage data without any false positives, and the confidence level was also improved. This shows that the improved YOLOv8s not only improved accuracy but also had a certain improvement in recall.
[0094] Example 2:
[0095] To further verify the effectiveness of the method proposed in this invention, the performance optimization capabilities of the original algorithm with different module modifications and different module combinations were evaluated. An ablation experiment was designed, and the accuracy of the method proposed in this invention was compared with that of current mainstream detection algorithms.
[0096] Table 2 shows that Improved Algorithm 1 introduces the AIFI module into the original YOLOv8s algorithm, Improved Algorithm 2 uses the proposed C2f-FLA module in this paper, and Improved Algorithm 3 is an improved scheme that uses both Improved Algorithm 1 and Improved Algorithm 2. Experimental data shows that both improved schemes can positively optimize the detection accuracy, with the C2f-FLA module showing a particularly significant effect. Furthermore, due to linear attention, it also slightly improves the detection speed. It can be seen that the combination of the two improved schemes achieves the best optimization of both the model's accuracy and speed. Figure 6 The results of the ablation experiment mAP value comparison for the detection method of the improved YOLOv8s of this invention are shown.
[0097] Table 2 Ablation experiments of key modules of the method proposed in this invention
[0098]
[0099] The YOLOv5, YOLOv7, RT-DETR, original YOLOv8s, and the improved YOLOv8s algorithm proposed in this paper are compared on a street garbage detection dataset. Experimental analysis is conducted using object detection algorithm performance evaluation metrics, and the accuracy comparison results are shown in Table 3.
[0100] Table 3 Comparison of accuracy results between the proposed method and mainstream algorithms
[0101]
[0102] The comparative experimental results demonstrate that the improved YOLOv8s performs exceptionally well in street litter detection, achieving an mAP of 78.9%, significantly outperforming YOLOv5's 72.1%, YOLOv7's 73.8%, and the original YOLOv8s' 74.9%. Furthermore, the improved YOLOv8s achieves 0.8% higher detection accuracy than the Transformer-based RT-DETR, while also boasting a faster detection speed. The improved YOLOv8s demonstrates superior speed compared to all models in the table, reaching 70 FPS, surpassing the original YOLOv8s' 66 FPS, and exceeding YOLOv5's 55 FPS, RT-DETR's 51 FPS, and YOLOv7's 60 FPS. This indicates that the improved YOLOv8s not only significantly improves accuracy but also excels in real-time performance, making it suitable for street litter detection tasks with complex backgrounds and numerous small targets.
Claims
1. A street litter detection method based on an improved YOLOv8s, characterized in that, Includes the following steps: Step 1: Create a street garbage dataset and preprocess the dataset; Step 2: Based on the YOLOv8s model, the C2f-FLA module is formed by integrating the FocusedLinearAttention self-attention mechanism to enhance the model's expressive power, obtain a larger receptive field, and improve the model's ability to extract global contextual information. Step 3: Introduce the AIFI module of RT-DETR into the neck layer of YOLOv8s. The AIFI module enhances the feature representation capability through multi-head self-attention mechanism and feedforward network layer, thereby improving the detection capability of small targets. Step 4: Improve the CIoU loss function used in YOLOv8s to the Focal-EIoU loss function to solve the problem of inaccurate street garbage detection and positioning.
2. The improved YOLOv8s street litter detection method according to claim 1, characterized in that, In step 2, the C2f-FLA module is formed by integrating the FocusedLinearAttention self-attention mechanism as follows: (1) FocusedLinearAttention uses linear attention, which is different from the SoftMax attention of the Transformer model. Linear attention decouples SoftMax into two independent functions, thereby changing the order of attention calculation from (query·key)·value to query·(key·value), which reduces the overall computational complexity to linear. (2) The focusing function in the FocusedLinearAttention self-attention mechanism solves the problem that the linear attention distribution is average, making the output features close to the average of all features and unable to focus on more informative features. The expression of the focusing function is as follows: Where x**p represents raising x to the power of p digits. It can be proven that, under easily satisfyable assumptions, this focusing function can make the inner product of similar vectors larger and the inner product of dissimilar vectors smaller, thus achieving focusing; (3) The FocusedLinearAttention self-attention mechanism addresses the problem that linear attention cannot obtain a full-rank attention matrix. It uses lightweight depthwise separable convolution (DWC) to restore the rank of the attention matrix. The mathematical formula is as follows: In depthwise separable convolution, each query only focuses on a few spatially adjacent features, rather than all values. Therefore, even if two queries in linear attention have similar outputs, the model can still obtain different outputs from the local features proposed by DWC, thus ensuring feature diversity. The role of DWC can also be explained from the perspective of matrix rank, as shown in the following mathematical formula:
3. The improved YOLOv8s street litter detection method according to claim 1, characterized in that, In step 3, the AIFI module is an attention-based internal scale feature interaction learning module, involving a multi-head self-attention mechanism layer and a feedforward network layer: (1) The multi-head self-attention mechanism layer is used to capture global context information in the image and improve the self-attention layer; the multi-head self-attention mechanism layer sets up multiple sets of weight matrices composed of query vector, key vector and value vector, maps the query, key and value through h different linear transformations, then concatenates different attentions, and finally performs a linear transformation. Each set of attention is used to map the input to different sub-representation spaces, which allows the model to focus on different positions in different sub-representation spaces; (2) The feedforward network layer is a fully connected feedforward network, and each position passes through this identical feedforward neural network individually: the feedforward network layer consists of two linear transformations, that is, two fully connected layers, and the activation function of the first fully connected layer is the ReLU activation function.
4. The improved YOLOv8s street litter detection method according to claim 1, characterized in that, In step 4, the CIoU loss function of YOLOv8s is improved to the Focal-EIoU loss function. The improved model uses the Focal-EIoU (Focal Enhanced Intersection over Union) loss function, which explicitly measures the differences in the three elements of overlapping area, center point, and side length. Its mathematical expression is as follows: L EIoU =L IoU +L dis +L asp , Among them, L IoU For IoU loss, L dis For the center point distance loss, L asp is the length and width loss; w and h are the width and height of the minimum bounding box that covers both the predicted and ground truth boxes.
