A method for detecting and identifying road spilled objects based on optimized intersection-and-union ratio function

Through the neural network model based on the optimized intersection ratio function, combined with atrous convolution and feature pyramid network, the problem of low accuracy and poor real-time performance of road litter detection in the existing technology is solved, and the detection of small-sized targets in complex environments is achieved. High-precision detection and mask segmentation, with high recognition accuracy and fast detection speed.

CN112232240BActive Publication Date: 2024-08-27NANJING NORMAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011129588.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-21
Publication Date
2024-08-27
Estimated Expiration
2040-10-21

AI Technical Summary

Technical Problem

The existing road litter detection and identification methods are based on traditional image processing algorithms, which have problems such as low recognition accuracy, poor real-time performance, poor recognition of small-sized targets, and poor scalability. It is difficult to effectively detect and identify objects in complex road traffic environments. Identify.

Method used

Using a neural network model based on the optimized intersection ratio function, the video is collected through surveillance cameras, and a road debris detection and recognition model based on dilated convolution and feature pyramid networks is constructed, combined with spatial attention guidance and adaptive interest area allocation mechanism. Achieve high-precision detection and mask segmentation of small-sized targets.

Benefits of technology

It achieves high-precision detection and identification of small-sized targets in complex road traffic environments. It has real-time operation capabilities and can output category information, location information and shape characteristics of road litter. It has high identification accuracy, fast detection speed and strong reliability. Scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112232240B
    Figure CN112232240B
Patent Text Reader

Abstract

The present invention discloses a method for detecting and identifying road spilled objects based on an optimized intersection-and-union function, comprising the following steps: building a road spilled object detection and identification model based on an optimized intersection-and-union function; collecting road traffic monitoring videos and performing frame processing to generate a road spilled object data set, annotating training set images, and generating a label file; inputting all training set images and label files into the road spilled object detection and identification model for training to obtain a trained model; inputting test set images into the trained road spilled object detection and identification model for detection and identification, and outputting detection and identification results for road spilled objects. The present invention can detect and identify road spilled objects under a complex road traffic background, can output location information, category information, and approximate shape features of road spilled objects, has a good detection and identification effect for small targets, and has a fast detection speed and high identification accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of deep learning and computer vision, and in particular to a method for detecting and identifying road spilled objects based on an optimized intersection-over-union function. Background Art

[0002] With the rapid development of artificial intelligence technology, technologies in the fields of deep learning and computer vision are increasingly being applied to modern urban management. As a common event in road traffic, road spillage incidents carry certain risks and can lead to traffic accidents in serious cases. Common road spillages such as stones, fallen waste cartons, slag and gravel, and waste spillage cloths are not easily discovered by vehicle drivers. Most of them are small in size and difficult to detect and eliminate in time. At the same time, the road traffic environment is relatively complex, which also increases the difficulty of detecting spillages. At present, instance segmentation technology in computer vision has been widely used in autonomous driving, medical image processing, satellite images and other fields. Therefore, it is envisioned that instance segmentation can also be applied to urban road traffic incident detection.

[0003] my country started research on road traffic incident detection relatively late, and existing methods for detecting and identifying road spills are mostly based on traditional image processing algorithms, including inter-frame difference method, optical flow method, feature extraction method, etc. These methods all have inevitable defects, such as low recognition accuracy, poor real-time performance, poor recognition of small-sized targets, and poor scalability.

[0004] Therefore, a new technical solution is needed to solve these problems. Summary of the invention

[0005] Purpose of the invention: In order to overcome the deficiencies in the prior art, a method for detecting and identifying road spilled objects based on an optimized intersection-and-union ratio function is provided. The method uses a surveillance camera to collect videos containing road traffic spilled objects, and obtains a road spilled object detection and identification model based on the optimized intersection-and-union ratio function by training a neural network model. The method has low cost and is simple to implement. At the same time, the method of the invention has good effect on the detection and identification of small-sized targets and can achieve real-time operation. It can perform mask segmentation of road spilled objects based on the detection and identification of road spilled objects, and can output category information, location information and approximate shape features of road spilled objects. It has the characteristics of high recognition accuracy, strong scalability, and strong resistance to interference from complex road traffic environments.

