Surface defect detection method and device of railway vehicle, computer equipment and medium

By identifying defect sub-images and key component locations in target images during rail vehicle inspection, and cropping component images, the problems of high computational load and low efficiency in existing technologies are solved, achieving efficient and accurate defect detection.

CN121860951APending Publication Date: 2026-04-14ZHUZHOU ELECTRIC LOCOMOTIVE CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-19
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing methods for detecting defects in rail vehicles are computationally intensive, inefficient, and unable to effectively screen out unimportant potential defects, leading to missed detections or misjudgments.

Method used

By acquiring the target image of the vehicle under test and the preset defect sub-image size, the first location of the defect in the target image is identified, and the defect sub-image is cropped based on the first location and the defect sub-image size. Then, the second location of the key component is identified from the defect sub-image, the component image of the key component is cropped, and the defect type is determined by combining the first and second locations.

Benefits of technology

It improves the accuracy and efficiency of key component identification, reduces interference from background noise and irrelevant elements, avoids missing key components, and enhances the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121860951A_ABST
    Figure CN121860951A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of rail traffic intelligent detection and fault diagnosis, in particular to a rail vehicle surface defect detection method and device, computer equipment and a medium. The method comprises the following steps: acquiring a target image of a to-be-detected vehicle and a preset defect sub-image size; identifying a first position of a defect in the target image, and cutting a defect sub-image corresponding to each first position from the target image based on the first position and the defect sub-image size; identifying a second position of a key component of the to-be-detected vehicle from each defect sub-graph, and cutting a component image of the key component from the defect sub-graph based on the second position; and based on the component images, determining target components with defects in the key components and defect types of the target components. By adopting the method, the efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent detection and fault diagnosis technology for rail transit, and in particular to a method, device, computer equipment and medium for detecting surface defects in rail vehicles. Background Technology

[0002] With the rapid development of the rail transit industry, intelligent inspection and maintenance technologies for rail vehicles have gradually become crucial for ensuring safe train operation and reducing operating costs. Traditional rail vehicle inspection mainly relies on manual checks, which is not only inefficient but also prone to omissions or misjudgments due to human factors. In recent years, with the continuous development of computer vision, image processing, and artificial intelligence technologies, image-based intelligent inspection technologies for rail vehicles have gradually emerged, bringing new opportunities for rail vehicle maintenance and management.

[0003] However, existing defect detection methods mainly involve two stages of defect localization to identify defects in an image. For example, invention application CN 116977257 A divides defect detection of the item to be inspected into two stages: a primary prediction stage and a secondary prediction stage. The first stage involves coarse localization, and the second stage involves multi-scale cropping and fine classification. However, existing technologies suffer from high computational cost, low efficiency, and the inability to filter out unimportant potential defects. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer equipment, and medium for detecting surface defects in rail vehicles that can improve efficiency in response to the above-mentioned technical problems.

[0005] A method for detecting surface defects in rail vehicles, the method comprising:

[0006] S1. Obtain the target image of the vehicle under test and the preset defect sub-image size;

[0007] Preferably, the target image is a single-view image of the vehicle under test;

[0008] S2. Identify the first location of the defect in the target image, and based on the first location and the size of the defect sub-image, crop the defect sub-image corresponding to each first location from the target image;

[0009] Preferably, when multiple first positions exist in the same defect sub-image, only one defect sub-image is cropped.

[0010] S3. Identify the second location of the key component of the vehicle under test from each of the defect sub-images, and crop the component image of the key component from the defect sub-images based on the second location;

[0011] S4. Based on the component images, determine the target components with defects in each of the key components and the defect types of the target components.

[0012] Preferably, a defect detection report is output, which includes at least the target component in the critical components of the vehicle under test that has a defect and the type of defect in the target component.

[0013] In one embodiment, the process of acquiring the target image in step S1 includes:

[0014] When the target vehicle to which the vehicle under test belongs passes through the image acquisition area, the image acquisition area is controlled to acquire the first image of the vehicle under test, and the target speed of the target vehicle passing through the image acquisition area is obtained.

[0015] When the target speed is inconsistent with the preset speed, the first image is transformed using the preset standard image of the vehicle under test to obtain the second image;

[0016] The second image is geometrically corrected using the preset standard image to obtain the target image; the target image and the preset standard image include at least one identical component, and the position of the identical component in the target image is consistent with its position in the preset standard image.

