Road water pit identification method and system, electronic equipment and storage medium

By extracting, encoding, dimensionality reduction and classification of road images, and identifying water pits with SVM classifiers, the problem of low detection efficiency in the existing technology is solved, efficient and accurate water pit recognition is achieved, and safety hazards are reduced.

CN119131732APending Publication Date: 2024-12-13CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411246359.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the prior art, road puddle detection efficiency is low, resulting in certain safety hazards.

Method used

By acquiring road images, feature extraction, encoding, dimensionality reduction and classification are performed, and puddles are identified using SVM classifiers to improve detection efficiency and accuracy.

Benefits of technology

It effectively improves the detection efficiency and accuracy of road puddles and reduces safety hazards caused by pit detection errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131732A_ABST
    Figure CN119131732A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, in particular to a road water pit recognition method and system, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-recognized road image; road water pit identification is carried out on the to-be-identified road image to obtain a water pit identification result, and the road water pit identification comprises the steps of carrying out feature extraction on the to-be-identified road image to obtain multi-dimensional target features; encoding the target features to obtain a target code of each target feature; performing statistics on each target code to obtain chi-square statistics, the chi-square statistics being in one-to-one correspondence with the target codes, and performing dimension reduction on the target codes based on the chi-square statistics to obtain a feature set after dimension reduction, the feature set comprising a plurality of target codes; performing feature classification based on the feature set to obtain a puddle recognition result; according to the method, the detection efficiency of the road puddle can be effectively improved, the accuracy is high, and potential safety hazards caused by puddle detection errors are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a road puddle recognition method, system, electronic equipment and storage medium. Background Art

[0002] There are usually depressions on the road. When there is a lot of rain, the rainwater gathers in the depressions and is likely to form puddles. If a vehicle passes through a puddle quickly, it is likely to cause wear and tear on the vehicle chassis and may also cause tire damage, increasing the risk of traffic accidents.

[0003] At present, manual inspection and maintenance methods are usually used to check and repair the puddles on the road. However, this method has low working efficiency, resulting in many potholes (puddles) not being repaired in time, which poses certain safety hazards. Summary of the invention

[0004] The present invention provides a road puddle recognition method, system, electronic device and storage medium to solve the problem that the efficiency of puddle detection in the prior art is low, resulting in certain safety hazards.

[0005] The present invention provides a method for identifying a road puddle, the method comprising: acquiring a road image to be identified;

[0006] Performing road puddle recognition on the road image to be recognized to obtain a puddle recognition result, wherein the step of performing road puddle recognition includes:

[0007] Extracting features from the road image to be identified to obtain multi-dimensional target features;

[0008] Encoding the target features to obtain a target code for each target feature;

[0009] Counting each of the target codes to obtain a chi-square statistic, wherein the chi-square statistic corresponds to the target code one by one, and based on the chi-square statistic, performing dimension reduction on the target code to obtain a feature set after dimension reduction, wherein the feature set includes a plurality of the target codes;

[0010] Based on the feature set, feature classification is performed to obtain the puddle recognition result.

[0011] In one embodiment of the present invention, the step of extracting features from the road image to be identified to obtain multi-dimensional target features includes:

[0012] Using a preset SVM classifier, feature extraction is performed on the road image to be identified to obtain multi-dimensional target features, wherein the multi-dimensional target features include: road surface state features, pit shape features, road reflection features, road surface material features, pit depth features, reflection source position features, water accumulation area length features, water accumulation area width features, and water accumulation area height features; encoding the target features to obtain a target encoding of each of the target features includes:

[0013] Based on a preset coding rule, the target features are labeled to obtain a coding label value for each target feature, wherein each target feature in the coding rule corresponds to a corresponding coding label value;

[0014] The target encoding of each target feature is obtained by normalizing the encoded label value.

[0015] In one embodiment of the present invention, the step of normalizing the encoding label value to obtain the target encoding of each target feature includes:

[0016] Determine the maximum value among all the coded label values ​​as the first value, and determine the minimum value among all the coded label values ​​as the second value;

[0017] Determine the difference between any of the coded label values ​​and the second value as a first intermediate value, and determine the difference between the first value and the second value as a second intermediate value;

[0018] The ratio between the first intermediate value and the second intermediate value is determined as the target code corresponding to the current code label value, and the code label value corresponds to the target feature.

[0019] In one embodiment of the present invention, based on the chi-square statistic, the target code is reduced in dimension to obtain a feature set after the dimension reduction, comprising:

[0020] Sorting the chi-square statistics of all the target codes in descending order;

[0021] The target number of the target codes is selected, and all the selected target codes are combined into the feature set after dimensionality reduction.

[0022] In one embodiment of the present invention, the step of performing feature classification based on the feature set to obtain the puddle recognition result includes:

[0023] Using a polynomial kernel function in a preset SVM classifier, the target code in the feature set is mapped to a target feature space, wherein the dimension of the target feature space is higher than the original feature space of the target code in the feature set;

[0024] The target features are classified according to the position information of the target features in the target feature space and the hyperplane parameters determined by the SVM classifier during the training process to obtain the puddle recognition result.

[0025] In one embodiment of the present invention, the training process of the SVM classifier includes:

[0026] Acquire a training set, wherein the training set includes a plurality of training samples and true labels corresponding to the training samples;

[0027] Input the training samples into the SVM classifier for feature extraction to obtain multi-dimensional feature samples; encode the feature samples to obtain encoded samples of each feature sample; obtain a chi-square statistic sample of each encoded sample; based on the chi-square statistic sample, reduce the dimension of the encoded sample to obtain a feature set sample after dimension reduction, wherein the feature set sample includes a plurality of the encoded samples;