[0006] Technical solution: To achieve the above purpose, the present invention provides a method for detecting and identifying road spilled objects based on an optimized intersection-and-union ratio function, comprising the following steps:

[0007] S1: Build a road spill detection and recognition model based on optimized intersection-and-joint ratio function;

[0008] S2: Collect road traffic monitoring videos and perform frame processing to generate a road spilled object dataset, divide the images in the road spilled object dataset into test set images and training set images in proportion, annotate the training set images, and generate a label file in json format;

[0009] S3: input all the images and label files of the training set into the road spilled object detection and recognition model of step S1 for training to obtain a trained model;

[0010] S4: Input the test set images obtained by frame processing of the road traffic monitoring video into the trained road spilled object detection and recognition model for detection and recognition, and output the detection and recognition results of the road spilled objects.

[0011] Furthermore, the method for building a road spilled object detection and recognition model based on optimizing the intersection-and-joint ratio function in step S1 includes the following steps:

[0012] A1: Construct a backbone neural network based on dilated convolution optimization. The backbone neural network obtains the feature map of the input image by convolving the image in the input training set. The extracted feature map is used as the input for subsequent processing.

[0013] A2: Construct a multi-scale processing module and use the feature pyramid network FPN for multi-scale processing. In the scenario of road spilled object detection and recognition, the use of FPN can give full play to its multi-scale recognition advantages and alleviate ambiguity to a great extent.

[0014] A3: Construct an object detection and recognition algorithm based on the optimized intersection-over-union function. The object detection and recognition algorithm detects and recognizes objects on feature maps that have been processed at multiple scales to obtain bounding box information and object category information.

[0015] A4: Construct mask segmentation branch: Use the spatial attention guided mask to generate the spatial attention feature descriptor, use the spatial attention guided features to strengthen the original input features and generate a mask for each target.

[0016] Furthermore, the target detection and recognition algorithm based on optimizing the intersection-over-union function in step A3 is composed of three branches: classification, bounding box prediction and centerness.

[0017] Furthermore, the step A1 is specifically as follows: the backbone neural network uses the residual network ResNet50, and the residual convolution network effectively avoids the gradient vanishing problem in the ordinary neural network convolution process that the initialization parameters tend to 0 as the number of layers increases, by introducing residual blocks, thereby achieving improved model accuracy.

[0018] The input data of the residual block is directly mapped through a shortcut connection. At the same time, the input data is convolved and activated through a linear correction unit ReLU to output the residual part. ResNet50 includes a 7x7x64 input convolution and 16 residual blocks. Finally, there is a full convolution layer for classification output. Each residual block contains 3 convolution layers. The convolution is optimized by the dilated convolution method. The convolution kernel expansion rate is set to 3. Finally, 5 feature maps C at different stages are output. 1 , C 2 , C 3 , C 4 , C 5 .

[0019] Furthermore, the step A2 is specifically as follows: using the feature pyramid network FPN to perform multi-scale processing, and convolving the feature map C obtained by the backbone neural network 3 , C 4 , C 5 Perform 1×1 convolution to get F 3 、F 4 、F 5 , and F 5 、F 6 Perform convolution again with a step size of 2 to get F 6 、F 7 , output the feature map F of 5 stages 3 、F 4 、F 5 、F 6 、F 7 .

[0020] Furthermore, the step A3 specifically includes the following steps:

[0021] B1: Order is the feature map of the i-th layer after the backbone neural network and multi-scale processing, where H and W represent the height and width of the feature map respectively, and Q represents the number of categories of all targets to be detected; through 4 groups of convolution operations, each of which includes 3×3 convolution with a step size of 1, group normalization Group Normalization and linear rectification unit ReLU, the feature map is regressed to a bounding box and optimized using the optimized intersection-over-union function DIoU to generate a bounding box regression loss function;