[0017] Preferably, the target speed is determined based on the time point at which the first image is acquired.

[0018] Preferably, when the vehicle under test passes through the image acquisition area at a preset speed, the positions of each component in the acquired image are consistent with the positions of the corresponding components in the preset standard image.

[0019] Preferably, the preset standard image is a pre-set defect-free image.

[0020] In one embodiment, the method further includes:

[0021] Identify the matching overlapping positions between the first and second positions, the non-matching non-overlapping positions between the first and second positions, and the third position of the defective target component; the non-overlapping position exists in the first position but not in the second position;

[0022] Position marking is performed based on the overlapping position, the non-overlapping position, and the third position.

[0023] In one embodiment, the position labeling based on the overlapping position, the non-overlapping position, and the third position includes:

[0024] By stitching together the target images of each of the vehicles under test, a panoramic image of the target vehicle is obtained.

[0025] In the panoramic image, a first identifier is used to mark the non-overlapping positions, a second identifier is used to mark the overlapping positions, and a third identifier is used to mark the third positions;

[0026] The panoramic image is displayed with its location labeled.

[0027] In one embodiment, the method further includes:

[0028] Based on the non-overlapping positions, output the first warning information;

[0029] Based on the overlapping positions, a second early warning message is output;

[0030] Based on the third location, a third warning message is output; the warning level of the third warning message is higher than the warning level of the second warning message, and the warning level of the second warning message is higher than the warning level of the first warning message.

[0031] Preferably, the output formats of the first warning information, the second warning information, and the third warning information are different.

[0032] In one embodiment, step S2 includes:

[0033] Acquire a preset standard image of the vehicle under test;

[0034] Calculate the grayscale difference between the target image and the preset standard image for the same pixel.

[0035] The grayscale difference of each pixel is compared with a preset threshold, and the position of the pixel whose grayscale difference is greater than or equal to the preset threshold is determined as the first position of the defect in the target image.

[0036] A surface defect detection device for rail vehicles, the device comprising:

[0037] The data acquisition module is used to acquire the target image of the vehicle under test and the preset defect sub-image size;

[0038] The first location recognition module is used to identify the first location of the defect in the target image, and based on the first location and the size of the defect sub-image, to crop the defect sub-image corresponding to each first location from the target image;

[0039] The second location recognition module is used to identify the second location of the key component of the vehicle under test from each of the defect sub-images, and to crop the component image of the key component from the defect sub-image based on the second location;

[0040] The type determination module is used to determine, based on the component image, the target component with defects in each of the key components and the type of defect in the target component.

[0041] A computer device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the method described above.

[0042] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0043] The aforementioned surface defect detection method, apparatus, computer equipment, and medium for rail vehicles acquire a target image of the vehicle under test and a preset defect sub-image size. They identify the first location of defects in the target image and, based on the first location and defect sub-image size, crop defect sub-images corresponding to each first location from the target image. This filters out potential defects, reducing computational load for subsequent identification of key component locations. By identifying the second location of key components of the vehicle under test from each defect sub-image, background interference is effectively eliminated during key component identification, resulting in more accurate component location. Compared to directly identifying key components from the entire target image, this reduces interference from background noise and other irrelevant elements, improving the accuracy of key component identification. By cropping component images of key components from the defect sub-images based on the second location, the combination of the first and second locations ensures that the final component image used for defect identification is an image of a potentially defective key component, rather than an image of a non-key component or a key component without defects. This further reduces computational load, thereby improving defect identification efficiency when determining the target component with defects and the type of defect in each key component based on the component image. Attached Figure Description

[0044] Figure 1 This is a diagram illustrating the application environment of a surface defect detection method for rail vehicles in one embodiment.

[0045] Figure 2 This is a flowchart illustrating a surface defect detection method for a rail vehicle in one embodiment;

[0046] Figure 3 This is an architecture diagram of a defect detection system in one embodiment;

[0047] Figure 4 This is a structural block diagram of a surface defect detection device for a rail vehicle in one embodiment.

