A method for identifying damaged landmark lines
Through the combination of fixed angle shooting and Vision Transformer model, the misidentification problem caused by landmark line deformation is solved, and the accurate identification and judgment of landmark line damage is achieved.
Patent Information
- Application Number
- CN202510506427.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-04-22
AI Technical Summary
In the prior art, the deformation of the landmark image cannot be effectively handled during the identification of landmark lines, resulting in misidentification problems.
Landmark lines are photographed using fixed angles, landmark line damage recognition model is constructed through the Vision Transformer model, the initial contour of landmark lines is extracted and corrected, the plane rectangular coordinate system is established, horizontal and vertical corrections are performed, the actual contour of landmark lines is obtained, and the model is used for damage recognition.
It improves the accuracy of landmark damage recognition, reduces the misidentification of deformed landmarks, and provides accurate damage judgment support.
Smart Images

Figure CN120014586B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and particularly to a method for identifying damaged landmark lines. Background Art
[0002] Landmark lines refer to visual guiding markings laid along roads, which are used to guide the driving direction of drivers and provide important signs for traffic safety; landmark lines include solid lines, dotted lines, double solid lines, double dotted lines, etc., and each type of marking has its unique meaning.
[0003] In the prior art, when identifying damaged landmark lines, a camera device is usually used to collect landmark line data, and then the collected pictures are analyzed. However, due to different shooting angles, the same type of landmark line may present different forms during collection, resulting in misjudgment of the same type of landmark line. For example, in the application document with the publication number CN111985436A, a method for identifying and fitting workshop landmark lines based on LSD is disclosed. This solution uses the LSD detection results as the original data set for line fitting, and uses the MLP algorithm to determine the target color landmark lines. The coordinate points of the landmark lines that meet the conditions are extracted, and the outlier removal operation of the data set is performed. Finally, the least squares method is combined to perform line fitting on the original data set of a single picture; this method does not perform reduction processing on the deformation of the landmark line caused by shooting, so there may be a problem of misidentifying the deformed landmark line. Summary of the Invention
[0004] The present invention aims to solve at least one of the technical problems in the prior art. By collecting and analyzing landmark lines at a fixed angle, the actual contour of the landmark line is obtained. Based on the Vision Transformer model, a landmark line damage recognition model is constructed, and the landmark line damage recognition model is used to classify and identify the actual contour of the landmark line to obtain the damage result of the landmark line, so as to solve the problem in the prior art that when identifying damaged landmark lines, the deformation of the landmark line image is not analyzed, resulting in misidentification of the deformed landmark line.
[0005] To achieve the above object, in the first aspect, the present application provides a method for identifying damaged landmark lines, including the following steps:
[0006] Using an image acquisition device to obtain landmark line data and preprocessing the landmark line data to obtain training data;
[0007] Based on the Vision Transformer model framework, a landmark line damage recognition model is constructed, and the landmark line damage recognition model is used to process the training data to obtain a damage judgment criterion;
[0008] Obtain a detection image, preprocess the detection image, and then use a landmark line damage recognition model to process the detection image to obtain a detection result;
[0009] The step of using an image acquisition device to obtain landmark line data and preprocess the landmark line data to obtain training data includes the following sub-steps:
[0010] Use an image acquisition device to take a fixed-angle photo of the ground with landmark lines, and set the taken image as landmark line data;
[0011] Extract the landmark lines from the landmark line data to obtain the initial contour of the landmark lines;
[0012] Correct the initial contour of the landmark lines to obtain the actual contour of the landmark lines;
[0013] Mark the actual contour of the landmark lines, mark the damage positions of the actual contour of the damaged landmark lines to obtain damage cases, mark the actual contour of the undamaged landmark lines as complete cases, and set the damage cases and complete cases as training data.
[0014] Further, the step of extracting the landmark lines from the landmark line data to obtain the initial contour of the landmark lines includes the following sub-steps:
[0015] Perform grayscale processing on the landmark line data to obtain grayscale data of the landmark lines;
[0016] Perform binarization processing on the grayscale data of the landmark lines to obtain binarized data of the landmark lines; the binarization processing includes obtaining the grayscale values of all pixel points in the grayscale data of the landmark lines to establish a grayscale histogram, obtaining the average value of two peaks in the grayscale histogram, setting it as the binarization threshold, assigning the grayscale value of the pixel points in the grayscale data of the landmark lines with a grayscale value less than the binarization threshold to 0, and assigning the grayscale value of the pixel points in the grayscale data of the landmark lines with a grayscale value greater than the binarization threshold to 255;
[0017] Set the boundary line between the pixel points with a grayscale value of 0 and the pixel points with a grayscale value of 255 in the binarized data of the landmark lines as the initial contour of the landmark lines.
[0018] Further, the step of correcting the initial contour of the landmark lines to obtain the actual contour of the landmark lines includes the following sub-steps:
[0019] Obtain multiple closed figures from the initial contour of the landmark lines and set them as independent landmark blocks;
[0020] For any independent landmark block, obtain the midpoints of the two longitudinal edges of the independent landmark block, connect the midpoints of the two longitudinal edges to obtain a line segment and set it as the longitudinal correction line segment; obtain the midpoints of the two transverse edges of the independent landmark block, connect the midpoints of the two transverse edges to obtain a straight line and set it as the transverse correction line.
[0021] Obtain the longitudinal correction line segments of all independent landmark blocks, determine whether there are parallel longitudinal correction line segments. When there are parallel longitudinal correction line segments, collectively refer to the parallel longitudinal correction line segments as a parallel group, set the group with the most longitudinal correction line segments as the longitudinal correction group, and set any longitudinal correction line segment within the longitudinal correction group as the longitudinal correction standard.
[0022] When there are no parallel longitudinal correction line segments, obtain the connection line between the leftmost midpoint and the rightmost midpoint of the initial contour of the landmark line and set it as the longitudinal correction standard.
[0023] Obtain the intersection points of the transverse correction lines of all independent landmark blocks. When there is only one intersection point, set the intersection point as the vanishing point. When there are more than one intersection points, obtain the intersection point passing through the most transverse correction lines and set it as the vanishing point.
[0024] Taking the vanishing point as the coordinate origin, establish a plane rectangular coordinate system, where the horizontal axis of the coordinate system is parallel to the longitudinal correction standard and the vertical axis is perpendicular to the longitudinal correction standard to obtain the correction coordinate system.
[0025] Perform horizontal axis correction on all independent landmark blocks in the correction coordinate system to obtain the horizontally corrected image.
[0026] Perform vertical axis correction on the horizontally corrected image to obtain the actual contour of the landmark line.
[0027] Further, the horizontal axis correction includes:
[0028] For any independent landmark block in the correction coordinate system, set it as the target independent plot, obtain the correction rectangle of the target independent landmark block, where the midpoint of the bottom of the correction rectangle coincides with the midpoint of the lower transverse edge of the independent target plot; any two sides of the correction rectangle are parallel to the vertical axis and the other two sides are parallel to the horizontal axis; the width of the correction rectangle is the width of the bottom edge of the target independent plot and the length is the height of the target independent plot.
[0029] Obtain the leftmost point and the rightmost point of the target independent landmark block, set the connection line between the coordinate origin and the leftmost point as the left correction line, and set the connection line between the coordinate origin and the rightmost point as the right correction line.
[0030] For any coordinate point on the target independent landmark block, set it as the target coordinate point. Draw a line parallel to the horizontal axis through the target coordinate point, and set it as the target line. Set the intersections of the target line with the left calibration line and the right calibration line as point A and point B respectively. Set the ratio of the distance from point A to the target coordinate point to the distance from point A to point B as the calibration standard;
[0031] Set the two intersections of the target line with the calibration rectangle as point C and point D respectively. Set the distance between point C and point D as the horizontal distance, and set the product of the horizontal distance and the calibration standard as the calibration distance;
[0032] Set the point on the line connecting point C and point D that is at a distance of the calibration distance from point C as the horizontal axis calibration coordinate point of the target coordinate point;
[0033] Connect the horizontal axis calibration coordinate points of all coordinate points to obtain a closed figure, and set this closed figure as the horizontal axis calibration block;
[0034] Obtain the horizontal axis calibration blocks of all independent landmark blocks to get the horizontal axis calibration image.
[0035] Furthermore, the vertical axis calibration includes:
[0036] Set the horizontal axis calibration block containing the point with the minimum ordinate as the standard calibration block. Set the midpoint of the horizontal contour with the smaller ordinate among the midpoints of the two horizontal contours of the standard calibration block as the bottom point. Obtain the distance of the line connecting the coordinate origin and the bottom point, and set it as the standard distance;
[0037] For any horizontal axis calibration block in the horizontal axis calibration image, set it as the target calibration block. Obtain the distance of the line connecting the coordinate origin and the bottom point of the target calibration block, and set it as the target perspective distance;
[0038] Set the ratio of the target perspective distance to the standard distance as the calibration ratio;
[0039] For any coordinate point on the target calibration block, set the product of the ordinate of this coordinate point and the calibration ratio as the calibrated ordinate;
[0040] Modify the ordinates of all coordinate points on the target calibration block to the calibrated ordinates to obtain the vertical axis calibration landmark block;
[0041] Obtain the vertical axis calibration landmark blocks of all horizontal axis calibration blocks to get the actual contour of the landmark line.
[0042] Furthermore, constructing the landmark line damage recognition model based on the Vision Transformer model framework and using the landmark line damage recognition model to process the training data to obtain the damage judgment standard includes the following sub-steps:
[0043] Build a landmark line damage recognition model. The input end of the landmark line damage recognition model has three neurons, which are used to input a complete case, a damaged case, and a case to be analyzed. The output end has multiple neurons, which are used to output the comparison results obtained through analysis.
[0044] The landmark line damage recognition model is used to process the complete case and the case to be analyzed received by the three neurons at the input end using the Vision Transformer model to obtain comparison results. Among them, the case to be analyzed is the case obtained after preprocessing the detection image.
[0045] Further, the steps of obtaining the detection image, preprocessing the detection image, and then using the landmark line damage recognition model to process the detection image to obtain the detection result include the following sub-steps:
[0046] Obtain the detection image, and obtain the case to be analyzed after preprocessing the detection image.
[0047] Input the case to be analyzed and the training data into the landmark line damage recognition model, and output to obtain the comparison result. The comparison result is the result in the training data that is most similar to the analyzed case.
[0048] When the comparison result is a complete case, it is determined that the detection image has no damage.
[0049] When the comparison result is a damaged case, it is determined that the detection image has damage, and at the same time, the location of the damage mark is obtained from the comparison result and marked on the detection image.
[0050] In a second aspect, the present application provides an electronic device, including a processor and a memory. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the above method are run.
[0051] In a third aspect, the present application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method are run.
[0052] The beneficial effects of the present invention: The present invention first collects landmark line data by photographing the landmark line at a fixed angle, and then extracts the contour of the landmark line data to obtain the initial contour of the landmark line. By collecting the landmark line data at a fixed angle, the obtained landmark line data has unity in deformation. When correcting the landmark line data subsequently, a unified scale correction can be used, reducing the computational amount for correcting the landmark line.
[0053] The present invention also performs horizontal correction and vertical correction on the initial contour of the landmark line to obtain the actual contour of the landmark line. Through horizontal correction, the deformation of the initial contour of the landmark line in the horizontal direction can be restored, and through vertical correction, the deformation of the initial contour of the landmark line in the vertical direction can be restored. The actual contour of the landmark line obtained by correcting the initial contour of the landmark line can completely display the actual state of the landmark line, providing accurate data support for subsequent model processing and improving the referenceability of the analysis results. Description of the Drawings
[0054] Figure 1 It is a flowchart of the steps of the method of the present invention;
[0055] Figure 2 It is a schematic diagram of the correction coordinate system of the present invention;
[0056] Figure 3 It is a schematic diagram of the horizontal axis correction of the present invention;
[0057] Figure 4 It is a schematic diagram of the vertical axis correction of the present invention;
[0058] Figure 5 It is a schematic diagram of the structure of the electronic device of the present invention. Detailed Embodiments
[0059] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0060] Embodiment 1, please refer to Figure 1 As shown, the present application provides a method for identifying damaged landmark lines, including the following steps:
[0061] S1: Use an image acquisition device to obtain landmark line data and preprocess the landmark line data to obtain training data; Step S1 includes the following sub-steps:
[0062] S101: Use an image acquisition device to take a picture of the ground with a landmark line at a fixed angle, and set the taken image as the landmark line data; In the specific implementation process, the size of the fixed angle is set manually. For example, the size of the fixed angle in this embodiment is 30 degrees;
[0063] S102: Extract the landmark line from the landmark line data to obtain the initial contour of the landmark line; Step S102 includes the following sub-steps:
[0064] S10201: Grayscale the landmark line data to obtain the grayscaled data of the landmark line;
[0065] S10202: Perform binarization on the grayscaled data of the landmark line to obtain the binarized data of the landmark line; The binarization process includes obtaining the gray values of all pixel points in the grayscaled data of the landmark line to establish a gray histogram, obtaining the average value of the two peaks in the gray histogram, setting it as the binarization threshold, assigning the gray value of the pixel points whose gray value is less than the binarization threshold in the grayscaled data of the landmark line to 0, and assigning the gray value of the pixel points whose gray value is greater than the binarization threshold in the grayscaled data of the landmark line to 255; In the specific implementation process, the gray difference between the landmark line and the ground is often large and it is the main body in the grayscaled data. Therefore, the two peaks in the gray histogram represent the landmark line and the ground background. Setting the average value of the two peaks in the gray histogram as the binarization threshold can accurately distinguish the landmark line area and the ground area;
[0066] S10203: Set the boundary line between the pixel points with gray value 0 and the pixel points with gray value 255 in the binarized data of the landmark line as the initial contour of the landmark line.
[0067] S103: Correct the initial contour of the landmark line to obtain the actual contour of the landmark line;
[0068] Please refer to Figure 2 As shown, step S103 includes the following sub-steps:
[0069] S10301: Obtain multiple closed figures from the initial contour of the landmark line and set them as independent landmark blocks;
[0070] S10302: For any one independent landmark block, obtain the midpoints of the two longitudinal edges of the independent landmark block, connect the midpoints of the two longitudinal edges to obtain a line segment and set it as the longitudinal correction line segment; obtain the midpoints of the two transverse edges of the independent landmark block, connect the midpoints of the two transverse edges to obtain a straight line and set it as the transverse correction line; In the specific implementation process, the midpoint of the edge is the midpoint of the line segment of the independent landmark block in the vertical direction. When there are multiple non-parallel line segments in the vertical contour of the independent landmark block, take the midpoint of the connection line between the uppermost end and the lowermost end of the longitudinal edge of the independent landmark block and set it as the midpoint of the edge;
[0071] S10303: Obtain the longitudinal correction line segments of all independent landmark blocks, and determine whether there are parallel longitudinal correction line segments. When there are parallel longitudinal correction line segments, collectively refer to the parallel longitudinal correction line segments as a parallel group. Set the parallel group with the most longitudinal correction line segments as the longitudinal correction group, and set any one longitudinal correction line segment within the longitudinal correction group as the longitudinal correction standard. In the specific implementation process, the initial contour of the landmark line may not be parallel to the image edge, resulting in inconsistent subsequent coordinate system establishment. Since the line segment relationship between landmark lines is usually parallel or perpendicular, the establishment direction of the coordinate system can be determined through the longitudinal correction line segments.
[0072] S10304: When there are no parallel longitudinal correction line segments, obtain the connection line between the leftmost midpoint and the rightmost midpoint of the initial contour of the landmark line as the longitudinal correction standard. In the specific implementation process, when there is excessive damage to the landmark line, the initial contour of the landmark line will present multiple irregular figures, and it is difficult to distinguish the perspective relationship between the initial contours of multiple landmark blocks. Therefore, the connection line between the leftmost midpoint and the rightmost midpoint of the initial contour of the overall landmark line is selected as the longitudinal correction standard.
[0073] S10305: Obtain the intersection points of the horizontal correction lines of all independent landmark blocks. When there is only one intersection point, set this intersection point as the vanishing point. When there are more than one intersection point, obtain the intersection point passing through the most horizontal correction lines and set it as the vanishing point. In the specific implementation process, since there is a unified perspective relationship between each independent landmark block in the initial contour of the landmark line, the vanishing point of the initial contour of the landmark line can be obtained by obtaining the intersection points of the perspective directions of each independent landmark block. When there is a large amount of damage to some independent landmark blocks, it will lead to difficult discrimination of the perspective relationship and different intersection points. Therefore, the intersection point passing through the most horizontal correction lines is used as the vanishing point.
[0074] S10306: Establish a plane rectangular coordinate system with the vanishing point as the coordinate origin, where the horizontal axis of the coordinate system is parallel to the longitudinal correction standard and the vertical axis is perpendicular to the longitudinal correction standard, to obtain the corrected coordinate system.
[0075] S10307: Perform horizontal axis correction on all independent landmark blocks in the corrected coordinate system to obtain the horizontally corrected image.
[0076] Please refer to Figure 3As shown in the figure, the horizontal axis correction includes: for any independent landmark block in the correction coordinate system, set it as the target independent plot, obtain the correction rectangle of the target independent landmark block, and make the midpoint of the bottom of the correction rectangle coincide with the midpoint of the horizontal edge below the target independent plot; any two sides of the correction rectangle are parallel to the vertical axis and the other two sides are parallel to the horizontal axis; the width of the correction rectangle is the width of the bottom edge of the target independent plot, and the length is the height of the target independent plot;
[0077] Obtain the leftmost point and the rightmost point of the target independent landmark block, set the line connecting the coordinate origin and the leftmost point as the left correction line, and set the line connecting the coordinate origin and the rightmost point as the right correction line;
[0078] For any coordinate point on the target independent landmark block, set it as the target coordinate point, draw a line parallel to the horizontal axis through the target coordinate point, set it as the target line, set the intersections of the target line and the left correction line and the right correction line as point A and point B respectively, and set the ratio of the distance from point A to the target coordinate point to the distance from point A to point B as the correction standard;
[0079] Set the two intersections of the target line and the correction rectangle as point C and point D respectively, set the distance between point C and point D as the horizontal distance, and set the product of the horizontal distance and the correction standard as the correction distance;
[0080] Set the point on the line connecting point C and point D that is at a distance of the correction distance from point C as the horizontal axis correction coordinate point of the target coordinate point; in the specific implementation process, for example, in a horizontal axis correction process, for the target coordinate point (-8, -6), the obtained correction standard for the target coordinate point (-8, -6) is 0.6, the horizontal distance is 4, then the correction distance is 2.4, and the abscissa of point C is -5, so the coordinates of the horizontal axis correction coordinate point of the target coordinate point are obtained as (-2.6, -6);
[0081] Connect the horizontal axis correction coordinate points of all coordinate points to obtain a closed figure, and set this closed figure as the horizontal axis correction block;
[0082] Obtain the horizontal axis correction blocks of all independent landmark blocks to obtain the horizontal axis correction image.
[0083] S10308: Perform vertical axis correction on the horizontal axis correction image to obtain the actual contour of the landmark line;
[0084] Please refer to Figure 4 As shown in the figure, the vertical axis correction includes: set the horizontal axis correction block containing the point with the smallest ordinate as the standard correction block, set the midpoint of the horizontal contour with the smaller ordinate among the midpoints of the two horizontal contours of the standard correction block as the bottom point, obtain the distance between the coordinate origin and the bottom point, and set it as the standard distance;
[0085] For any horizontal-axis corrected block in the horizontally corrected image, set it as the target correction block, obtain the distance between the coordinate origin and the bottom point of the target correction block, and set it as the target perspective distance;
[0086] Set the ratio of the target perspective distance to the standard distance as the correction ratio;
[0087] For any coordinate point on the target correction block, set the product of the ordinate of the coordinate point and the correction ratio as the corrected ordinate; In the specific implementation process, for example, in a vertical-axis correction process, the obtained correction ratio is 3. For any coordinate point (6, -9) on the target correction block, the corrected ordinate obtained after correcting the ordinate of the coordinate point is -27;
[0088] Modify the ordinates of all coordinate points on the target correction block to the corrected ordinates to obtain the vertically corrected landmark block;
[0089] Obtain the vertically corrected landmark blocks of all horizontal-axis corrected blocks to obtain the actual outline of the landmark line.
[0090] S104: Mark the actual outline of the landmark line, mark the damaged positions of the actual outline of the damaged landmark line to obtain damaged cases, mark the actual outline of the undamaged landmark line as complete cases, and set the damaged cases and complete cases as training data;
[0091] S2: Build a landmark line damage recognition model based on the Vision Transformer model framework, and use the landmark line damage recognition model to process the training data to obtain the damage judgment standard; Step S2 includes the following sub-steps:
[0092] S201: Establish a landmark line damage recognition model. Among them, the input end of the landmark line damage recognition model is three neurons, which are used to input complete cases, damaged cases, and cases to be analyzed; the output end is multiple neurons, which are used to output the comparison results obtained by analysis;
[0093] S202: The landmark line damage recognition model is used to process the complete cases and cases to be analyzed received by the three neurons at the input end using the Vision Transformer model to obtain comparison results. Among them, the case to be analyzed is the case obtained after preprocessing the detection image;
[0094] S3: Obtain the detection image, preprocess the detection image, and then use the landmark line damage recognition model to process the detection image to obtain the detection result.
[0095] Step S3 includes the following sub-steps:
[0096] S301: Obtain a detection image, and preprocess the detection image to obtain a case to be analyzed;
[0097] S302: Input the case to be analyzed and training data into the landmark line damage recognition model, and output a comparison result, which is the result in the training data that is most similar to the analysis case;
[0098] S303: When the comparison result is a complete case, determine that there is no damage to the detection image;
[0099] S304: When the comparison result is a damaged case, determine that there is damage to the detection image, and at the same time obtain the positioning of the damage mark from the comparison result and mark it on the detection image.
[0100] Embodiment 2, please refer to Figure 5 as shown in Figure 5 illustrates a schematic structural diagram of an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in a method for identifying damaged landmark lines are run to implement the following functions: obtaining landmark line data by using an image acquisition device and preprocessing the landmark line data to obtain training data; constructing a landmark line damage recognition model based on the Vision Transformer model framework, and using the landmark line damage recognition model to process the training data to obtain a damage judgment criterion; obtaining a detection image, preprocessing the detection image, and then using the landmark line damage recognition model to process the detection image to obtain a detection result.
[0101] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of software functional units and sold or used as an independent product. When stored in a computer-readable storage medium, based on such an understanding, the technical solution of this application essentially or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc that can store program codes.
[0102] Embodiment 4. The present application further provides a computer program product. The computer program product includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a landmark line damage recognition method provided by each of the above methods. The method includes: obtaining landmark line data by using an image acquisition device and preprocessing the landmark line data to obtain training data; constructing a landmark line damage recognition model based on the Vision Transformer model framework, and using the landmark line damage recognition model to process the training data to obtain a damage judgment criterion; obtaining a detection image, preprocessing the detection image, and then using the landmark line damage recognition model to process the detection image to obtain a detection result.
[0103] Embodiment 5. The present application further provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in a landmark line damage recognition method as described above are run to achieve the following functions: obtaining landmark line data by using an image acquisition device and preprocessing the landmark line data to obtain training data; constructing a landmark line damage recognition model based on the Vision Transformer model framework, and using the landmark line damage recognition model to process the training data to obtain a damage judgment criterion; obtaining a detection image, preprocessing the detection image, and then using the landmark line damage recognition model to process the detection image to obtain a detection result.
[0104] Through the description of the above embodiments, the embodiments of the present invention can be provided as a method, a system or a computer program product. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0105] In the embodiments provided by the present application, it should be understood that the disclosed system or method can be implemented in other ways. The above-described embodiments are merely illustrative. For example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some communication interfaces. The indirect coupling or communication connection of systems, modules and units can be in an electrical, mechanical or other form.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for identifying damaged landmark lines, characterized in that, It includes the following steps: Use an image acquisition device to obtain landmark line data and preprocess the landmark line data to obtain training data; Based on the Vision Transformer model framework, construct a landmark line damage recognition model, and use the landmark line damage recognition model to process the training data to obtain a damage judgment criterion; Obtain a detection image, preprocess the detection image, and then use the landmark line damage recognition model to process the detection image to obtain a detection result; Using an image acquisition device to obtain landmark line data and preprocess the landmark line data to obtain training data includes the following sub-steps: Use an image acquisition device to take a fixed-angle photo of the ground with a landmark line, and set the taken image as the landmark line data; Extract the landmark line from the landmark line data to obtain the initial contour of the landmark line; Correct the initial contour of the landmark line to obtain the actual contour of the landmark line; Mark the actual contour of the landmark line, mark the damage positions of the actual contours of the damaged landmark lines to obtain damage cases, mark the actual contours of the undamaged landmark lines as complete cases, and set the damage cases and complete cases as training data; The step of correcting the initial contour of the landmark line to obtain the actual contour of the landmark line includes the following sub-steps: Obtain multiple closed figures from the initial contour of the landmark line and set them as independent landmark blocks; For any one independent landmark block, obtain the midpoints of the two longitudinal edges of the independent landmark block, connect the midpoints of the two longitudinal edges to obtain a line segment and set it as the longitudinal correction line segment; obtain the midpoints of the two transverse edges of the independent landmark block, connect the midpoints of the two transverse edges to obtain a straight line and set it as the transverse correction line; Obtain the longitudinal correction line segments of all independent landmark blocks, and judge whether there are parallel longitudinal correction line segments. When there are parallel longitudinal correction line segments, collectively refer to the parallel longitudinal correction line segments as a parallel group, set the group with the most longitudinal correction line segments as the longitudinal correction group, and set any one longitudinal correction line segment in the longitudinal correction group as the longitudinal correction standard; When there are no parallel longitudinal correction line segments, obtain the connection line between the leftmost midpoint and the rightmost midpoint of the initial contour of the landmark line and set it as the longitudinal correction standard; Obtain the intersection points of the transverse correction lines of all independent landmark blocks. When there is only one intersection point, set the intersection point as the vanishing point. When there are more than one intersection points, obtain the intersection point passing through the most transverse correction lines and set it as the vanishing point; Take the vanishing point as the coordinate origin to establish a plane rectangular coordinate system, where the horizontal axis of the coordinate system is parallel to the longitudinal correction standard and the vertical axis is perpendicular to the longitudinal correction standard to obtain a correction coordinate system; Perform horizontal axis correction on all independent landmark blocks in the correction coordinate system to obtain a horizontally corrected image; Perform vertical axis correction on the horizontally corrected image to obtain the actual contour of the landmark line.
2. The method for identifying damaged landmark lines according to claim 1, wherein The step of extracting the landmark line from the landmark line data to obtain the initial contour of the landmark line includes the following sub-steps: Perform grayscale processing on the landmark line data to obtain the grayscale data of the landmark line; Perform binarization on the grayscale data of the landmark line to obtain the binarized data of the landmark line; the binarization process includes obtaining the grayscale values of all pixel points in the grayscale data of the landmark line to establish a grayscale histogram, obtaining the average value of the two peaks in the grayscale histogram, setting it as the binarization threshold, assigning the grayscale value of the pixel points in the grayscale data of the landmark line whose grayscale value is less than the binarization threshold to 0, and assigning the grayscale value of the pixel points in the grayscale data of the landmark line whose grayscale value is greater than the binarization threshold to 255; Set the boundary line between the pixel points with grayscale value 0 and the pixel points with grayscale value 255 in the binarized data of the landmark line as the initial contour of the landmark line.
3. A method for identifying damaged landmark lines according to claim 1, characterized in that, The horizontal axis correction includes: For any independent landmark block in the correction coordinate system, set it as the target independent plot, obtain the corrected rectangle of the target independent landmark block, and the midpoint of the bottom of the corrected rectangle coincides with the midpoint of the horizontal edge below the independent target plot; any two sides of the corrected rectangle are parallel to the vertical axis and the other two sides are parallel to the horizontal axis; the width of the corrected rectangle is the width of the bottom edge of the target independent plot, and the length is the height of the target independent plot; Obtain the leftmost point and the rightmost point of the target independent landmark block, set the line connecting the coordinate origin and the leftmost point as the left correction line, and set the line connecting the coordinate origin and the rightmost point as the right correction line; For any coordinate point on the target independent landmark block, set it as the target coordinate point, draw a line parallel to the horizontal axis through the target coordinate point, set it as the target line, set the intersections of the target line with the left correction line and the right correction line as point A and point B respectively, and set the ratio of the distance from point A to the target coordinate point to the distance from point A to point B as the correction standard; Set the two intersections of the target line and the corrected rectangle as point C and point D respectively, set the distance between point C and point D as the horizontal distance, and set the product of the horizontal distance and the correction standard as the correction distance; Set the point on the line connecting point C and point D that is at a distance of the correction distance from point C as the horizontal axis correction coordinate point of the target coordinate point; Connect the horizontal axis correction coordinate points of all coordinate points to obtain a closed figure, and set this closed figure as the horizontal axis correction block; Obtain the horizontal axis correction blocks of all independent landmark blocks to obtain the horizontal axis correction image.
4. A method for identifying damage to landmark lines according to claim 1, characterized in that, The vertical axis correction includes: Set the horizontal axis correction block containing the point with the minimum ordinate as the standard correction block, set the midpoint of the horizontal contour with the smaller ordinate among the midpoints of the two horizontal contours of the standard correction block as the bottom point, obtain the distance between the coordinate origin and the bottom point, and set it as the standard distance; For any horizontal axis correction block in the horizontal axis correction image, set it as the target correction block, obtain the distance between the coordinate origin and the bottom point of the target correction block, and set it as the target perspective distance; Set the ratio of the target perspective distance to the standard distance as the correction ratio; For any coordinate point on the target correction block, set the product of the ordinate of this coordinate point and the correction ratio as the corrected ordinate; Modify the ordinates of all coordinate points on the target correction block to the corrected ordinates to obtain the vertical axis correction landmark block; Obtain the vertical axis correction landmark blocks of all horizontal axis correction blocks to obtain the actual contour of the landmark line.
5. A landmark line damage recognition method according to claim 4, characterized in that, The landmark line damage recognition model is constructed based on the Vision Transformer model framework. Using the landmark line damage recognition model to process the training data to obtain the damage judgment criteria includes the following sub-steps: Build a landmark line damage recognition model. Among them, the input end of the landmark line damage recognition model is three neurons, which are used to input complete cases, damaged cases, and cases to be analyzed; the output end is multiple neurons, which are used to output the comparison results obtained through analysis. The landmark line damage recognition model is used to process the complete cases and cases to be analyzed received by the three neurons at the input end using the Vision Transformer model to obtain comparison results. Among them, the case to be analyzed is the case obtained after preprocessing the detection image.
6. The method for identifying damaged landmark lines according to claim 5, wherein, The steps of obtaining the detection image, preprocessing the detection image, and then using the landmark line damage recognition model to process the detection image to obtain the detection result include the following sub-steps: Obtain the detection image, and preprocess the detection image to obtain the case to be analyzed. Input the case to be analyzed and the training data into the landmark line damage recognition model, and output the comparison result. The comparison result is the result in the training data that is most similar to the analyzed case. When the comparison result is a complete case, it is judged that the detection image has no damage. When the comparison result is a damaged case, it is judged that the detection image has damage, and at the same time, the location of the damage mark is obtained from the comparison result and marked on the detection image.
7. An electronic device, characterized in that, It includes a processor and a memory. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1-6 are run.
8. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps in the method according to any one of claims 1-6 are run.
Citation Information
Patent Citations
Workshop landmark line identification fitting method based on LSD
CN111985436A
Lane line identification method, device and equipment and storage medium
CN109583280A
Transformer bushing heating defect detection method based on infrared image recognition
CN111369516A
Bearing quality detection method based on computer vision
CN115147407A