[0022] B2: Classify the feature map through 4 groups of 3×3 convolutions with a step size of 1 to generate a classification loss function; at the same time, suppress low-quality detection bounding boxes through the centerness branch;

[0023] B3: The target recognition algorithm outputs the target loss function and ensures the detection accuracy of the target detector for small-scale targets through an adaptive region of interest (RoI) allocation mechanism.

[0024] Furthermore, the DIoU function in step B1 is used to calculate the bounding box regression loss function. The DIoU function takes both the overlap rate and the scale into account, making the target box regression more stable, less prone to divergence and other problems, and higher detection accuracy. The calculation process of the bounding box regression loss function is:

[0025]

[0026]

[0027] In the formula, B represents the prediction box, B gt represents the real detection box, b, b gt Represent the center points of the predicted box and the real box respectively, ρ represents the Euclidean distance between the two center points, and l represents the diagonal distance of the minimum closure area that contains both the predicted detection box and the real detection box;

[0028] For the feature map F i Each position (x, y) on the image can correspond to a coordinate on the original image. If the position (x, y) falls within any real detection frame, it is considered a positive sample, otherwise it is a negative sample. In addition to classifying positive and negative samples, a 4-dimensional vector s can also be obtained. * =(l * ,t * ,r * ,b * ), this vector represents the offset vector used for regression at position (x, y). * ,t * ,r * ,b * Respectively represent the horizontal distance from the point at this position to the left, top, right, and bottom sides of the bounding box.

[0029] The definition of centrality in step B2 is as follows:

[0030]

[0031] Among them, min(l * ,r * ) means taking l * ,r * The minimum value in * ,r * ) means taking l * ,r * The maximum value in min(t* ,b * ) means taking t * ,b * The minimum value in the * ,b * ) means taking t * ,b * The maximum value in , the centrality is trained using binary cross entropy, and the value of the centrality ranges from 0 to 1. The centrality can reduce the weight of the bounding box far away from the center of the target, thereby significantly improving the detection performance.

[0032] Furthermore, the target loss function L({q x,y},{s x,y}) is shown below:

[0033]

[0034] In the formula, q x,y Represents the classification label predicted by the position (x, y), represents the true category of the location (x, y), s x,y Indicates the bounding box coordinates of the position (x, y). Represents the offset vector of the position (x, y) in the regression, N pos represents the number of positive samples, L cls represents the classification loss function, using focal loss, L reg represents the bounding box regression loss function, λ is set to 1 to balance the two types of losses, and I represents the indicator function;

[0035]

[0036] Formula (5) represents an adaptive RoI allocation mechanism, where K represents the mapping relationship of the region of interest, k max Indicates the corresponding FPN level. In this study, FPN is divided into five levels, so k max =5, A input Represents the area of ​​the input image data, A RoI Represents the area of ​​the region of interest.

[0037] Furthermore, the construction process of the mask segmentation branch in step A4 is as follows:

[0038] C1: The feature map predicted by the adaptive RoI region allocation mechanism is fed into four 3×3 convolutional transformation layers and the spatial attention module for processing in sequence to obtain the spatial attention feature descriptor. The calculation process is as follows:

[0039]

[0040] The feature map of the target detection input mask branch is defined as X i , for the input feature map The feature f obtained after maximum pooling and average pooling max , After concatenation, the network is fed into a 3×3 convolutional layer and normalized using the sigmoid function. sag (X i ) represents the output spatial attention feature descriptor, C 3×3 Indicates a 3×3 convolution, symbol Indicates connection aggregation, σ indicates sigmoid function;

[0041] C2: Generate a spatial attention guided feature map using the spatial attention feature descriptor obtained in C1, upsample it using a 2×2 convolution, and predict the mask of a specific class through a 1×1 convolution layer;

[0042]

[0043] Spatial attention guided feature map X sag The formula is shown above, where Indicates the corresponding product calculation of the elements; the main purpose is to strengthen the original input features by guiding the features through spatial attention.

[0044] C3: Calculate the loss function of the road spill detection and recognition model:

[0045] L=L cls +L center +L reg +L mask (16)