[0048] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0050] The surface defect detection method for rail vehicles provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 interacts with server 104 via a wired / wireless channel. A data storage system can store the data that server 104 needs to process. The process includes: S1, acquiring the target image of the vehicle under test and a preset defect sub-image size; S2, identifying the first location of the defect in the target image, and cropping the corresponding defect sub-images from the target image based on the first location and the defect sub-image size; S3, identifying the second location of the key components of the vehicle under test from each defect sub-image, and cropping the component images of the key components from the defect sub-images based on the second location; S4, determining the target component with defects in each key component and the defect type of the target component based on the component images. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, etc. Server 104 can be a single server, a server cluster consisting of multiple servers, or a cloud computing center consisting of multiple servers.

[0051] In one embodiment, such as Figure 2 As shown, a surface defect detection method for rail vehicles is provided, which can be applied to... Figure 1 Taking server 104 as an example, the following steps are included:

[0052] S1. Obtain the target image of the vehicle under test and the preset defect sub-image size;

[0053] The vehicle under test is a specific train car within a rail vehicle fleet. The target image is a single-view image of the vehicle under test, meaning an image captured by a single camera. In a specific application, a single-view image can be an image of the bogie, the undercarriage, the body, or the roof.

[0054] The defect subimage size is pre-set data that can be stored in the server. In a specific application, the defect subimage size is 2000*4096 pixels.

[0055] S2. Identify the first location of the defect in the target image, and based on the first location and the size of the defect sub-image, crop the defect sub-image corresponding to each first location from the target image;

[0056] Methods for identifying the primary location of defects in a target image include, but are not limited to, gray-level difference, edge detection, and template matching. Gray-level difference locates the primary location of a defect by identifying the pixel gray-level difference between the target image and a defect-free image. Edge detection detects edge features such as breaks, redundancies, and distortions, locating the primary location of the defect through changes in these features. Template matching matches the target image and the defect-free image; the location with the lowest matching score is the primary location of the defect. A defect-free image is an image without any defects.

[0057] Based on the size of the defect sub-image, the target image can be divided into multiple defect sub-images. The defect sub-image corresponding to the first position is the sub-image containing that first position. In a specific application, the first position of the defect is (8888, 1111), and the size of the defect sub-image is 2000*4096. Therefore, the first position is the fifth defect sub-image in the first row. The defect sub-image corresponding to the first position (8888, 1111) is the fifth defect sub-image in the first row of the target image.

[0058] In some embodiments, when multiple first positions exist in the same defect subgraph, only one defect subgraph is cropped.

[0059] S3. Identify the second location of the key component of the vehicle under test from each defect sub-image, and crop the component image of the key component from the defect sub-image based on the second location;

[0060] Among them, the key components of the vehicle under test are those that play a decisive role in the vehicle's operation, safety, control, or structure. For example, the air springs, primary springs, axle box covers, grounding devices, and shock absorbers of the vehicle under test are all key components.

[0061] Component images are images of critical components that may have defects; a component image includes the complete critical component. Cropped component images can be stored in a temporary directory on the server.

[0062] Since the critical components are the main components that will have a serious impact on the operation of the vehicle under test, only the second location of the critical component is identified in the defect sub-image, and the component image of the critical component is cropped. This way, the first and second locations can be combined so that the component image used for defect identification is the image of the critical component that may have a defect, rather than the image of the non-critical component or the image of the critical component that does not have a defect, thus reducing the amount of computation.

[0063] The second location of a key component of the vehicle under test can be obtained through an object detection model, or through methods based on semantic segmentation or instance segmentation. The process of locating the second location of a key component using an object detection model includes: deploying the trained object detection model to a server; when the server obtains a defect sub-image, the trained object detection model outputs the second location of the key component in the defect sub-image. The process of locating the second location of a key component using semantic segmentation or instance segmentation methods includes: inputting the defect sub-image into a pre-trained instance segmentation model to obtain a pixel-level binary segmentation mask of the key component; calculating the geometric features of the key component based on the binary mask region to determine its second location, which can be any one of the following: geometric center coordinates, minimum bounding rectangle, contour boundary point set, or principal axis direction angle; verifying the rationality of the second location using preset component layout rules, and outputting the verified second location.

[0064] S4. Based on the component images, identify the target components with defects in each key component and the type of defects in the target components.

[0065] The defect type of the target component may be one or more of the following: missing, loose, oil leakage, or other defect types.