[0028] Using a preset polynomial kernel function, the coded samples in the feature set samples are mapped to the target feature space; based on the position information of the coded samples in the target feature space and a preset objective function, the hyperplane position is determined, the objective function is to maximize the interval width of the hyperplane, and the interval width refers to the distance between the point closest to the hyperplane and the hyperplane; based on the hyperplane position, a classification result is obtained; based on the classification result and the corresponding true label, the parameters of the SVM classifier are adjusted until convergence.

[0029] In one embodiment of the present invention, after completing the training of the SVM classifier, the method further includes:

[0030] Using a preset test set, the SVM classifier is tested to obtain a plurality of test results, wherein the test results correspond one-to-one to the test samples in the test set;

[0031] Based on the test results, a plurality of evaluation index values ​​are obtained, the plurality of evaluation index values ​​including: accuracy, precision, recall, and F1 score; the evaluation index values ​​are used to provide guidance for parameter correction of the SVM classifier; the step of obtaining the accuracy rate includes: determining the number of positive samples correctly predicted by the SVM classifier as a first number, determining the number of times that negative samples are incorrectly predicted as positive samples as a second number, determining the sum of the first number and the second number as a third intermediate value; and determining the ratio between the first number and the third intermediate value as the accuracy rate;

[0032] The step of obtaining the precision rate includes: determining the number of negative samples correctly predicted by the SVM classifier as a third number, and determining the number of times that positive samples are incorrectly predicted as negative samples as a fourth number; determining the sum of the first number and the third number as a fifth intermediate value; determining the sum of the first number, the second number, the third number, and the fourth number as a sixth intermediate value; and determining the ratio between the fifth intermediate value and the sixth intermediate value as the precision rate.

[0033] The present invention also provides a road puddle recognition system, the system comprising: an image acquisition module, used to acquire a road image to be recognized;

[0034] The puddle recognition module is used to input the road image to be recognized into a preset SVM classifier to perform road puddle recognition to obtain a puddle recognition result, wherein the step of performing road puddle recognition includes:

[0035] Perform feature extraction on the road image to be identified to obtain multi-dimensional target features; encode the target features to obtain a target code for each of the target features; obtain a chi-square statistic for each of the target codes; based on the chi-square statistic, perform dimensionality reduction on the target code to obtain a feature set after dimensionality reduction, wherein the feature set includes a plurality of the target codes; perform SVM classification based on the feature set to obtain the puddle identification result.

[0036] The present invention also provides an electronic device, comprising a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement a road puddle identification method as provided in any one of the above embodiments.

[0037] The present invention further provides a computer-readable storage medium on which a computer program is stored, wherein the computer program is used to enable a computer to execute the road puddle identification method provided in any one of the above embodiments.

[0038] Beneficial effects of the present invention: The present invention proposes a road puddle recognition method, system, electronic device and storage medium. The method acquires a road image to be recognized; recognizes road puddles on the road image to be recognized to obtain a puddle recognition result, wherein the step of recognizing road puddles includes: extracting features from the road image to be recognized to obtain multi-dimensional target features; encoding the target features to obtain a target code for each target feature; counting each target code to obtain a chi-square statistic, the chi-square statistic corresponds to the target code one-to-one, and based on the chi-square statistic, the target code is reduced in dimension to obtain a feature set after the dimension reduction, wherein the feature set includes multiple target codes; based on the feature set, feature classification is performed to obtain a puddle recognition result. The method can effectively improve the detection efficiency of road puddles, with high accuracy, and avoid safety hazards caused by errors in puddle detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of a process flow of a road puddle identification method provided by an embodiment of the present invention;

[0040] Figure 2 A schematic diagram of a hyperplane in a road puddle recognition method provided in an embodiment of the present invention;

[0041] Figure 3 A schematic diagram of the accuracy of different classifiers for the same water puddle training set provided by an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of the accuracy of different classifiers for the same water puddle training set provided by an embodiment of the present invention;

[0043] Figure 5 A schematic diagram of the recall rates of different classifiers for the same water hole training set provided by an embodiment of the present invention;

[0044] Figure 6 A schematic diagram of the F1 scores of different classifiers for the same puddle training set provided by an embodiment of the present invention;

[0045] Figure 7 A schematic diagram of the F1 scores of different kernel functions for the same puddle training set provided by an embodiment of the present invention;

[0046] Figure 8 A schematic diagram of the structure of a road puddle recognition system provided by an embodiment of the present invention;

[0047] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0049] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0050] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0051] In order to facilitate understanding of the road puddle recognition method, system, electronic device and storage medium provided by the present invention, some technical terms involved in the present invention are explained below.

[0052] SVM (Support Vector Machine): A relatively simple supervised machine learning algorithm used for classification and regression. SVM works by finding a hyperplane that creates boundaries between data types. In SVM, we plot each data item in the dataset in N-dimensional space, where N refers to the number of features / attributes in the data. Classification is then done by finding the best hyperplane to separate the data.

[0053] Combine the following Figures 1 to 9 , the road puddle recognition method, system, electronic device and storage medium provided by the present invention are explained.

[0054] See also Figure 1 , Figure 1 A schematic diagram of a process flow of a road puddle identification method provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0055] S110: Acquire a road image to be identified.

[0056] It should be noted that the road image to be identified can be obtained through a camera pre-installed on the road, or can be obtained from the cloud, etc.

[0057] S120: Performing road puddle recognition on the road image to be recognized to obtain a puddle recognition result, wherein the step of performing road puddle recognition includes: performing feature extraction on the road image to be recognized to obtain multi-dimensional target features; encoding the target features to obtain a target code for each of the target features; counting each of the target codes to obtain a chi-square statistic, wherein the chi-square statistic corresponds one-to-one to the target code, and based on the chi-square statistic, performing dimensionality reduction on the target code to obtain a feature set after dimensionality reduction, wherein the feature set includes a plurality of the target codes; performing feature classification based on the feature set to obtain the puddle recognition result.