[0046] Where L represents the overall loss function of the road spill detection and recognition model, L cls represents the classification loss, L center represents the center loss, L reg represents the bounding box regression loss, L mask Represents the mask loss, which is calculated using binary cross entropy.

[0047] Furthermore, the step S2 specifically includes the following steps:

[0048] D1: Collect and save road traffic surveillance videos containing road spillage events;

[0049] D2: Perform frame division operation on the stored road traffic monitoring video, set to extract a frame of image to be processed every 5 seconds, and output the image for storage;

[0050] D3: All stored images are annotated using image annotation software, divided into 80% and 20% parts, and stored as training set and test set respectively. All images in the training set are then input into the model for training.

[0051] The step S4 specifically includes the following steps:

[0052] E1: Input the test set images obtained by frame processing of road traffic surveillance video into the trained road traffic spilled object recognition model for target recognition;

[0053] E2: The optimized recognition algorithm in the road spill detection and recognition model based on the optimized intersection-over-union function predicts the bounding box of all points in the target object box;

[0054] E3: Use the non-maximum fast suppression algorithm to filter low-quality bounding boxes, and finally generate the target bounding box and classification information, which are further input into the mask segmentation branch to generate a mask.

[0055] Furthermore, the detection and recognition result of the road spilled objects in step S4 includes the target frame position, category information and segmentation mask.

[0056] Beneficial effects: Compared with the prior art, the present invention has the following advantages:

[0057] 1. The present invention uses surveillance cameras to collect videos containing road traffic spillage events, and obtains a road spillage detection and recognition model based on an optimized intersection-and-union ratio function through neural network model training. The recognition process can be completed through existing surveillance videos of various road sections, with low cost and simple implementation.

[0058] 2. The present invention has a good effect in detecting and identifying small-sized targets. It can not only achieve the effect of real-time operation, but also has high recognition accuracy and small error.

[0059] 3. The present invention can perform mask segmentation of road spilled objects based on the detection and identification of road spilled objects, and can output the category information and location information of road spilled objects. It has the advantages of high recognition accuracy, fast detection speed, strong scalability, and strong resistance to interference from complex road traffic environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 It is a flowchart of the method of the present invention;

[0061] Figure 2 It is a structural diagram of a road spilled object detection and recognition model based on an optimized intersection-and-union ratio function in the present invention;

[0062] Figure 3 It is a structural diagram of the backbone neural network ResNet50 used in the present invention;

[0063] Figure 4 This is a comparison chart between conventional convolution and dilated convolution;

[0064] Figure 5 This is the principle diagram of the distance intersection over union (DIoU) function;

[0065] Figure 6 It is the time graph for identifying all targets in a single image of road spills;

[0066] Figure 7 It is the recognition effect diagram of the method of the present invention. DETAILED DESCRIPTION

[0067] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0068] like Figure 1 As shown, the present invention provides a method for detecting and identifying road spilled objects based on an optimized intersection-and-joint ratio function, such as Figure 1 and Figure 2 As shown, the following steps are included:

[0069] S1: Build a road spill detection and recognition model based on optimized intersection-and-joint ratio function;

[0070] S2: Collect road traffic monitoring videos and perform frame processing to generate a road spilled object dataset, divide the images in the road spilled object dataset into test set images and training set images in proportion, annotate the training set images, and generate a label file in json format;

[0071] S3: input all the images and label files of the training set into the road spilled object detection and recognition model of step S1 for training to obtain a trained model;

[0072] S4: Input the test set images obtained by frame processing of the road traffic monitoring video into the trained road spilled object detection and recognition model for detection and recognition, and output the target frame position, category information and segmentation mask of the road spilled objects.

[0073] The specific process of step S1 in this embodiment is as follows:

[0074] A1: Construct a backbone neural network based on dilated convolution optimization. The backbone neural network obtains the feature map of the input image by convolving the image in the input training set. The extracted feature map is used as the input for subsequent processing.

[0075] A2: Construct a multi-scale processing module and use the feature pyramid network FPN for multi-scale processing. In the scenario of road spill detection and recognition, the use of FPN can give full play to its advantages of multi-scale recognition and alleviate ambiguity to a great extent.