[0066] The defective target component and its defect type can be identified using deep learning or image analysis methods. Specifically, switching between deep learning and image analysis methods can be implemented based on the specific application scenario and computing resources. This enhances the system's adaptability and flexibility, improves the practicality and reliability of this application, provides comprehensive and refined technical support for intelligent maintenance of rail vehicles, effectively improves maintenance efficiency and quality, and ensures the safe operation of rail vehicles.

[0067] Furthermore, the component images are input into a pre-trained deep learning model to perform refined analysis on the texture, shape, and other features in the component images, thereby outputting the target component with defects and the type of defects in the target component.

[0068] Further, the component images are preprocessed; defect detection is performed on the preprocessed component images; based on the defect detection results, the defect types of the target components with defects are classified to obtain the defect types of the target components. The preprocessing includes at least: converting the color image to a grayscale image; applying a Gaussian filter to remove noise; and performing histogram equalization to enhance contrast. The defect detection steps include: performing threshold segmentation on the component images to generate binary images; applying morphological operations to clean up isolated points or fill holes in the binary images; and performing texture analysis on the cleaned binary images to identify target components with defects. The step of classifying the defect types of target components based on the defect detection results includes: extracting the geometric features (such as area, perimeter, and shape factor) of the target components with defects; calculating the grayscale statistics (such as average grayscale value and standard deviation) of the component image corresponding to the target components with defects; and, based on preset defect attributes, using the geometric features and corresponding grayscale statistics of the target components as the current defect attributes of the target components, determining matching attributes from the preset defect attributes that match the current defect attributes of the target components, and determining the defect type associated with the matching attributes as the defect type of the target components.

[0069] In some embodiments, the surface defect detection method for rail vehicles further includes:

[0070] Output a defect detection report, which should include at least the target component in the critical components of the vehicle under test and the type of defect in the target component.

[0071] In the aforementioned surface defect detection method for rail vehicles, by acquiring the target image of the vehicle under test and a preset defect sub-image size, the first location of the defect in the target image is identified. Based on the first location and the defect sub-image size, defect sub-images corresponding to each first location are cropped from the target image. This filters out potential defects, reducing computational load for subsequent identification of key component locations. By identifying the second location of the key components of the vehicle under test from each defect sub-image, background interference can be effectively eliminated when identifying key components, thereby more accurately locating them. Compared to directly identifying key components from the entire target image, this reduces interference from background noise and other irrelevant elements, improving the accuracy of key component identification. By cropping component images of key components from the defect sub-images based on the second location, the combination of the first and second locations ensures that the final component image used for defect identification is an image of a potentially defective key component, rather than an image of a non-key component or a key component without defects. This further reduces computational load, thereby improving defect identification efficiency when determining the target component with defects and the defect type of the target component based on the component image. In addition, it also avoids the situation where only the first location of the defect in the target image is output as the defect detection result, avoids missing early defects of key components, and avoids the failure being discovered only when it has developed to a more serious stage, thereby reducing maintenance costs and safety risks.

[0072] In one embodiment, the first location, the second location, the third location of the defective target component, and the defect type of the target component can be sent to the connected platform, thereby enabling the platform to realize an intelligent and hierarchical defect management and response mechanism, allowing maintenance personnel to allocate resources reasonably according to the anomaly level and handle critical issues in a timely manner.

[0073] In one embodiment, the process of obtaining the target image in step S1 includes:

[0074] When the target vehicle to which the vehicle under test belongs passes through the image acquisition area, the image acquisition area is controlled to acquire the first image of the vehicle under test and the target speed of the target vehicle passing through the image acquisition area is obtained.

[0075] When the target speed is inconsistent with the preset speed, the first image is transformed using the preset standard image of the vehicle under test to obtain the second image;

[0076] The second image is geometrically corrected using a preset standard image to obtain a target image; the target image and the preset standard image include at least one identical component, and the position of the identical component in the target image is consistent with its position in the preset standard image.

[0077] The target vehicle refers to a train running on the track.

[0078] The image acquisition area is the region used to acquire the first image of the vehicle under test. When the vehicle passes through the image acquisition area, the server sends an image acquisition command to the area, causing it to automatically acquire the first image of the vehicle. The target speed is the speed information of the vehicle under test when the first image is acquired. The target speed can be determined based on the time point at which the first image is acquired. For example, if the first image is acquired at time A, then the speed of the vehicle under test at time A is obtained, and the speed of the vehicle under test at time A is the target speed.