[0058] Specifically, the road image to be identified is input into a preset SVM classifier to perform road puddle identification to obtain a puddle identification result. It should be noted that by inputting the road image to be identified into a preset SVM classifier to perform road puddle identification, it is possible to automatically identify puddles in the road image to be identified with high accuracy. In the process of puddle identification, by obtaining multi-dimensional target features, it is possible to help improve the accuracy and credibility of subsequent puddle identification. By encoding the target features, it is possible to label and digitize the target features, which is convenient for subsequent processing. By obtaining the chi-square statistic of each of the target codes and reducing the dimension of the target code based on the chi-square statistic, it is possible to effectively reduce the difficulty and complexity of subsequent SVM classification and help improve the accuracy of SVM classification.

[0059] It should also be noted that the calculation of the chi-square statistic in the above embodiment adopts the calculation method in the prior art, which will not be repeated here.

[0060] In some embodiments, the step of extracting features from the road image to be identified to obtain multi-dimensional target features includes:

[0061] The preset SVM classifier is used to extract features of the road image to be identified to obtain multi-dimensional target features. The multi-dimensional target features include: road surface state features, pit shape features, road reflection features, road surface material features, pit depth features, reflection source position features, water accumulation area length features, water accumulation area width features, and water accumulation area height features.

[0062] It should be noted that by obtaining the above-mentioned target features, the comprehensiveness of the dimensions of the target features can be ensured, which helps to improve the accuracy of subsequent SVM classification. It should also be noted that the road state features include: dry, wet, waterlogged, and submerged. The pit shape features include elliptical and rectangular. The road reflection features include: non-reflective and reflective. The road material features include stones, water surfaces, and flat ground. The pit depth features include: flatness and the distance of the water surface from the plane. The number of reflection source position features, the number of waterlogged area length features, the number of waterlogged area width features, and the number of waterlogged area height features all depend on the number of pit depth features.

[0063] In some embodiments, the step of encoding the target features to obtain a target code for each of the target features comprises:

[0064] 1. Based on a preset coding rule, the target features are labeled to obtain a coding label value for each of the target features, and each of the target features in the coding rule corresponds to a corresponding coding label value.

[0065] It should be noted that the encoding rules can be adjusted according to actual needs, etc., and it is only necessary to ensure that each target feature corresponds to a corresponding encoding label value. The above steps achieve format conversion of non-numeric target features by labeling the target features, that is, converting them from non-numeric data to digital data, which is convenient for subsequent data processing.

[0066] The above labeling steps are explained below by taking examples.

[0067] 1) Road surface characteristics

[0068] Assuming that the road surface state characteristics include: dry, wet, waterlogged, and submerged, then based on the coding rules, the coding label value corresponding to dry is 1, the coding label value corresponding to wet is 2, the coding label value corresponding to waterlogged is 3, and the coding label value corresponding to submerged is 4. As shown in Table 1 below:

[0069] Table 1. Labeling of pavement status characteristics

[0070] Road surface characteristics dry Wet Water accumulation Submerged Encoding tag values 1 2 3 4

[0071] 2) Pit shape characteristics

[0072] Assuming that the pit shape features include ellipse and rectangle, based on the coding rules, the coding label value corresponding to the ellipse is 1, and the coding label value corresponding to the rectangle is 2, as shown in Table 2 below:

[0073] Table 2 Pit shape feature labeling

[0074] Pit shape characteristics Oval rectangle Encoding tag values 1 2

[0075] 3) Road reflection characteristics

[0076] Assuming that the road reflection feature includes non-reflection and reflection, based on the coding rule, the coding label value corresponding to non-reflection is 1, and the coding label value corresponding to reflection is 2, as shown in Table 3 below:

[0077] Table 3 Road reflection feature labeling

[0078] Road reflection characteristics No reflection reflection Encoding tag values 1 2

[0079] 4) Pavement material characteristics

[0080] Assuming that the road surface material features include stones, water surface, and flat land, then based on the coding rules, the coding label value corresponding to stones is 1, the coding label value corresponding to water surface is 2, and the coding label value corresponding to flat land is 3, as shown in Table 4 below:

[0081] Table 4 Pavement material feature labeling

[0082] Pavement material characteristics stone water surface Flatland Encoding tag values 1 2 3

[0083] 5) Pit depth characteristics

[0084] Assume that the pit depth feature includes f features, namely flat, depth = u1, ..., depth = un, etc. Then based on the encoding rule, the encoding label value corresponding to flat is 1, the encoding label value corresponding to depth = u1 is 2, ..., and the encoding label value corresponding to depth = un is n+1, as shown in Table 5 below:

[0085] Table 5 Pit depth feature labeling

[0086] Pit depth characteristics smooth depth = u1 ...... Depth = un Encoding tag values 1 2 ...... n+1

[0087] 6) Reflection source position characteristics

[0088] Assume that the reflection source position features include: coordinate j1, coordinate j2, ..., and coordinate jn, etc., and n is a positive integer. Then based on the encoding rule, the encoding label value corresponding to coordinate j1 is 1, the encoding label value corresponding to coordinate j2 is 2, ..., and the encoding label value corresponding to coordinate jn is n, as shown in Table 6 below:

[0089] Table 6 Reflection source position feature labeling

[0090] Reflection source location characteristics Coordinate j1 Coordinate j2 ...... Coordinates Encoding tag values 1 2 ...... n

[0091] 7) Characteristics of length of waterlogged area