[0076] A3: Construct an object detection and recognition algorithm based on the optimized intersection-over-union function. The algorithm consists of three branches: classification, bounding box prediction, and centerness. The object detection and recognition algorithm detects and recognizes objects on feature maps that have been processed at multiple scales to obtain bounding box information and object category information.

[0077] A4: Construct mask segmentation branch: Use the spatial attention guided mask to generate the spatial attention feature descriptor, use the spatial attention guided features to strengthen the original input features and generate a mask for each target.

[0078] The specific process of step A1 in this embodiment is as follows:

[0079] The backbone neural network uses the residual network ResNet50. The residual convolution network in this embodiment effectively avoids the gradient vanishing problem in the ordinary neural network convolution process, in which the initialization parameters tend to 0 as the number of layers increases, by introducing residual blocks, thereby improving the model accuracy.

[0080] The input data of the residual block is directly mapped through a shortcut connection. At the same time, the input data is convolved and activated through a linear rectified unit ReLU to output the residual part.

[0081] like Figure 3 As shown, the residual network ResNet50 in this embodiment includes 1 7x7x64 input convolution and 16 residual blocks (including convolution residual block Conv Block and residual block ID Block that does not change the dimension. In the figure, Batch Norm represents batch normalization operation, Max Pool represents maximum pooling operation, and Avg Pool represents average pooling operation). Each residual block contains 3 convolution layers, and finally there is a full convolution layer FC for classification output. In this embodiment, the convolution is optimized by the method of dilated convolution. The general convolution and dilated convolution principle diagram are as follows: Figure 4 As shown in Figure 2, the convolution kernel expansion rate is set to 3, and the final output is the feature map C of 5 different stages. 1 , C 2 , C 3 , C 4 , C 5 .

[0082] The specific process of step A2 in this embodiment is as follows:

[0083] The feature pyramid network FPN is used for multi-scale processing, and the feature map C obtained after convolution of the backbone neural network is 3 , C 4 , C 5 Perform 1×1 convolution to get F 3 、F 4 、F 5 , and F 5 、F 6 Perform convolution again with a step size of 2 to get F 6 、F 7 , output the feature map F of 5 stages 3 、F 4 、F 5 、F 6 、F 7 .

[0084] The specific process of step A3 in this embodiment is as follows:

[0085] B1: Order is the feature map of the i-th layer after the backbone neural network and multi-scale processing, where H and W represent the height and width of the feature map respectively, and Q represents the number of categories of all targets to be detected; through 4 groups of convolution operations, each of which includes 3×3 convolution with a step size of 1, group normalization Group Normalization and linear rectification unit ReLU, the feature map is regressed to a bounding box and optimized using the optimized intersection-over-union function DIoU to generate a bounding box regression loss function;

[0086] It should be noted here that the schematic diagram of the DIoU function is as follows Figure 5 As shown, specifically:

[0087] The DIoU function is used to calculate the bounding box regression loss function. The DIoU function takes both the overlap rate and the scale into account, making the target box regression more stable, less prone to divergence and other problems, and higher detection accuracy. The calculation process is as follows:

[0088]

[0089]

[0090] In the formula, B represents the prediction box, B gt represents the real detection box, b, b gt Represent the center points of the predicted box and the real box respectively, ρ represents the Euclidean distance between the two center points, and l represents the diagonal distance of the minimum closure area that contains both the predicted detection box and the real detection box. Figure 3 The d shown here represents the Euclidean distance between the two center points, d = ρ2 (b,b gt ).

[0091] For the feature map F i Each position (x, y) on the image can correspond to a coordinate on the original image. If the position (x, y) falls within any real detection frame, it is considered a positive sample, otherwise it is a negative sample. In addition to classifying positive and negative samples, a 4-dimensional vector s can also be obtained. * =(l * ,t * ,r * ,b * ), this vector represents the offset vector used for regression at position (x, y). * ,t * ,r * ,b * Respectively represent the horizontal distance from the point at this position to the left, top, right, and bottom sides of the bounding box.