[0079] The preset speed is configured such that when the vehicle under test passes through the image acquisition area at the preset speed, the positions of each component in the acquired image are consistent with the positions of the corresponding components in the preset standard image. For example, when the vehicle under test passes through the image acquisition area at the preset speed, the position of component A in the acquired image is consistent with its position in the preset standard image.

[0080] The discrepancy between the target speed and the preset speed indicates that the positions of the components in the first image are offset from the corresponding positions in the preset standard image. Therefore, it is necessary to use the preset standard image of the vehicle under test to convert and align the first image.

[0081] The preset standard image can be a pre-set defect-free image or a target image of the vehicle under test that was previously captured in the image acquisition area.

[0082] The process of transforming a first image using a preset standard image of the vehicle under test to obtain a second image includes: selecting a stable template region from the preset standard image, the template region having high contrast and being less susceptible to defects or stains; using a template matching algorithm to search for the optimal position in the first image that matches the template region, the template matching algorithm including but not limited to normalized cross-correlation algorithm, squared difference matching algorithm, and correlation matching algorithm; calculating the spatial transformation parameters of the first image relative to the preset standard image based on the optimal position, the spatial transformation parameters including at least translation; and performing an affine transformation on the first image based on the spatial transformation parameters to align the first image with the preset standard image to obtain the second image.

[0083] Geometric correction is a process of geometrically correcting the second image using feature point matching and the inverse operation of perspective transformation. The corrected target image is spatially aligned with the preset standard image, and the same component is positioned consistently in both images. This improves image quality and provides high-quality input data for subsequent defect detection. Specifically, feature points and corresponding descriptors are extracted from the preset standard image and the second image, respectively. A feature point matching algorithm is used to find corresponding points in the second image that match the feature points in the preset standard image. Feature point matching algorithms include, but are not limited to, BFMatcher or FLANN. Based on the matched feature point pairs, the homography matrix is ​​calculated using the RANSAC algorithm. The homography matrix is ​​used to map the second image to the coordinate system of the preset standard image. The inverse operation of perspective transformation is then performed on the second image using the homography matrix to obtain the target image.

[0084] In this embodiment, when the target vehicle to which the vehicle under test belongs passes through the image acquisition area, the image acquisition area is controlled to acquire a first image of the vehicle under test and the target speed of the target vehicle passing through the image acquisition area is obtained. When the target speed is inconsistent with the preset speed, the first image is transformed using the preset standard image of the vehicle under test to obtain a second image. The second image is then geometrically corrected using the preset standard image to obtain a target image. The target image and the preset standard image include at least one identical component. The position of the identical component in the target image is consistent with its position in the preset standard image. This can eliminate image spatial distortion caused by speed deviation, improve component position consistency, ensure that the positions of the identical components in the two images are strictly aligned, and improve the quality of the target image.

[0085] In one embodiment, the method further includes:

[0086] Identify the matching coincident positions in the first and second positions, the non-matching non-coincident positions in the first and second positions, and the third position of the target component with the defect; the non-coincident position exists in the first position but not in the second position;

[0087] Position labeling is performed based on overlapping positions, non-overlapping positions, and third positions.

[0088] Here, an overlapping position refers to a position in the first position and the second position that is completely identical or whose distance is less than a first preset distance. A non-overlapping position is a position in the first position and the second position that is inconsistent or whose distance is greater than a second preset distance. The first preset distance is less than the second preset distance.

[0089] When identifying the defective target component from the key components, the third position of each target component can also be obtained. Therefore, the third position of the defective target component can be directly determined here.

[0090] Location annotation is the process of labeling locations within an image. The image used for location annotation can be a single target image of the vehicle under test, or a panoramic image composed of target images of all the vehicles under test.

[0091] The markings of overlapping, non-overlapping, and third positions in the image may or may not be the same.

[0092] In this embodiment, by determining the matching overlapping positions in the first and second positions, the non-matching non-overlapping positions in the first and second positions, and the third position of the defective target component, the location is marked based on the overlapping positions, non-overlapping positions, and the third position. This allows the user to directly determine the location of the defect through the marked positions.

[0093] In one embodiment, location labeling based on overlapping locations, non-overlapping locations, and a third location includes:

[0094] By stitching together the target images of each vehicle under test, a panoramic image of the target vehicle is obtained.