[0092] Assume that the length features of the waterlogged area include: length s1, length s2, ..., and length sn, etc. Then based on the encoding rule, the encoding label value corresponding to length s1 is 1, the encoding label value corresponding to length s2 is 2, ..., and the encoding label value corresponding to length sn is n, as shown in Table 7 below:

[0093] Table 7 Labeling of waterlogged area length characteristics

[0094] Length characteristics of waterlogged area Length s1 Length s2 ...... Length sn Encoding tag values 1 2 ...... n

[0095] 8) Characteristics of waterlogged area width

[0096] Assume that the width features of the waterlogged area include: width v1, width v2, ..., and width vn, etc. Then based on the encoding rules, the encoding label value corresponding to width v1 is 1, the encoding label value corresponding to width v2 is 2, ..., and the encoding label value corresponding to width vn is n, as shown in Table 8 below:

[0097] Table 8 Labeling of waterlogged area width features

[0098] Width characteristics of waterlogged area Width v1 Width v2 ...... Width vn Encoding tag values 1 2 ...... n

[0099] 9) Height characteristics of waterlogged areas

[0100] Assume that the height features of the waterlogged area include: height e1, height e2, ..., and height en, etc. Then based on the encoding rules, the encoding label value corresponding to height e1 is 1, the encoding label value corresponding to height e2 is 2, ..., and the encoding label value corresponding to height en is n, as shown in Table 9 below:

[0101] Table 9 Labeling of height characteristics of waterlogged areas

[0102]

[0103]

[0104] It should be noted that the above labeling process is only an example. In actual operation, the encoded label value of each target feature can be adjusted accordingly according to actual needs.

[0105] 2. Normalizing the encoded label values ​​to obtain the target encoding of each target feature.

[0106] It should be noted that after the target features are labeled, the range between the labeled coded label values ​​is large, which can easily affect or dominate the classification results. Therefore, this embodiment normalizes the above-mentioned coded label values ​​so that the labeled coded label values ​​are clustered into the same numerical range, which helps to improve the classification speed and improve the classification accuracy.

[0107] In some embodiments, the step of normalizing the encoded label value to obtain the target encoding of each target feature includes:

[0108] 1. Determine the maximum value among all the coding label values ​​as the first value, and determine the minimum value among all the coding label values ​​as the second value.

[0109] 2. Determine the difference between any of the coded label values ​​and the second value as a first intermediate value, and determine the difference between the first value and the second value as a second intermediate value.

[0110] 3. Determine the ratio between the first intermediate value and the second intermediate value as the target code corresponding to the current code label value, and the code label value corresponds to the target feature.

[0111] It should be noted that the above normalization of the encoding label value to obtain the mathematical expression of the target encoding of each target feature is:

[0112]

[0113] Among them, X' represents the target encoding, x represents the encoding label value, and x max Represents the maximum value of all encoded label values, x min Represents the minimum value of all the coded label values. By executing the above steps, the target code can be scaled to the interval [0, 1], which is convenient for subsequent data processing. The target code of each target feature is exemplified in Table 10 below:

[0114] Table 10 Target encoding of target features

[0115]

[0116] In some embodiments, based on the chi-square statistic, the step of reducing the dimension of the target code to obtain a feature set after the dimension reduction includes:

[0117] 1. Sort the chi-square statistics of all the target codes in descending order.

[0118] 2. Select the target number of the target codes, and combine all the selected target codes into the feature set after dimensionality reduction.

[0119] Specifically, after the chi-square statistics of all target codes are sorted in descending order, the target codes of the number of targets arranged in the front are selected to complete the feature dimensionality reduction. Through the above steps, feature dimensionality reduction can be well achieved and the operation is convenient.

[0120] In some embodiments, based on the feature set, the step of performing feature classification to obtain the puddle recognition result includes:

[0121] 1. Using the polynomial kernel function in the preset SVM classifier, the target code in the feature set is mapped to a target feature space, and the dimension of the target feature space is higher than the original feature space of the target code in the feature set.

[0122] It should be noted that the polynomial kernel function is used to map the target encoding in the feature set to a high-dimensional target feature space, thereby achieving decision-making and classification.

[0123] It should also be noted that the mathematical expression of the polynomial kernel function is:

[0124] K(x,z)=(<x,z> +p) g

[0125] Among them, k(x,z) represents the polynomial kernel function, x represents the target code in the feature set, z represents an arbitrary vector, p represents the preset bias term, and g represents the coefficient of the highest order term, which is usually 3, etc.

[0126] 2. Classify the target features according to the position information of the target features in the target feature space and the hyperplane parameters determined by the SVM classifier during the training process to obtain the puddle recognition result.

[0127] It should be noted that the target features are classified with high accuracy according to the position information of the target features in the target feature space and the hyperplane parameters determined by the SVM classifier during the training process.

[0128] In some embodiments, the training process of the SVM classifier includes:

[0129] 1. Obtain a training set, which includes multiple training samples and true labels corresponding to the training samples. It should be noted that it is possible to obtain multiple training samples of different scenes (such as road images with puddles), which helps to improve the accuracy of SVM classifier training.

[0130] 2. Input the training samples into the SVM classifier for feature extraction to obtain multi-dimensional feature samples; encode the feature samples to obtain a coded sample for each feature sample; obtain a chi-square statistic sample for each coded sample; based on the chi-square statistic sample, reduce the dimension of the coded sample to obtain a feature set sample after dimensionality reduction, wherein the feature set sample includes a plurality of the coded samples. It should be noted that the above steps can help with subsequent puddle identification and detection.