[0092] B2: Classify the feature map through 4 groups of 3×3 convolutions with a step size of 1 to generate a classification loss function; at the same time, suppress low-quality detection bounding boxes through the centerness branch;

[0093] The definition of centrality is as follows:

[0094]

[0095] Among them, min(l * ,r * ) means taking l * ,r * The minimum value in * ,r * ) means taking l * ,r * The maximum value in min(t * ,b * ) means taking t * ,b * The minimum value in the * ,b * ) means taking t * ,b * The maximum value in , the centrality is trained using binary cross entropy, and the value of the centrality ranges from 0 to 1. The centrality can reduce the weight of the bounding box far away from the center of the target, thereby significantly improving the detection performance.

[0096] B3: The target recognition algorithm outputs the target loss function and ensures the detection accuracy of the target detector for small-scale targets through an adaptive region of interest (RoI) allocation mechanism.

[0097] The output objective loss function L({q x,y},{s x,y}) is shown below:

[0098]

[0099] In the formula, q x,y Represents the classification label predicted by the position (x, y), represents the true category of the location (x, y), s x,y Indicates the bounding box coordinates of the position (x, y). Represents the offset vector of the position (x, y) in the regression, N pos represents the number of positive samples, L cls represents the classification loss function, using focal loss, L reg represents the bounding box regression loss function, λ is set to 1 to balance the two types of losses, and I represents the indicator function;

[0100]

[0101] Formula (5) represents an adaptive RoI allocation mechanism, where K represents the mapping relationship of the region of interest, k max Indicates the corresponding FPN level. In this study, FPN is divided into five levels, so k max =5, A input Represents the area of ​​the input image data, A RoI Represents the area of ​​the region of interest.

[0102] The specific process of step A4 in this embodiment is as follows:

[0103] C1: The feature map predicted by the adaptive RoI region allocation mechanism is fed into four 3×3 convolutional transformation layers and the spatial attention module for processing in sequence to obtain the spatial attention feature descriptor. The calculation process is as follows:

[0104]

[0105] The feature map of the target detection input mask branch is defined as X i , for the input feature map The feature f obtained after maximum pooling and average pooling max , After concatenation, the network is fed into a 3×3 convolutional layer and normalized using the sigmoid function. sag (X i ) represents the output spatial attention feature descriptor, C 3×3Indicates a 3×3 convolution, symbol Indicates connection aggregation, σ indicates sigmoid function;

[0106] C2: Generate a spatial attention guided feature map using the spatial attention feature descriptor obtained in C1, upsample it using a 2×2 convolution, and predict the mask of a specific class through a 1×1 convolution layer;

[0107]

[0108] Spatial attention guided feature map X sag The formula is shown above, where It indicates that the corresponding product calculation is performed on the elements. The main purpose is to strengthen the original input features by guiding the features through spatial attention.

[0109] C3: Calculate the loss function of the road spill detection and recognition model:

[0110] L=L cls +L center +L reg +L mask (twenty four)

[0111] Where L represents the overall loss function of the road spill detection and recognition model, L cls represents the classification loss, L center represents the center loss, L reg represents the bounding box regression loss, L mask Represents the mask loss, which is calculated using binary cross entropy.

[0112] The specific process of step S2 in this embodiment is as follows:

[0113] D1: Collect and save road traffic surveillance videos containing road spillage incidents within a certain period of time;

[0114] D2: Perform frame division operation on the stored road traffic monitoring video, set to extract a frame of image to be processed every 5 seconds, and output the image for storage;

[0115] D3: All stored images are annotated using image annotation software, divided into 80% and 20% parts, and stored as training set and test set respectively. All images in the training set are then input into the model for training.

[0116] The specific process of step S4 in this embodiment is as follows:

[0117] E1: Input the test set images obtained by frame processing of road traffic surveillance video into the trained road traffic spilled object recognition model for target recognition;

[0118] E2: The optimized recognition algorithm in the road spill detection and recognition model based on the optimized intersection-over-union function predicts the bounding box of all points in the target object box;

