Landmark line damage identification method
By using fixed angle acquisition and Vision Transformer model identification methods in landmark line recognition, the problem of misidentification of landmark line deformation in the prior art is solved, and accurate identification and analysis of landmark line damage is achieved.
Patent Information
- Application Number
- CN202510506427.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-04-22
AI Technical Summary
When the prior art performs damage identification of landmark lines, it fails to effectively analyze the deformation of the landmark line image, resulting in the misidentification of the deformed landmark lines.
The landmark lines are collected and analyzed by fixed angles, and the landmark line damage recognition model is constructed through the Vision Transformer model, and the actual contour of the landmark line is classified and identified to obtain the damage results of the landmark line.
Through fixed angle acquisition and Vision Transformer model identification, the calculation amount of landmark line correction is reduced, the accurate actual contour of landmark line is obtained, and the reference of analysis results is improved.
Smart Images

Figure CN120014586A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and in particular to a method for identifying damaged landmark lines. Background Art
[0002] Landmark lines refer to visual guidance markings laid along the road to instruct drivers on the direction of travel and provide important signs of traffic safety. Landmark lines include solid lines, dotted lines, double solid lines, double dotted lines, etc. Each type of marking has its own unique meaning.
[0003] In the prior art, when damaged landmark lines are identified, a camera is usually used to capture the landmark lines, and then the captured images are analyzed. However, due to different shooting angles, the same type of landmark lines may present different forms when captured, resulting in misjudgment of the same type of landmark lines. For example, in the application document with publication number CN111985436A, a workshop landmark line recognition and fitting method based on LSD is disclosed. The scheme uses the LSD detection result as the original data set for straight line fitting, and uses the MLP algorithm to determine the target color landmark line, extracts the landmark line coordinate points that meet the conditions, and performs an outlier removal operation on the data set, and finally combines the least squares method to perform straight line fitting of the original data set of a single image; this method does not restore the deformation of the landmark line caused by shooting, so there may be a problem of misidentification of deformed landmark lines. Summary of the invention
[0004] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent. The landmark lines are collected and analyzed at a fixed angle to obtain the actual contours of the landmark lines. A landmark line damage recognition model is constructed based on the Vision Transformer model. The landmark line damage recognition model is used to classify and identify the actual contours of the landmark lines to obtain the damage results of the landmark lines. This solves the problem in the prior art that, when identifying damage to landmark lines, the deformation of the landmark line images is not analyzed, resulting in the misidentification of deformed landmark lines.
[0005] To achieve the above objectives, in a first aspect, the present application provides a method for identifying damaged landmarks, comprising the following steps: Using an image acquisition device to acquire landmark line data and preprocessing the landmark line data to obtain training data; A landmark line damage recognition model is built based on the Vision Transformer model framework, and the landmark line damage recognition model is used to process the training data to obtain the damage judgment standard; Acquire a detection image, pre-process the detection image, and then use the landmark line damage recognition model to process the detection image to obtain a detection result; The method of using an image acquisition device to acquire landmark line data and preprocessing the landmark line data to obtain training data includes the following sub-steps: Use an image acquisition device to shoot the ground with the landmark line at a fixed angle, and set the captured image as the landmark line data; Perform landmark line extraction on the landmark line data to obtain the initial outline of the landmark line; Correcting the initial outline of the landmark line to obtain the actual outline of the landmark line; The actual contour of the landmark line is marked, the damaged position of the actual contour of the landmark line with damage is marked to obtain a damaged case, the actual contour of the landmark line without damage is marked as a complete case, and the damaged case and the complete case are set as training data.
[0006] Furthermore, the step of extracting landmark lines from the landmark line data to obtain the initial outline of the landmark line includes the following sub-steps: Gray-scale processing is performed on the landmark line data to obtain gray-scale data of the landmark line; Binarization is performed on the grayscale data of the landmark line to obtain the binary data of the landmark line; the binarization includes obtaining the grayscale values of all pixels in the grayscale data of the landmark line to establish a grayscale histogram, obtaining the average value of two peaks in the grayscale histogram, setting it as a binarization threshold, assigning the grayscale value of the pixel point whose grayscale value in the grayscale data of the landmark line is less than the binarization threshold to 0, and assigning the grayscale value of the pixel point whose grayscale value in the grayscale data of the landmark line is greater than the binarization threshold to 255; The boundary line between the pixel points with grayscale value 0 and the pixel points with grayscale value 255 in the binary data of the landmark line is set as the initial contour of the landmark line.
[0007] Furthermore, the correction of 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 outline of the landmark line and set them as independent landmark blocks; 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; Obtain the longitudinal correction line segments of all independent landmark blocks, determine whether there are longitudinal correction line segments parallel to each other, and when there are longitudinal correction line segments parallel to each other, collectively refer to the longitudinal correction line segments parallel to each other as a parallel group, set the group of parallel groups containing the most longitudinal correction line segments as the longitudinal correction group, and set any longitudinal correction line segment in the longitudinal correction group as the longitudinal correction standard; When there are no longitudinal correction line segments parallel to each other, the line connecting the leftmost midpoint and the rightmost midpoint of the initial contour of the landmark line is set as the longitudinal correction standard; Obtain the intersection points of the horizontal correction lines of all independent landmark blocks. If there is only one intersection point, set the intersection point as the vanishing point. If there are more than one intersection point, obtain the intersection point with the most horizontal correction lines and set it as the vanishing point. Taking the vanishing point as the coordinate origin, a plane rectangular coordinate system is established, wherein the horizontal axis of the coordinate system is parallel to the longitudinal correction standard, and the longitudinal axis is perpendicular to the longitudinal correction standard, thereby obtaining a correction coordinate system; Perform transverse axis correction on all independent landmark blocks in the correction coordinate system to obtain a transverse axis corrected image; The horizontal axis correction image is corrected by the vertical axis to obtain the actual outline of the landmark line.
[0008] Furthermore, the horizontal axis correction includes: For any independent landmark block in the calibration coordinate system, set it as the target independent plot, obtain the calibration rectangle of the target independent landmark block, the midpoint of the bottom of the calibration rectangle coincides with the midpoint of the horizontal edge below the independent target plot; any two sides of the calibration rectangle are parallel to the longitudinal axis and the other two sides are parallel to the transverse axis; the width of the calibration rectangle is the width of the bottom edge of the target independent plot, and the length is the height of the target independent plot; Get 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 straight line parallel to the horizontal axis through the target coordinate point, set it as the target straight line, set the intersection of the target straight 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; The two intersection points of the target straight line and the calibration rectangle are set as point C and point D respectively, the distance between point C and point D is set as the lateral distance, and the product of the lateral distance and the calibration standard is set as the calibration distance; Set the point on the line connecting point C and point D that is 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 the closed figure as a horizontal axis correction block; Obtain the transverse axis correction blocks of all independent landmark blocks to obtain the transverse axis correction image.
[0009] Furthermore, the longitudinal axis correction includes: The horizontal axis correction block including the point with the smallest ordinate is set as the standard correction block, the midpoint of the two lateral contours of the standard correction block with the smaller ordinate is set as the bottom point, and the distance of the line connecting the coordinate origin and the bottom point is obtained and set 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; The ratio of the target perspective distance to the standard distance is set as the correction ratio; For any coordinate point on the target correction block, the product of the ordinate of the coordinate point and the correction ratio is set as the correction ordinate; Modify the ordinates of all coordinate points on the target correction block into the correction ordinates to obtain a ordinate correction landmark block; Obtain the vertical axis correction landmark blocks of all horizontal axis correction blocks to obtain the actual outline of the landmark line.
[0010] Furthermore, the landmark line damage recognition model is constructed based on the Vision Transformer model framework, and the landmark line damage recognition model is used to process the training data to obtain the damage judgment standard, which includes the following sub-steps: A landmark line damage recognition model is established, wherein the input end of the landmark line damage recognition model is three neurons for inputting complete cases, damaged cases and cases to be analyzed; the output end is multiple neurons for outputting the comparison results obtained by analysis; The landmark line damage recognition model is used to process the complete cases received by the three neurons at the input end and the cases to be analyzed using the Vision Transformer model to obtain comparison results, wherein the cases to be analyzed are the cases obtained after preprocessing the detection images.
[0011] Furthermore, the acquisition of the detection image, preprocessing the detection image, and then processing the detection image using the landmark line damage recognition model to obtain the detection result includes the following sub-steps: Acquire a detection image, and pre-process the detection image to obtain a case to be analyzed; Inputting the case to be analyzed and the training data into the landmark line damage identification model, and outputting a comparison result, wherein the comparison result is the result in the training data that is most similar to the analysis case; When the comparison result is a complete case, it is determined that there is no damage in the detected image; When the comparison result is a damage 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.
[0012] In a second aspect, the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the above method are performed.
[0013] In a third aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are performed.
[0014] Beneficial effects of the present invention: The present invention first captures and collects landmark lines based on a fixed angle to obtain landmark line data, and then extracts the contour of the landmark line data to obtain the initial contour of the landmark line. By using a fixed angle to collect the landmark line, the obtained landmark line data has uniformity in deformation. When the landmark line data is subsequently corrected, a unified proportional correction can be used, thereby reducing the amount of calculation for landmark line correction. The present invention also obtains the actual contour of the landmark line by performing lateral and longitudinal corrections on the initial contour of the landmark line. The lateral deformation of the initial contour of the landmark line can be restored through the lateral correction, and the longitudinal deformation of the initial contour of the landmark line can be restored through the longitudinal correction. The actual contour of the landmark line obtained by correcting the initial contour of the landmark line can fully display the actual state of the landmark line, provide accurate data support for subsequent model processing, and improve the reference of the analysis results. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a flow chart of the steps of the method of the present invention; Figure 2 is a schematic diagram of a correction coordinate system of the present invention; Figure 3 It is a schematic diagram of the horizontal axis correction of the present invention; Figure 4 A schematic diagram of the longitudinal axis correction of the present invention; Figure 5 It is a schematic structural diagram of the electronic device of the present invention. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0017] Example 1, please refer to Figure 1 As shown, the present application provides a method for identifying damaged landmarks, comprising the following steps: S1: using an image acquisition device to acquire landmark line data and preprocess the landmark line data to obtain training data; step S1 includes the following sub-steps: S101: Use an image acquisition device to shoot a ground with a landmark line at a fixed angle, and set the shot image as 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; S102: extracting landmark lines from the landmark line data to obtain the initial outline of the landmark line; step S102 includes the following sub-steps: S10201: grayscale the landmark line data to obtain grayscale data of the landmark line; S10202: Binarization is performed on the grayscale data of the landmark line to obtain the binary data of the landmark line; the binarization includes obtaining the grayscale values of all pixels 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 and setting it as the binarization threshold, assigning the grayscale value of the pixel point whose grayscale value in the grayscale data of the landmark line is less than the binarization threshold to 0, and assigning the grayscale value of the pixel point whose grayscale value in the grayscale data of the landmark line is greater than the binarization threshold to 255; in the specific implementation process, the grayscale difference between the landmark line and the ground is often large and is the main body in the grayscale data, so the two peaks in the grayscale histogram represent the landmark line and the ground background, and setting the average value of the two peaks in the grayscale histogram as the binarization threshold can accurately distinguish the landmark line area from the ground area; S10203: setting 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 binary data of the landmark line as the initial contour of the landmark line.
[0018] S103: Correcting the initial contour of the landmark line to obtain the actual contour of the landmark line; See also Figure 2 As shown, step S103 includes the following sub-steps: S10301: obtaining multiple closed figures from the initial outline of the landmark line and setting them as independent landmark blocks; S10302: 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; 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 direction of the contour of the independent landmark block, take the midpoint of the line connecting 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; S10303: Obtain the longitudinal correction line segments of all independent landmark blocks, and determine whether there are longitudinal correction line segments parallel to each other. When there are longitudinal correction line segments parallel to each other, the longitudinal correction line segments parallel to each other are collectively referred to as a parallel group, and a group of parallel groups containing the most longitudinal correction line segments is set as a longitudinal correction group, and any longitudinal correction line segment in the longitudinal correction group is set as a longitudinal correction standard. In the specific implementation process, the initial contour of the landmark line collected may not be parallel to the edge of the image, resulting in an inconsistent coordinate system established subsequently, and the line segment relationship between the landmark lines is usually parallel or perpendicular, so the establishment direction of the coordinate system can be determined by the longitudinal correction line segment; S10304: when there are no mutually parallel longitudinal correction line segments, the line connecting the leftmost midpoint and the rightmost midpoint of the initial contour of the landmark line is obtained and set as the longitudinal correction standard; in the specific implementation process, when there are too many landmark line damages, the initial contour of the landmark line will be presented as multiple irregular figures, in which the perspective relationship between the initial contours of multiple landmark blocks is difficult to distinguish, so the line connecting the leftmost midpoint and the rightmost midpoint of the initial contour of the entire landmark line is selected as the longitudinal correction standard; S10305: Obtain the intersection points of the horizontal 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 point, obtain the intersection point with 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 outline of the landmark line, the vanishing point of the initial outline of the landmark line can be obtained by obtaining the intersection point of the perspective direction of each independent landmark block. When a large number of independent landmark blocks are damaged, the perspective relationship is difficult to distinguish, resulting in different intersection points. Therefore, the intersection point with the most horizontal correction lines is used as the vanishing point. S10306: Taking the vanishing point as the coordinate origin, establishing a plane rectangular coordinate system, wherein the horizontal axis of the coordinate system is parallel to the longitudinal correction standard, and the longitudinal axis is perpendicular to the longitudinal correction standard, thereby obtaining a correction coordinate system; S10307: Performing horizontal axis correction on all independent landmark blocks in the correction coordinate system to obtain a horizontal axis correction image; See also Figure 3 As shown, the horizontal axis correction includes: for any independent landmark block in the correction coordinate system, set it as the target independent land parcel, obtain the correction rectangle of the target independent landmark block, the midpoint of the bottom of the correction rectangle coincides with the midpoint of the horizontal edge below the independent target land parcel; any two sides of the correction rectangle are parallel to the longitudinal 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 land parcel, and the length is the height of the target independent land parcel; Get 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 straight line parallel to the horizontal axis through the target coordinate point, set it as the target straight line, set the intersection of the target straight 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; The two intersection points of the target straight line and the calibration rectangle are set as point C and point D respectively, the distance between point C and point D is set as the lateral distance, and the product of the lateral distance and the calibration standard is set as the calibration distance; The point on the line connecting point C and point D that is the correction distance from point C is set 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 correction standard of the target coordinate point (-8, -6) is 0.6, the horizontal distance is 4, the correction distance is 2.4, the horizontal coordinate of point C is -5, and the coordinates of the horizontal axis correction coordinate point of the target coordinate point are obtained as (-2.6, -6); Connect the horizontal axis correction coordinate points of all coordinate points to obtain a closed figure, and set the closed figure as a horizontal axis correction block; Obtain the transverse axis correction blocks of all independent landmark blocks to obtain the transverse axis correction image.
[0019] S10308: Performing longitudinal correction on the horizontal axis correction image to obtain the actual contour of the landmark line; See also Figure 4 As shown, the longitudinal axis correction includes: setting the transverse axis correction block containing the point with the smallest longitudinal coordinate as the standard correction block, setting the midpoint of the transverse contour with the smaller longitudinal coordinate among the midpoints of the two transverse contours of the standard correction block as the bottom point, obtaining the distance of the line connecting the coordinate origin and the bottom point, and setting 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; The ratio of the target perspective distance to the standard distance is set as the correction ratio; For any coordinate point on the target correction block, the product of the ordinate of the coordinate point and the correction ratio is set as the corrected ordinate. In the specific implementation process, for example, in a longitudinal axis correction process, the correction ratio obtained is 3. For any coordinate point (6, -9) on the target correction block, the corrected ordinate obtained after the ordinate of the coordinate point is corrected is -27. Modify the ordinates of all coordinate points on the target correction block into the correction ordinates to obtain a ordinate correction landmark block; Obtain the vertical axis correction landmark blocks of all horizontal axis correction blocks to obtain the actual outline of the landmark line.
[0020] S104: marking the actual contour of the landmark line, marking the damaged position of the actual contour of the landmark line with damage to obtain a damaged case, marking the actual contour of the landmark line without damage as a complete case, and setting the damaged case and the complete case as training data; S2: Building 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 standard; step S2 includes the following sub-steps: S201: Establishing a landmark line damage recognition model, wherein the input end of the landmark line damage recognition model is three neurons for inputting complete cases, damaged cases, and cases to be analyzed; the output end is multiple neurons for outputting comparison results obtained by analysis; S202: The landmark line damage recognition model is used to process the complete cases received by the three neurons at the input end and the cases to be analyzed using the Vision Transformer model to obtain a comparison result, wherein the cases to be analyzed are cases obtained after preprocessing the detection image; S3: Acquire a detection image, pre-process the detection image, and then use the landmark line damage recognition model to process the detection image to obtain a detection result.
[0021] Step S3 includes the following sub-steps: S301: Acquire a detection image, and pre-process the detection image to obtain a case to be analyzed; S302: Input the case to be analyzed and the training data into the landmark line damage identification model, and output a comparison result, which is the result in the training data that is most similar to the analysis case; S303: When the comparison result is a complete case, it is determined that there is no damage in the detected image; S304: When the comparison result is a damage 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.
[0022] Example 2, please refer to Figure 5 As shown, Figure 5The schematic diagram of the structure of an electronic device is illustrated, and the electronic device may include: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate 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 landmark line damage recognition method are executed to achieve the following functions: using an image acquisition device to obtain landmark line data and preprocessing the landmark line data to obtain training data; building 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 standard; 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.
[0023] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0024] Embodiment 4. The present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a landmark line damage identification method provided by the above methods, the method including: using an image acquisition device to acquire landmark line data and preprocessing the landmark line data to obtain training data; building a landmark line damage identification model based on the VisionTransformer model framework, and using the landmark line damage identification model to process the training data to obtain a damage judgment standard; acquiring a detection image, preprocessing the detection image, and then using the landmark line damage identification model to process the detection image to obtain a detection result.
[0025] Embodiment 5. The present application also 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 the above landmark line damage identification method are executed to achieve the following functions: using an image acquisition device to acquire landmark line data and preprocessing the landmark line data to obtain training data; building a landmark line damage identification model based on the Vision Transformer model framework, and using the landmark line damage identification model to process the training data to obtain a damage judgment standard; acquiring a detection image, preprocessing the detection image, and then using the landmark line damage identification model to process the detection image to obtain a detection result.
[0026] Through the description of the above implementation methods, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on such an understanding, the above technical solutions can be essentially or partly contributed to the prior art in the form of software products, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and include several instructions for enabling 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.
[0027] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.
[0028] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for identifying damaged landmarks, characterized in that: The steps include: Using an image acquisition device to acquire landmark line data and preprocessing the landmark line data to obtain training data; A landmark line damage recognition model is built based on the Vision Transformer model framework, and the landmark line damage recognition model is used to process the training data to obtain the damage judgment standard; Acquire a detection image, pre-process 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 acquire landmark line data and preprocessing the landmark line data to obtain training data includes the following sub-steps: Use an image acquisition device to shoot the ground with the landmark line at a fixed angle, and set the captured image as the landmark line data; Perform landmark line extraction on the landmark line data to obtain the initial outline of the landmark line; Correcting the initial outline of the landmark line to obtain the actual outline of the landmark line; The actual contour of the landmark line is marked, the damaged position of the actual contour of the landmark line with damage is marked to obtain a damaged case, the actual contour of the landmark line without damage is marked as a complete case, and the damaged case and the complete case are set as training data.
2. A method for identifying damaged landmarks according to claim 1, characterized in that: Extracting landmarks from landmark data to obtain the initial outline of the landmarks includes the following sub-steps: Gray-scale processing is performed on the landmark line data to obtain gray-scale data of the landmark line; Binarization is performed on the grayscale data of the landmark line to obtain the binary data of the landmark line; the binarization includes obtaining the grayscale values of all pixels in the grayscale data of the landmark line to establish a grayscale histogram, obtaining the average value of two peaks in the grayscale histogram, setting it as a binarization threshold, assigning the grayscale value of the pixel point whose grayscale value in the grayscale data of the landmark line is less than the binarization threshold to 0, and assigning the grayscale value of the pixel point whose grayscale value in the grayscale data of the landmark line is greater than the binarization threshold to 255; The boundary line between the pixel points with grayscale value 0 and the pixel points with grayscale value 255 in the binary data of the landmark line is set as the initial contour of the landmark line.
3. A method for identifying damaged landmarks according to claim 1, characterized in that: 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 outline of the landmark line and set them as independent landmark blocks; 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; Obtain the longitudinal correction line segments of all independent landmark blocks, determine whether there are longitudinal correction line segments parallel to each other, and when there are longitudinal correction line segments parallel to each other, collectively refer to the longitudinal correction line segments parallel to each other as a parallel group, set the group of parallel groups containing the most longitudinal correction line segments as the longitudinal correction group, and set any longitudinal correction line segment in the longitudinal correction group as the longitudinal correction standard; When there are no longitudinal correction line segments parallel to each other, the line connecting the leftmost midpoint and the rightmost midpoint of the initial contour of the landmark line is set as the longitudinal correction standard; Obtain the intersection points of the horizontal correction lines of all independent landmark blocks. If there is only one intersection point, set the intersection point as the vanishing point. If there are more than one intersection point, obtain the intersection point with the most horizontal correction lines and set it as the vanishing point. Taking the vanishing point as the coordinate origin, a plane rectangular coordinate system is established, wherein the horizontal axis of the coordinate system is parallel to the longitudinal correction standard, and the longitudinal axis is perpendicular to the longitudinal correction standard, thereby obtaining a correction coordinate system; Perform transverse axis correction on all independent landmark blocks in the correction coordinate system to obtain a transverse axis corrected image; The horizontal axis correction image is corrected by the vertical axis to obtain the actual outline of the landmark line.
4. A method for identifying damaged landmarks according to claim 3, characterized in that: The horizontal axis correction includes: For any independent landmark block in the calibration coordinate system, set it as the target independent plot, obtain the calibration rectangle of the target independent landmark block, the midpoint of the bottom of the calibration rectangle coincides with the midpoint of the horizontal edge below the independent target plot; any two sides of the calibration rectangle are parallel to the longitudinal axis and the other two sides are parallel to the transverse axis; the width of the calibration rectangle is the width of the bottom edge of the target independent plot, and the length is the height of the target independent plot; Get 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 straight line parallel to the horizontal axis through the target coordinate point, set it as the target straight line, set the intersection of the target straight 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; The two intersection points of the target straight line and the calibration rectangle are set as point C and point D respectively, the distance between point C and point D is set as the lateral distance, and the product of the lateral distance and the calibration standard is set as the calibration distance; Set the point on the line connecting point C and point D that is 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 the closed figure as a horizontal axis correction block; Obtain the transverse axis correction blocks of all independent landmark blocks to obtain the transverse axis correction image.
5. A method for identifying damaged landmark lines according to claim 3, characterized in that: The longitudinal axis correction comprises: The horizontal axis correction block including the point with the smallest ordinate is set as the standard correction block, the midpoint of the two lateral contours of the standard correction block with the smaller ordinate is set as the bottom point, and the distance of the line connecting the coordinate origin and the bottom point is obtained and set 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; The ratio of the target perspective distance to the standard distance is set as the correction ratio; For any coordinate point on the target correction block, the product of the ordinate of the coordinate point and the correction ratio is set as the correction ordinate; Modify the ordinates of all coordinate points on the target correction block into the correction ordinates to obtain a ordinate correction landmark block; Obtain the vertical axis correction landmark blocks of all horizontal axis correction blocks to obtain the actual outline of the landmark line.
6. A method for identifying damaged landmarks according to claim 5, characterized in that: The method of constructing a landmark line damage recognition model based on the VisionTransformer model framework and using the landmark line damage recognition model to process the training data to obtain a damage judgment standard includes the following sub-steps: A landmark line damage recognition model is established, wherein the input end of the landmark line damage recognition model is three neurons for inputting complete cases, damaged cases and cases to be analyzed; the output end is multiple neurons for outputting the comparison results obtained by analysis; The landmark line damage recognition model is used to process the complete cases received by the three neurons at the input end and the cases to be analyzed using the Vision Transformer model to obtain comparison results, wherein the cases to be analyzed are the cases obtained after preprocessing the detection images.
7. A method for identifying damaged landmarks according to claim 6, characterized in that: The acquisition of the detection image, pre-processing the detection image, and then processing the detection image using the landmark line damage recognition model to obtain the detection result comprises the following sub-steps: Acquire a detection image, and pre-process the detection image to obtain a case to be analyzed; Inputting the case to be analyzed and the training data into the landmark line damage identification model, and outputting a comparison result, wherein the comparison result is the result in the training data that is most similar to the analysis case; When the comparison result is a complete case, it is determined that there is no damage in the detected image; When the comparison result is a damage 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.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein 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 to 7 are executed.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are executed.
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
Unmanned aerial vehicle railway track line recognition method based on computer vision
CN110516532A
Transformer bushing heating defect detection method based on infrared image recognition
CN111369516A
Vehicle yaw early warning method and system in road marking missing environment
CN114715168A