[0131] 3. Use a preset polynomial kernel function to map the coded samples in the feature set samples to the target feature space; determine the hyperplane position based on the position information of the coded samples in the target feature space and the preset objective function, the objective function is to maximize the interval width of the hyperplane, and the interval width refers to the distance between the point closest to the hyperplane and the hyperplane; obtain the classification result based on the hyperplane position; adjust the parameters of the SVM classifier based on the classification result and the corresponding true label until convergence. It should be noted that through the above steps, the training of the SVM classifier can be well completed with high accuracy.

[0132] Figure 2 FIG. 1 is a schematic diagram of a hyperplane in a road puddle recognition method provided in an embodiment of the present invention. Please refer to FIG. Figure 2 , Figure 2 where w is the normal vector of the hyperplane, which is related to the number of features. d ) determines the direction of the hyperplane. The mathematical expression of the hyperplane can be: w·x+b=O. Assume that each coded sample is located on both sides of the hyperplane, and the interval width is greater than 1, that is, each coded sample is located on the side of w*x+b=1 away from w·x+b=O, or w*x+b=-1 away from w·X+b=O. Then, the goal of the training process is to maximize the interval width under the condition of correct classification, so that the interval width 2 / ||w|| is maximized, that is, ||w|| is minimized, which is equivalent to minimizing 1 / 2||w|| 2 , where ||·|| represents the modulus of the orientation vector. Based on this objective function (minimizing 1 / 2||w|| 2 ) and the constraints (the coded sample is located on the side of w*x+b=1 away from w·x+b=0, or on the side of w*x+b=-1 away from w·x+b=0), the Lagrange multiplication method can be used to solve the hyperplane to obtain the classification result. Figure 2 The dots in the figure represent the points where different coded samples are located.

[0133] In some embodiments, a penalty term may be introduced into the objective function to relax the constraint condition. The mathematical expression of the objective function with the penalty term introduced is:

[0134]

[0135] y i (w T φ(x i )+b)≥1-ζ i

[0136] ζ i ≥0, i=1, ..., m

[0137] Among them, C is the regularization parameter, which indicates the penalty intensity, ζ i represents the separation error. The larger the separation error, the greater the penalty value. n represents the number of samples. y i (·) indicates SVM classification, T indicates transposition, φ(x i ) represents high-dimensional mapping of the encoded samples, that is, mapping to the target feature space, b is the displacement, and m is the maximum number of dimensions.

[0138] In order to further improve the classification accuracy of the SVM classifier, in some embodiments, after completing the training of the SVM classifier, the method further includes:

[0139] 1. Using a preset test set, the SVM classifier is tested to obtain a plurality of test results, wherein the test results correspond one-to-one to the test samples in the test set;

[0140] Based on the test results, multiple evaluation index values ​​are obtained, including accuracy, precision, recall, and F1 score. The evaluation index values ​​are used to provide guidance for parameter modification of the SVM classifier.

[0141] It should be noted that, by obtaining multiple evaluation index values ​​based on the test results, the parameters of the SVM classifier can be further adjusted and corrected based on the evaluation index values, thereby improving the accuracy of the SVM classifier.

[0142] It should also be noted that, based on the test results, building a confusion matrix can facilitate the subsequent acquisition of accuracy, precision, recall, and F1 score. The confusion matrix is ​​shown in Table 11 below:

[0143] Table 11 Confusion matrix

[0144]

[0145] In some embodiments, the step of obtaining the accuracy rate includes: determining the number of positive samples correctly predicted by the SVM classifier as a first number, determining the number of times that negative samples are incorrectly predicted as positive samples as a second number, determining the sum of the first number and the second number as a third intermediate value; and determining the ratio between the first number and the third intermediate value as the accuracy rate.

[0146] Specifically, the mathematical expression of the steps to obtain the accuracy is:

[0147]

[0148] Among them, Precision is the accuracy, TP is the first number, and FP is the second number.

[0149] In some embodiments, the step of obtaining the precision rate includes: determining the number of negative samples correctly predicted by the SVM classifier as a third number, and determining the number of times the positive samples are incorrectly predicted as negative samples as a fourth number; determining the sum of the first number and the third number as a fifth intermediate value; determining the sum of the first number, the second number, the third number, and the fourth number as a sixth intermediate value; and determining the ratio between the fifth intermediate value and the sixth intermediate value as the precision rate.

[0150] Specifically, the mathematical expression of the steps to obtain the accuracy is:

[0151]

[0152] Wherein, Accuracy represents accuracy, TN represents the third number, and FN represents the fourth number.

[0153] In some embodiments, the step of obtaining the recall rate includes: determining the sum of the first number and the fourth number as a seventh intermediate value; and determining the ratio between the first number and the seventh intermediate value as the recall rate.

[0154] Specifically, the mathematical expression of the steps to obtain the recall rate is:

[0155]

[0156] Among them, Recall represents the recall rate.

[0157] In some embodiments, the step of obtaining the F1 score includes:

[0158] The product of the accuracy, the recall and the number 2 is determined as the eighth intermediate value; the sum of the accuracy and the recall is determined as the ninth intermediate value; and the ratio between the eighth intermediate value and the ninth intermediate value is determined as the F1 score.

[0159] Specifically, the mathematical expression of the steps to obtain the F1 score is:

[0160]

[0161] Among them, F1-score represents the F1 score.

[0162] It should be mentioned that the higher the precision, the lower the false alarm rate. The higher the recall, the higher the detection rate. The F1 score can reflect the comprehensive ability of the SVM classifier. Therefore, the above embodiment selects the four evaluation indicators of accuracy, precision, recall, and F1 score, which can better improve the classification ability of the SVM model.

[0163] In order to verify the classification effect of the SVM classifier in the above embodiment, the present invention conducts experiments and verifications in combination with several other algorithms (decision tree, random forest, and logistic regression).