[0119] E3: Use the non-maximum fast suppression algorithm to filter low-quality bounding boxes, and finally generate the target bounding box and classification information, which are further input into the mask segmentation branch to generate a mask.

[0120] In this embodiment, the above method is used to identify and segment all the scattered objects in a single image. Figure 6 As shown, the specific time is 0.26s, which shows that the method of the present invention has an excellent detection and recognition speed.

[0121] In order to verify the actual effect of the method of the present invention, the method of the present invention is applied to a real scene, and the road scattered objects recognition and segmentation effect is as follows: Figure 7 As shown, Figure 7 There are four renderings, a, b, c and d, and the corresponding scattered objects are rubble, waste cardboard boxes, waste scattering cloth and stones. It can be seen that Figures a, b, c and d can clearly and efficiently identify and segment the rubble, waste cardboard boxes, waste scattering cloth and stones on the road, verifying the actual effect of the method of the present invention.

Claims

1. A method for detecting and identifying road spilled objects based on an optimized intersection-and-union ratio function, characterized in that: The steps include: S1: Build a road spill detection and recognition model based on optimized intersection-and-joint ratio function; S2: Collect road traffic monitoring videos and perform frame processing to generate a road spilled object dataset, divide the images in the road spilled object dataset into test set images and training set images in proportion, annotate the training set images, and generate a label file; S3: input all the images and label files of the training set into the road spilled object detection and recognition model of step S1 for training to obtain a trained model; S4: Input the test set images obtained by frame processing of the road traffic monitoring video into the trained road spilled object detection and recognition model for detection and recognition, and output the detection and recognition results of the road spilled objects; The method for building a road spilled object detection and recognition model based on optimizing the intersection-and-joint ratio function in step S1 comprises the following steps: A1: Construct a backbone neural network based on dilated convolution optimization. The backbone neural network obtains the feature map of the input image by convolving the image in the input training set. The extracted feature map is used as the input for subsequent processing. A2: Construct a multi-scale processing module and use the feature pyramid network FPN for multi-scale processing; A3: Construct an object detection and recognition algorithm based on the optimized intersection-over-union function. The object detection and recognition algorithm detects and recognizes objects on feature maps that have been processed at multiple scales to obtain bounding box information and object category information. A4: Construct mask segmentation branch: Use the spatial attention guided mask to generate the spatial attention feature descriptor, use the spatial attention guided feature to strengthen the original input feature and generate a mask for each target; The target detection and recognition algorithm based on optimizing the intersection-over-union function in step A3 is composed of three branches: classification, bounding box prediction and centerness; The step A1 is specifically as follows: the backbone neural network uses the residual network ResNet50, the residual convolution network introduces a residual block, the input data of the residual block is directly mapped through a skip connection shortcut connection, and the input data is convolved and activated through a linear correction unit ReLU, and the residual part is output. ResNet50 includes a 7x7x64 input convolution and 16 residual blocks, and finally there is a full convolution layer for classification output, wherein each residual block contains 3 convolution layers, and the convolution is optimized by the dilated convolution method, and the convolution kernel expansion rate is set to 3, and finally 5 feature maps C1, C2, C3, C4, and C5 at different stages are output; The step A2 specifically includes: using a feature pyramid network FPN to perform multi-scale processing, performing 1×1 convolution on the feature maps C3, C4, and C5 obtained after convolution of the backbone neural network to obtain F3, F4, and F5, and performing convolution on F5 and F6 again with a step size of 2 to obtain F6 and F7, and outputting the feature maps F3, F4, F5, F6, and F7 of 5 stages; The step A3 specifically includes the following steps: B1: Order is the feature map of the i-th layer after the backbone neural network and multi-scale processing, where H and W represent the height and width of the feature map respectively, and Q represents the number of categories of all targets to be detected; through 4 groups of convolution operations, each of which includes 3×3 convolution with a step size of 1, group normalization Group Normalization and linear rectification unit ReLU, the feature map is regressed to a bounding box and optimized using the optimized intersection-over-union function DIoU to generate a bounding box regression loss function; B2: Classify the feature map through 4 groups of 3×3 convolutions with a step size of 1 to generate a classification loss function; at the same time, suppress low-quality detection bounding boxes through the centerness branch; B3: The target recognition algorithm outputs the target loss function and uses an adaptive region of interest (ROI) allocation mechanism to ensure the detection accuracy of the target detector for small-scale targets. The calculation process of the bounding box regression loss function in step B1 is: In the formula, B represents the prediction box, B gt represents the real detection box, b, b gt Represent the center points of the predicted box and the real box respectively, ρ represents the Euclidean distance between the two center points, and l represents the diagonal distance of the minimum closure area that contains both the predicted detection box and the real detection box; The definition of centrality in step B2 is as follows: Among them, min(l * ,r * ) means taking l * ,r * The minimum value in the * ,r * ) means taking l * ,r * The maximum value in min(t * ,b * ) means taking t * ,b * The minimum value in the * ,b * ) means taking t * ,b * The maximum value in the centrality is trained using binary cross entropy, and the centrality value ranges from 0 to 1; The target loss function L({q x,y },{s x,y }) is shown below: In the formula, q x,y Represents the classification label predicted by the position (x, y), represents the true category of the location (x, y), s x,y Indicates the bounding box coordinates of the position (x, y). Represents the offset vector of the position (x, y) in the regression, N pos represents the number of positive samples, L cls represents the classification loss function, using focal loss, L reg represents the bounding box regression loss function, λ is set to 1 to balance the two types of losses, and Ι represents the indicator function; Formula (5) represents an adaptive RoI allocation mechanism, where K represents the mapping relationship of the region of interest, k max Indicates the corresponding FPN level, A input Represents the area of ​​the input image data, A RoI represents the area of ​​the region of interest; The construction process of the mask segmentation branch in step A4 is as follows: C1: The feature map predicted by the adaptive RoI region allocation mechanism is fed into four 3×3 convolutional transformation layers and the spatial attention module for processing in sequence to obtain the spatial attention feature descriptor. The calculation process is as follows: The feature map of the target detection input mask branch is defined as X i , for the input feature map Features obtained after maximum pooling and average pooling After concatenation, the network is fed into a 3×3 convolutional layer and normalized using the sigmoid function. sag (X i ) represents the output spatial attention feature descriptor, C 3×3 Indicates a 3×3 convolution, symbol Indicates connection aggregation, σ indicates sigmoid function; C2: Generate a spatial attention guided feature map using the spatial attention feature descriptor obtained in C1, upsample it using a 2×2 convolution, and predict the mask of a specific class through a 1×1 convolution layer; Spatial attention guided feature map X sag The formula is shown above, where Indicates the corresponding product calculation of elements; C3: Calculate the loss function of the road spill detection and recognition model: L=L cls +L center +L reg +L mask (8) Where L represents the overall loss function of the road spill detection and recognition model, L cls represents the classification loss, L center represents the center loss, L reg represents the bounding box regression loss, L mask Represents the mask loss, which is calculated using binary cross entropy.

2. The method for detecting and identifying road spilled objects based on optimizing the intersection-and-union ratio function according to claim 1, characterized in that: The step S2 specifically includes the following steps: D1: Collect and save road traffic surveillance videos containing road spillage events; D2: Perform frame division operation on the stored road traffic monitoring video and output the image for storage; D3: All stored images are annotated using image annotation software, divided according to the ratio, and stored as training sets and test sets respectively. All images in the training set are then input into the model for training; The step S4 specifically includes the following steps: E1: Input the test set images obtained by frame processing of road traffic surveillance video into the trained road traffic spilled object recognition model for target recognition; E2: The optimized recognition algorithm in the road spill detection and recognition model based on the optimized intersection-over-union function predicts the bounding box of all points in the target object box; E3: Use the non-maximum fast suppression algorithm to filter low-quality bounding boxes, and finally generate the target bounding box and classification information, which are further input into the mask segmentation branch to generate a mask.