[0095] In the panoramic image, use a first label to mark non-overlapping locations, use a second label to mark overlapping locations, and use a third label to mark third locations;

[0096] Displays a panoramic image with location annotations.

[0097] The first, second, and third identifiers are all inconsistent.

[0098] The location-marked panoramic image can be displayed on a screen connected to the server.

[0099] In this embodiment, a panoramic image of the target vehicle is obtained by stitching together the target images of each vehicle under test. In the panoramic image, a first marker is used to mark non-overlapping positions, a second marker is used to mark overlapping positions, and a third marker is used to mark third positions. The panoramic image with marked positions is displayed, which can directly guide maintenance personnel to quickly find and handle problems from the panoramic image, reduce search time, and improve work efficiency.

[0100] In one embodiment, the method further includes:

[0101] Based on non-overlapping locations, output the first warning information;

[0102] Based on the overlapping positions, output a second early warning message;

[0103] Based on the third location, a third warning message is output; the warning level of the third warning message is higher than that of the second warning message, and the warning level of the second warning message is higher than that of the first warning message.

[0104] Specifically, when there are non-overlapping positions, the first warning information is output; when there are overlapping positions, the second warning information is output; and when there are third positions, the third warning information is output.

[0105] The output formats of the first, second, and third warning messages include, but are not limited to, sound, light, and pop-ups. The output formats of the first, second, and third warning messages can be the same or different. When the output formats of the first, second, and third warning messages are the same, the specific presentation of the warning message will differ. For example, if the output format of the first, second, and third warning messages is light, then the first warning message could be red light, the second warning message could be yellow light, and the third warning message could be blue light. Another example is that the output format of the first warning message is light, the output format of the second warning message is sound, and the output format of the third warning message is a pop-up.

[0106] In some embodiments, if a third warning message is output, indicating that the vehicle under test has a serious defect, the server will automatically generate an emergency work order to ensure that maintenance personnel can respond immediately; if a second warning message is output, indicating that the vehicle under test has a moderate defect, a maintenance work order will be generated after manual confirmation, and a maintenance plan will be arranged; if a first warning message is output, indicating that the vehicle under test has a general defect, the server will generate a task list to be reviewed, which maintenance personnel will focus on during subsequent inspections, thereby achieving accurate and efficient management of different levels of faults and defects.

[0107] In this embodiment, a first warning message is output based on a non-overlapping location, a second warning message is output based on an overlapping location, and a third warning message is output based on a third location. The warning level of the third warning message is higher than that of the second warning message, and the warning level of the second warning message is higher than that of the first warning message. This enables precise and efficient management of faults and defects of different levels.

[0108] In one embodiment, step S2 includes:

[0109] Acquire a preset standard image of the vehicle under test;

[0110] Calculate the grayscale difference of the same pixel between the target image and the preset standard image;

[0111] The grayscale difference of each pixel is compared with a preset threshold. The position of the pixel whose grayscale difference is greater than or equal to the preset threshold is determined as the first position of the defect in the target image.

[0112] The preset standard image is a defect-free reference image.

[0113] The same pixel refers to a pixel in the target image and a preset standard image that represents the same thing. For example, if pixel A in the target image and pixel B in the preset standard image represent the same thing, then pixel A and pixel B are the same pixel. In this case, the grayscale difference between pixel A and pixel B is calculated. The grayscale difference is essentially the pixel difference.

[0114] In some embodiments, if the preset standard image and / or the target image are color images, the color images are converted into grayscale images, and then the grayscale difference is calculated based on the converted target image and the preset standard image.

[0115] In some embodiments, the grayscale difference of each pixel can form a grayscale difference image, and the grayscale difference image is subjected to denoising and missing filling processing. The grayscale difference of each pixel in the grayscale difference image is compared with a preset threshold, and the position of the pixel whose grayscale difference is greater than or equal to the preset threshold is determined as the first position of the defect in the target image.

[0116] In this embodiment, by acquiring a preset standard image of the vehicle under test, calculating the grayscale difference of the same pixel in the target image and the preset standard image, comparing the grayscale difference of each pixel with a preset threshold, and determining the position of the pixel whose grayscale difference is greater than or equal to the preset threshold as the first position of the defect in the target image, the accuracy and reliability of defect detection can be improved.