[0164] The following is a brief explanation of the principles of the three algorithms: decision tree, random forest, and logistic regression:

[0165] Decision Tree (dt): Make decisions through a tree structure and divide data layer by layer for classification or regression.

[0166] Random Forest (RF): A model that integrates multiple decision trees to improve prediction accuracy and robustness by voting or averaging.

[0167] Logistic Regression (LR): Classification based on the linear combination of features through a logistic function, suitable for binary classification problems.

[0168] Compared with the above three algorithms (decision tree, random forest, and logistic regression), the SVM classifier in the above embodiment has the advantages of higher accuracy, being able to work normally in high-dimensional space, and occupying less memory.

[0169] Figure 3 A schematic diagram of the accuracy of different classifiers for the same water puddle training set provided by an embodiment of the present invention, Figure 4 A schematic diagram of the accuracy of different classifiers for the same water puddle training set provided by an embodiment of the present invention; Figure 5 A schematic diagram of the recall rates of different classifiers for the same water hole training set provided by an embodiment of the present invention; Figure 6 A schematic diagram of the F1 scores of different classifiers for the same puddle training set provided by an embodiment of the present invention. Figures 3 to 6 It can be seen that for the same puddle training set, the SVM classifier (such as Figures 3 to 6The accuracy, precision, recall, and F1 score of the svm in the above algorithm are higher than those of the other three algorithms (dt, rf, and lr). Figures 3 to 6 The Percentage in it represents percentage, auc_train represents accuracy test, and pr_train represents precision test.

[0170] In order to verify the training effect and classification effect of the polynomial kernel function in the above embodiment, the present invention verifies multiple kernel functions (linear kernel function, polynomial kernel function, Gaussian kernel function and sigmoid kernel function). Figure 7 This is a schematic diagram of the F1 scores of different kernel functions for the same water puddle training set provided by an embodiment of the present invention. Figure 7 As shown in the figure, the F1 score corresponding to the polynomial kernel function is higher than that of the other kernel functions, and the effect is the best. Figure 7 The "svc=linear" in it means that the SVC method (support vector classifier) ​​is used to train the linear kernel function, "linear svc" means that the LinearSVC method (a support vector machine specifically used for linear classification) is used to train the linear kernel function, "svc=poly" means that the polynomial kernel function is used for training, "svc=rbf" means that the Gaussian kernel function is used for training, and "svc=sigmoid" means that the sigmoid kernel function is used for training.

[0171] In addition, in order to verify the effect of chi-square dimensionality reduction, the present invention also conducted an experimental comparison between the chi-square dimensionality reduction and PCA (principal component analysis) dimensionality reduction methods. The results showed that the chi-square dimensionality reduction effect was significantly better than that of PCA dimensionality reduction.

[0172] It should be mentioned that the road puddle identification method in the above embodiment can be applied to a variety of application scenarios, such as traffic management (monitoring water accumulation on the road to improve traffic light control, traffic flow analysis and traffic management), intelligent transportation system (providing real-time road water accumulation information to support navigation and traffic monitoring), weather monitoring (detecting and reporting water accumulation on the road to provide early warning and safety information), and urban planning (supporting urban planners to understand the frequency and location of water accumulation in the city to better design and plan drainage systems), etc.

[0173] It is also worth mentioning that the road puddle identification method in the above embodiment can accurately detect and identify the water accumulation on the road, including water depth, area, etc., monitor the water accumulation in real time, provide instant data analysis and visualization, and record historical water accumulation data for analyzing water accumulation patterns and trends. In addition, the road puddle identification method in the above embodiment also supports an alarm function, that is, by setting a water accumulation alarm threshold, when the water accumulation reaches or exceeds the threshold, an alarm is issued to remind relevant departments to take measures.

[0174] Furthermore, the road puddle recognition method in the above embodiment has strong scalability because the SVM classifier in the above embodiment supports high-dimensional data sets, which is convenient for dimensional expansion when data features are added later. At the same time, the dimensionality reduction process is used in the above embodiment, which has a certain optimization effect on the training effect of higher-dimensional data sets. Moreover, the road puddle recognition method in the above embodiment has strong robustness, and the SVM classifier has a certain robustness to noise and outliers in the training data. In road puddle recognition, the image data may be affected by various factors such as illumination, shadow, and occlusion during the image acquisition process, resulting in certain noise. The SVM classifier can ignore these noises to a certain extent, and improve the accuracy and stability of recognition. In addition, the road puddle recognition method in the above embodiment has strong classification ability and high classification timeliness.

[0175] The road puddle recognition system provided by the present invention is described below. The road puddle recognition system described below and the road puddle recognition method described above can be referenced to each other.

[0176] Please refer to Figure 8 , the road puddle recognition system provided in this embodiment includes:

[0177] An image acquisition module 810 is used to acquire a road image to be identified;

[0178] The puddle recognition module 820 is used to perform road puddle recognition on the road image to be recognized to obtain a puddle recognition result, wherein the step of performing road puddle recognition includes:

[0179] Extracting features from the road image to be identified to obtain multi-dimensional target features;

[0180] Encoding the target features to obtain a target code for each target feature;

[0181] Counting each of the target codes to obtain a chi-square statistic, wherein the chi-square statistic corresponds to the target code one by one, and based on the chi-square statistic, performing dimension reduction on the target code to obtain a feature set after dimension reduction, wherein the feature set includes a plurality of the target codes;

[0182] Based on the feature set, feature classification is performed to obtain the puddle recognition result. The image acquisition module 810 is connected to the puddle recognition module 820. The road puddle recognition system in this embodiment can effectively improve the detection efficiency of road puddles, has high accuracy, avoids safety hazards caused by puddle detection errors, and has low cost.

[0183] In some embodiments, the puddle recognition module 1120 is specifically configured to use a preset SVM classifier to perform feature extraction on the road image to be recognized, so as to obtain multi-dimensional target features.

[0184] In some embodiments, the puddle identification module 1120 is further specifically used to label the target features based on a preset coding rule to obtain a coding label value for each target feature, wherein each target feature in the coding rule corresponds to a corresponding coding label value;

[0185] The target encoding of each target feature is obtained by normalizing the encoded label value.

[0186] In some embodiments, the puddle identification module 820 is further specifically configured to determine the maximum value among all the coded tag values ​​as the first value, and determine the minimum value among all the coded tag values ​​as the second value;

[0187] Determine the difference between any of the coded label values ​​and the second value as a first intermediate value, and determine the difference between the first value and the second value as a second intermediate value;

[0188] The ratio between the first intermediate value and the second intermediate value is determined as the target code corresponding to the current code label value, and the code label value corresponds to the target feature.

[0189] In some embodiments, the puddle identification module 820 is specifically used to sort the chi-square statistics of all the target codes in order from large to small;

[0190] The target number of the target codes is selected, and all the selected target codes are combined into the feature set after dimensionality reduction.

[0191] In some embodiments, the puddle identification module 820 is specifically used to map the target code in the feature set to a target feature space using a polynomial kernel function in a preset SVM classifier, wherein the dimension of the target feature space is higher than the original feature space of the target code in the feature set;

[0192] The target features are classified according to the position information of the target features in the target feature space and the hyperplane parameters determined by the SVM classifier during the training process to obtain the puddle recognition result.

[0193] In some embodiments, it also includes an SVM classifier training module for obtaining a training set, wherein the training set includes a plurality of training samples and true labels corresponding to the training samples;

[0194] Input the training samples into the SVM classifier for feature extraction to obtain multi-dimensional feature samples; encode the feature samples to obtain encoded samples of each feature sample; obtain a chi-square statistic sample of each encoded sample; based on the chi-square statistic sample, reduce the dimension of the encoded sample to obtain a feature set sample after dimension reduction, wherein the feature set sample includes a plurality of the encoded samples;

[0195] Using a preset polynomial kernel function, the coded samples in the feature set samples are mapped to the target feature space; based on the position information of the coded samples in the target feature space and a preset objective function, the hyperplane position is determined, the objective function is to maximize the interval width of the hyperplane, and the interval width refers to the distance between the point closest to the hyperplane and the hyperplane; based on the hyperplane position, a classification result is obtained; based on the classification result and the corresponding true label, the parameters of the SVM classifier are adjusted until convergence.

[0196] In some embodiments, the SVM classifier training module is further used to test the SVM classifier using a preset test set to obtain a plurality of test results, wherein the test results correspond one-to-one to the test samples in the test set;

[0197] Based on the test results, multiple evaluation index values ​​are obtained, including accuracy, precision, recall, and F1 score. The evaluation index values ​​are used to provide guidance for parameter modification of the SVM classifier.

[0198] In some embodiments, the SVM classifier training module is specifically used to determine the number of positive samples correctly predicted by the SVM classifier as a first number, the number of times that negative samples are incorrectly predicted as positive samples as a second number, and the sum of the first number and the second number as a third intermediate value; and the ratio between the first number and the third intermediate value is determined as the accuracy rate;

[0199] In some embodiments, the SVM classifier training module is also specifically used to determine the number of negative samples correctly predicted by the SVM classifier as a third number, and the number of times the positive samples are incorrectly predicted as negative samples as a fourth number; determine the sum of the first number and the third number as a fifth intermediate value; determine the sum of the first number, the second number, the third number, and the fourth number as a sixth intermediate value; and determine the ratio between the fifth intermediate value and the sixth intermediate value as the precision rate.

[0200] In some embodiments, an electronic device is also provided, which may be a server, and its internal structure is shown in FIG. Fig. 9 As shown. The electronic device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, the functions or steps on the server side of the above method are implemented.

[0201] In some embodiments, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: acquiring a road image to be identified; performing road puddle identification on the road image to be identified to obtain a puddle identification result, wherein the step of performing road puddle identification comprises: performing feature extraction on the road image to be identified to obtain multi-dimensional target features; encoding the target features to obtain a target code for each target feature; counting each target code to obtain a chi-square statistic, wherein the chi-square statistic corresponds to the target code one-to-one, and based on the chi-square statistic, performing dimensionality reduction on the target code to obtain a feature set after dimensionality reduction, wherein the feature set includes multiple target codes; and performing feature classification based on the feature set to obtain a puddle identification result.

[0202] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program implements the following steps when executed by a processor: acquiring a road image to be identified; performing road puddle identification on the road image to be identified to obtain a puddle identification result, wherein the step of performing road puddle identification includes: performing feature extraction on the road image to be identified to obtain multi-dimensional target features; encoding the target features to obtain a target code for each target feature; counting each target code to obtain a chi-square statistic, the chi-square statistic corresponds to the target code one-to-one, and based on the chi-square statistic, reducing the dimension of the target code to obtain a feature set after the dimension reduction, wherein the feature set includes multiple target codes; based on the feature set, performing feature classification to obtain a puddle identification result.

[0203] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or electronic device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0204] The flow chart and block diagram in the accompanying drawings illustrate the possible implementation architecture, function and operation of the method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0205] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A road puddle identification method, It is characterized in that include: Acquire a road image to be identified; Performing road puddle recognition on the road image to be recognized to obtain a puddle recognition result, wherein the step of performing road puddle recognition includes: Extracting features from the road image to be identified to obtain multi-dimensional target features; Encoding the target features to obtain a target code for each target feature; Counting each of the target codes to obtain a chi-square statistic, wherein the chi-square statistic corresponds to the target code one by one, and based on the chi-square statistic, performing dimension reduction on the target code to obtain a feature set after dimension reduction, wherein the feature set includes a plurality of the target codes; Based on the feature set, feature classification is performed to obtain the puddle recognition result.

2. The method for identifying road puddles according to claim 1, It is characterized in that The step of extracting features from the road image to be identified to obtain multi-dimensional target features includes: Using a preset SVM classifier, feature extraction is performed on the road image to be identified to obtain multi-dimensional target features, wherein the multi-dimensional target features include: road surface state features, pit shape features, road reflection features, road surface material features, pit depth features, reflection source position features, water accumulation area length features, water accumulation area width features, and water accumulation area height features; encoding the target features to obtain a target encoding of each of the target features includes: Based on a preset coding rule, the target features are labeled to obtain a coding label value for each target feature, wherein each target feature in the coding rule corresponds to a corresponding coding label value; The target encoding of each target feature is obtained by normalizing the encoded label value.

3. The road puddle identification method according to claim 2, It is characterized in that The step of normalizing the encoded label value to obtain the target encoding of each target feature includes: Determine the maximum value among all the coded label values ​​as the first value, and determine the minimum value among all the coded label values ​​as the second value; Determine the difference between any of the coded label values ​​and the second value as a first intermediate value, and determine the difference between the first value and the second value as a second intermediate value; The ratio between the first intermediate value and the second intermediate value is determined as the target code corresponding to the current code label value, and the code label value corresponds to the target feature.

4. The road puddle identification method according to claim 1, It is characterized in that Based on the chi-square statistic, the target code is reduced in dimension to obtain a feature set after the dimension reduction, comprising: Sorting the chi-square statistics of all the target codes in descending order; The target number of the target codes is selected, and all the selected target codes are combined into the feature set after dimensionality reduction.