[0117] To better illustrate the specific implementation methods of this application, in conjunction with Figure 3 The diagram showing the defect detection system architecture illustrates the surface defect detection method for rail vehicles according to this application, using a typical defect detection method for a key component (such as a bogie) in a target vehicle as an example. The specific implementation is as follows:

[0118] (1) Image Acquisition and Preprocessing: The trackside 360 ​​system was used to acquire omnidirectional image data of the vehicle under test. The trackside 360 ​​system uses high-definition cameras installed on both sides of the track to capture images of the target vehicle from multiple angles, obtaining images of the roof, bottom, body, and bogie, where the bogie includes the wheel hub area and its horizontal area below the body. The acquired images were preprocessed, including noise reduction, contrast enhancement, and sharpening, to improve image quality. The preprocessed images will be used as input data for subsequent detection algorithms. Since the target speed of the vehicle under test when passing through the image acquisition area is difficult to be completely consistent with the preset speed, there is an offset between the acquired first image and the preset standard image. Therefore, a stable template area is selected from the preset standard image; the template matching algorithm is used to search for the best position in the first image that matches the template area; the spatial transformation parameters of the first image relative to the preset standard image are calculated based on the best position; the first image is affinely transformed based on the spatial transformation parameters to align the first image with the preset standard image to obtain the second image; the second image is geometrically corrected using the preset standard image to obtain the target image.

[0119] (2) First-stage defect localization: A gray-scale difference method is introduced to detect defects in the target image of the vehicle under test, obtaining the first location of the defect in the target image. Based on the first location and the size of the defect sub-image, defect sub-images corresponding to each first location are cropped from the target image. Specifically, the gray-scale difference of the same pixel in the target image and the preset standard image is calculated. The gray-scale difference of each pixel is compared with a preset threshold. The location of the pixel whose gray-scale difference is greater than or equal to the preset threshold is determined as the first location of the defect in the target image. In addition, traditional image processing techniques, such as filtering and morphological operations (erosion, dilation, etc.), are combined to process the gray-scale difference image formed by the gray-scale difference, effectively removing noise and filling missing areas, further improving the accuracy and robustness of defect detection. This method not only improves the detection sensitivity but also optimizes the computational efficiency, providing a more accurate defect identification method for intelligent operation and maintenance of rail vehicles.

[0120] (3) Second-stage defect identification: Based on the initial screening in the first stage, YOLO target detection and segmentation algorithms are introduced to accurately identify and locate key components (such as air springs, primary springs, axle box covers, grounding devices, shock absorbers, etc.) in the defect sub-image. The second position of the key component is defined by the target detection and segmentation algorithms, and the component image of the key component is cropped and saved to the temporary directory of the server. This provides prior information for subsequent defect detection, thereby greatly improving the efficiency and accuracy of the detection process. This process not only ensures efficient positioning of the detection area, but also provides clear component images for subsequent defect analysis, greatly improving the efficiency and accuracy of the defect detection process.

[0121] (4) Third-stage defect analysis: For the component images cut out in the second stage, deep learning or image analysis methods are used to perform defect analysis. The texture, shape and other features in the images are analyzed in detail to accurately identify abnormalities such as missing parts, loose parts, and oil leaks, and to generate detailed defect reports to support maintenance decisions.

[0122] (5) Graded processing of abnormal results: Identify the matching overlapping positions in the first and second positions, the non-matching non-overlapping positions in the first and second positions, and the third position of the target component with defects; the non-overlapping position exists in the first position but not in the second position; based on the non-overlapping position, output the first warning information; based on the overlapping position, output the second warning information; based on the third position, output the third warning information; the warning level of the third warning information is higher than the warning level of the second warning information, and the warning level of the second warning information is higher than the warning level of the first warning information. The graded warning method is shown in Table 1.

[0123]

[0124] The system outputs a third warning message, immediately triggering an audible and visual alarm to notify maintenance personnel for emergency response; a second warning message, a system pop-up alert requiring manual confirmation and recording; and a first warning message, generating a pending task prompting manual review of the discrepancy sub-image. Preset thresholds are adjusted based on the sensitivity requirements for early anomaly detection and fault diagnosis.

[0125] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0126] Based on the same inventive concept, this application also provides a surface defect detection device for rail vehicles to implement the surface defect detection method for rail vehicles described above. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of one or more embodiments of the surface defect detection device for rail vehicles provided below can be found in the limitations of the surface defect detection method for rail vehicles described above, and will not be repeated here.