5. The road puddle identification method according to claim 1, It is characterized in that Based on the feature set, the step of performing feature classification to obtain the puddle recognition result includes: Using a polynomial kernel function in a preset SVM classifier, the target code in the feature set is mapped to a target feature space, wherein the dimension of the target feature space is higher than the original feature space of the target code in the feature set; The target features are classified according to the position information of the target features in the target feature space and the hyperplane parameters determined by the SVM classifier during the training process to obtain the puddle recognition result.

6. The road puddle identification method according to claim 5, It is characterized in that The training process of the SVM classifier includes: Acquire a training set, wherein the training set includes a plurality of training samples and true labels corresponding to the training samples; Input the training samples into the SVM classifier for feature extraction to obtain multi-dimensional feature samples; encode the feature samples to obtain encoded samples of each feature sample; obtain a chi-square statistic sample of each encoded sample; based on the chi-square statistic sample, reduce the dimension of the encoded sample to obtain a feature set sample after dimension reduction, wherein the feature set sample includes a plurality of the encoded samples; Using a preset polynomial kernel function, the coded samples in the feature set samples are mapped to the target feature space; based on the position information of the coded samples in the target feature space and a preset objective function, the hyperplane position is determined, the objective function is to maximize the interval width of the hyperplane, and the interval width refers to the distance between the point closest to the hyperplane and the hyperplane; based on the hyperplane position, a classification result is obtained; based on the classification result and the corresponding true label, the parameters of the SVM classifier are adjusted until convergence.

7. The road puddle identification method according to claim 6, It is characterized in that After completing the training of the SVM classifier, the method further includes: Using a preset test set, the SVM classifier is tested to obtain a plurality of test results, wherein the test results correspond one-to-one to the test samples in the test set; Based on the test results, a plurality of evaluation index values ​​are obtained, the plurality of evaluation index values ​​including: accuracy, precision, recall, and F1 score; the evaluation index values ​​are used to provide guidance for parameter correction of the SVM classifier; the step of obtaining the accuracy rate includes: determining the number of positive samples correctly predicted by the SVM classifier as a first number, determining the number of times that negative samples are incorrectly predicted as positive samples as a second number, determining the sum of the first number and the second number as a third intermediate value; and determining the ratio between the first number and the third intermediate value as the accuracy rate; The step of obtaining the precision rate includes: determining the number of negative samples correctly predicted by the SVM classifier as a third number, and determining the number of times that positive samples are incorrectly predicted as negative samples as a fourth number; determining the sum of the first number and the third number as a fifth intermediate value; determining the sum of the first number, the second number, the third number, and the fourth number as a sixth intermediate value; and determining the ratio between the fifth intermediate value and the sixth intermediate value as the precision rate.

8. A road puddle recognition system, It is characterized in that include: An image acquisition module, used to acquire a road image to be identified; The puddle recognition module is used to perform road puddle recognition on the road image to be recognized to obtain a puddle recognition result, wherein the step of performing road puddle recognition includes: Extracting features from the road image to be identified to obtain multi-dimensional target features; Encoding the target features to obtain a target code for each target feature; Counting each of the target codes to obtain a chi-square statistic, wherein the chi-square statistic corresponds to the target code one by one, and based on the chi-square statistic, performing dimension reduction on the target code to obtain a feature set after dimension reduction, wherein the feature set includes a plurality of the target codes; Based on the feature set, feature classification is performed to obtain the puddle recognition result.

9. An electronic device, It is characterized in that The invention comprises a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the road puddle identification method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that A computer program is stored thereon, and the computer program is used to enable a computer to execute the road puddle identification method as claimed in any one of claims 1 to 7.

Citation Information

Cited By

  • Road environment monitoring terminal based on Internet of Things

    CN120126328A