[0127] In one embodiment, such as Figure 4 As shown, a surface defect detection device for rail vehicles is provided, comprising:

[0128] The data acquisition module is used to acquire the target image of the vehicle under test and the preset defect sub-image size;

[0129] The first location recognition module is used to identify the first location of the defect in the target image, and based on the first location and the size of the defect sub-image, to crop the defect sub-image corresponding to each first location from the target image;

[0130] The second location recognition module is used to identify the second location of the key component of the vehicle under test from each of the defect sub-images, and to crop the component image of the key component from the defect sub-image based on the second location;

[0131] The type determination module is used to determine, based on the component image, the target component with defects in each of the key components and the type of defect in the target component.

[0132] Each module in the aforementioned surface defect detection device for rail vehicles can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0133] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores target images, defect sub-image dimensions, first locations, defect sub-images, second locations, component images, target components, and defect types of the target components. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a surface defect detection method for rail vehicles.

[0134] Those skilled in the art will understand that Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0135] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0136] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0137] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0138] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0139] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0140] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for detecting surface defects in rail vehicles, characterized in that, The method includes: S1. Obtain the target image of the vehicle under test and the preset defect sub-image size; S2. Identify the first location of the defect in the target image, and based on the first location and the size of the defect sub-image, crop the defect sub-image corresponding to each first location from the target image; S3. Identify the second location of the key component of the vehicle under test from each of the defect sub-images, and crop the component image of the key component from the defect sub-images based on the second location; S4. Based on the component images, determine the target components with defects in each of the key components and the defect types of the target components.

2. The method according to claim 1, characterized in that, The process of acquiring the target image in step S1 includes: When the target vehicle to which the vehicle under test belongs passes through the image acquisition area, the image acquisition area is controlled to acquire the first image of the vehicle under test, and the target speed of the target vehicle passing through the image acquisition area is obtained. When the target speed is inconsistent with the preset speed, the first image is transformed using the preset standard image of the vehicle under test to obtain the second image; The second image is geometrically corrected using the preset standard image to obtain the target image; the target image and the preset standard image include at least one identical component, and the position of the identical component in the target image is consistent with its position in the preset standard image.

3. The method according to claim 1, characterized in that, The method further includes: Identify the matching overlapping positions between the first and second positions, the non-matching non-overlapping positions between the first and second positions, and the third position of the defective target component; the non-overlapping position exists in the first position but not in the second position; Position marking is performed based on the overlapping position, the non-overlapping position, and the third position.

4. The method according to claim 3, characterized in that, The location annotation based on the overlapping position, the non-overlapping position, and the third position includes: By stitching together the target images of each of the vehicles under test, a panoramic image of the target vehicle is obtained. In the panoramic image, a first identifier is used to mark the non-overlapping positions, a second identifier is used to mark the overlapping positions, and a third identifier is used to mark the third positions; The panoramic image is displayed with its location labeled.

5. The method according to claim 3, characterized in that, The method further includes: Based on the non-overlapping positions, output the first warning information; Based on the overlapping positions, a second early warning message is output; Based on the third location, a third warning message is output; the warning level of the third warning message is higher than the warning level of the second warning message, and the warning level of the second warning message is higher than the warning level of the first warning message.

6. The method according to claim 1, characterized in that, Step S2 includes: Acquire a preset standard image of the vehicle under test; Calculate the grayscale difference between the target image and the preset standard image for the same pixel. The grayscale difference of each pixel is compared with a preset threshold, and the position of the pixel whose grayscale difference is greater than or equal to the preset threshold is determined as the first position of the defect in the target image.

7. A surface defect detection device for rail vehicles, characterized in that, The device includes: The data acquisition module is used to acquire the target image of the vehicle under test and the preset defect sub-image size; The first location recognition module is used to identify the first location of the defect in the target image, and based on the first location and the size of the defect sub-image, to crop the defect sub-image corresponding to each first location from the target image; The second location recognition module is used to identify the second location of the key component of the vehicle under test from each of the defect sub-images, and to crop the component image of the key component from the defect sub-image based on the second location; The type determination module is used to determine, based on the component image, the target component with defects in each of the key components and the type of defect in the target component.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.