Metal part surface defect detection method, system, equipment and medium
Through the combination of a preset defect detection model and a high-resolution camera, the problem of insufficient detection of micro defects on the surface of metal parts is solved, and efficient and comprehensive detection of surface defects of metal parts is achieved, especially the accurate identification of end face bump defects with higher frequency.
Patent Information
- Application Number
- CN202510473416.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, the micro defects on the surface of metal parts are not sufficiently detected and are prone to missed inspection. Especially during manual inspection, it is difficult to find extremely small bruises, and the defect types are not comprehensive, so the surface textures and tiny protrusions cannot be effectively judged.
The preset defect detection model is adopted, including the preset end face defect detection sub-model, the preset side defect detection sub-model and the preset prompt word detection sub-model. By obtaining the original surface image and area identification images of the metal parts, the obvious bump, bump and non-bump defect status are divided, and priority detection is performed. Combined with the blue dome light source and high-resolution camera shooting, Fasterrcnn and Double-RCNN structures are used for feature extraction and defect judgment.
The efficiency and detection rate of surface defect detection of metal parts are improved, and comprehensive detection of micro defects is achieved to ensure zero miss inspection, especially the accurate identification of end-face damage defects with higher frequency.
Smart Images

Figure CN120339248A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of surface detection, and particularly to a method, system, device and medium for detecting surface defects of metal parts. Background Art
[0002] The surfaces of industrial metal parts are prone to reflect light and are interfered by stains, rust, etc., resulting in difficult image acquisition and poor image quality. In addition, industrial parts come in various sizes. Small-sized parts account for a low proportion in the image, and at the same time, the defective area accounts for an extremely small proportion. In the industrial quality inspection scenario, the features of the targets to be detected in the image are not prominent enough, and are easily lost in the image scaling and feature extraction processes, making it difficult to control the false negative rate of the defect detection model, and ultimately resulting in poor implementation effects of the algorithm deployment.
[0003] Taking the compressor piston as an example, the compressor piston is a common industrial metal part and an important component in the compressor. At present, the surface defects of the piston are detected manually. The main problems in this detection scenario are as follows: (1) The amount of surface defect detection of the piston is large (about tens of thousands of pieces per day), the manual detection intensity is high, each person needs to detect tens of thousands of parts per day, work continuously for a long time, and needs to work day and night shifts for detection; (2) The impact defects on the piston surface are extremely small (for example, about 10 microns), there is a risk of missed detection by the human eye, and it is necessary to view with a magnifying glass under strong light, which causes certain damage to the human eye; (3) Although the impact defects are extremely small, the material transfer on the surface of the piston part caused by them (that is, small surface protrusions) will cause damage to the steel cover (the steel cover is tightly fitted with the piston part), thus affecting the operation of the compressor, and it is very difficult to detect the extremely small surface protrusions through manual detection. When detecting manually, it is necessary to use the steel cover to assist in judging whether the small surface protrusions will affect the operation of the compressor; (4) In addition to the impact defects, the defects that need to be detected on the piston surface also include various types such as sand holes, cluster sands, and unground areas.
[0004] The existing technologies usually detect small protrusion defects on the surface of metal parts, and there is no technical solution for detecting extremely small protrusion defects on the surface of metal parts. In some detection scenarios, it is impossible to determine whether the defect is the original texture, color difference or surface micro protrusion of the part surface, and missed detection is likely to occur. The detection of micro defects on the surface of metal parts in the existing technologies is not sufficient, especially for the end face impact defects that are easily missed by manual visual inspection (such as the small protrusion features caused by a small amount of material transfer at the edge of the part are not obvious, etc.), and it is impossible to detect defects with a low occurrence frequency, and the types of defect detection are not comprehensive; Therefore, there is an urgent need for a new detection solution for micro defects on the surface of industrial metal parts, especially a technical solution for detecting end face impact defects with a high defect incidence rate. Summary of the Invention
[0005] The technical problem to be solved by the present disclosure is to overcome the deficiencies in the prior art, such as insufficient detection of surface micro-defects of metal parts, incomplete types of defect detection, and easy occurrence of missed detections, and to provide a method, system, device, and medium for detecting surface defects of metal parts.
[0006] The present disclosure solves the above technical problems through the following technical solutions:
[0007] In the first aspect, a method for detecting surface defects of metal parts is provided. The detection method includes:
[0008] Obtain the original surface image of the metal part to be detected;
[0009] Obtain the region recognition image corresponding to the original surface image;
[0010] Wherein, the region recognition image represents the region position of the metal part to be detected in the original surface image;
[0011] Input the region recognition image into a preset defect detection model to determine the surface defect state of the metal part to be detected, and determine whether there are surface defects on the metal part to be detected and the defect type of the surface defects according to the surface defect state;
[0012] Wherein, the surface defect state includes an obvious bruise defect state, a to-be-confirmed bruise defect state, and a non-bruise defect state. Different surface defect states correspond to different detection priorities. The preset defect detection model includes a preset end-face defect detection sub-model, a preset side-face defect detection sub-model, and a preset prompt-word detection sub-model.
[0013] Optionally, the detection priorities of the obvious bruise defect state, the to-be-confirmed bruise defect state, and the non-bruise defect state decrease in sequence;
[0014] And / or, the detection method further includes:
[0015] After determining that there are surface defects on the metal part to be detected, output the position of the surface defects in the region recognition image;
[0016] And / or, the step of obtaining the region recognition image corresponding to the original surface image includes:
[0017] Input the original surface image and the part description language corresponding to the metal part to be detected into a preset region recognition model, and output the region recognition image corresponding to the original surface image;
[0018] And / or, the original surface image includes an original end-face image, and the region recognition image includes an end-face region recognition image corresponding to the original end-face image;
[0019] The steps of obtaining the original surface image of the metal part to be detected include:
[0020] Irradiate the metal part to be detected with a blue dome surface light source, and use a black-and-white area array camera with a first preset resolution and a telecentric lens to capture the end face of the metal part to be detected, so as to obtain the original end face image;
[0021] The steps of inputting the original surface image and the part description corresponding to the metal part to be detected into a preset region recognition model and outputting the region recognition image corresponding to the original surface image include:
[0022] Input the original end face image and the part description corresponding to the metal part to be detected into the preset region recognition model, and output the end face region recognition image;
[0023] And / or, the original surface image includes an original side image, and the region recognition image includes a side region recognition image corresponding to the original side image;
[0024] The steps of obtaining the original surface image of the metal part to be detected include:
[0025] Irradiate the metal part to be detected with a blue dome linear light source, and use a black-and-white linear array camera with a second preset resolution and a linear array lens to capture the side of the metal part to be detected, so as to obtain the original side image;
[0026] The steps of inputting the original surface image and the part description corresponding to the metal part to be detected into a preset region recognition model and outputting the region recognition image corresponding to the original surface image include:
[0027] Input the original side image and the part description corresponding to the metal part to be detected into the preset region recognition model, and output the side region recognition image.
[0028] Optionally, the region recognition image includes an end face region recognition image;
[0029] The steps of inputting the region recognition image into a preset defect detection model, determining the surface defect state of the metal part to be detected, and determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state include:
[0030] Input the end face region recognition image into the preset end face defect detection sub-model, and output the surface defect state of the metal part to be detected;
[0031] Determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state;
[0032] Or, determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state and the preset side defect detection sub-model;
[0033] Or, determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state and the preset prompt word detection sub-model.
[0034] Optionally, the step of determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state includes:
[0035] If the surface defect state is the obvious bruise defect state, it is determined that there is a surface defect on the metal part to be detected, and the defect type of the surface defect is an end face bruise defect;
[0036] Or, if the surface defect state is the non-bruise defect state, obtain the defect prompt word corresponding to the end face area recognition image;
[0037] Input the end face area recognition image and the corresponding defect prompt word into the preset prompt word detection sub-model, and judge whether there is a non-bruise surface defect on the metal part to be detected and the defect type of the non-bruise surface defect.
[0038] Optionally, the area recognition image further includes a side area recognition image;
[0039] The step of determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state includes:
[0040] If the surface defect state is the to-be-confirmed bruise defect state, obtain the side area recognition image of the metal part to be detected;
[0041] Use the sliding window technique to segment the side area recognition image to obtain a plurality of window area recognition images;
[0042] Input each of the window area recognition images and the side area recognition image into the preset side defect detection sub-model, and judge whether there is a surface defect on the metal part to be detected and whether the defect type of the surface defect is an end face bruise defect.
[0043] Optionally, the preset end face defect detection sub-model is trained based on the Fasterrcnn (a deep learning model for object detection) model;
[0044] The preset end-face defect detection sub-model includes a CNN (Convolutional Neural Network) network, an RPN (Region Proposal Network) network, an ROI Pooling (Region of Interest Pooling) network, and an ROI Head (Region of Interest Head) network connected in sequence;
[0045] The CNN network is used to receive the end-face region recognition image and generate an initial end-face image feature map corresponding to the end-face region recognition image;
[0046] The RPN network is used to generate end-face candidate regions based on the initial end-face image feature map;
[0047] The ROI Pooling network is used to map the end-face candidate regions to the initial end-face image feature map and generate an end-face target feature map of a preset size;
[0048] The ROI Head network is used to process the end-face target feature map based on the Double-RCNN structure and output the surface defect state;
[0049] And / or, the preset prompt word detection sub-model is trained based on a visual detection model.
[0050] Optionally, the preset side-face defect detection sub-model is trained based on the Fasterrcnn model;
[0051] The preset side-face defect detection sub-model includes a CNN network, an RPN network, an ROI Pooling network, an ROIHead network, and a non-maximum suppression network;
[0052] The CNN network is used to receive the window region recognition image and generate an initial window image feature map corresponding to the window region recognition image. The CNN network is also used to receive the side-face region recognition image and generate a side-face initial image feature map corresponding to the side-face region recognition image;
[0053] The RPN network is used to generate window candidate regions based on the initial window image feature map and generate side-face candidate regions based on the side-face initial image feature map;
[0054] The ROI Pooling network is used to map the window candidate regions to the initial window image feature map and generate a window target feature map of a preset size. The ROI Pooling network is also used to map the side-face candidate regions to the side-face initial image feature map and generate a side-face target feature map of a preset size;
[0055] The ROI Head network is used to process the window target feature map based on the Double-RCNN structure, output the states of each subsurface defect, and process the side target feature map to output the side defect state;
[0056] The non-maximum suppression network is used to merge and filter the states of each subsurface defect and the side defect state by using the non-maximum suppression technique to obtain the surface defect state.
[0057] In a second aspect, a detection system for surface defects of metal parts is provided. The detection system includes:
[0058] An original image acquisition module, configured to acquire an original surface image of a metal part to be detected;
[0059] A recognition image acquisition module, configured to acquire a region recognition image corresponding to the original surface image;
[0060] Wherein, the region recognition image represents the region position of the metal part to be detected in the original surface image;
[0061] A defect detection module, configured to input the region recognition image into a preset defect detection model, determine the surface defect state of the metal part to be detected, and determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state;
[0062] Wherein, the surface defect state includes an obvious bruise defect state, a bruise defect state to be confirmed, and a non-bruise defect state. Different surface defect states correspond to different detection priorities. The preset defect detection model includes a preset end face defect detection sub-model, a preset side face defect detection sub-model, and a preset prompt word detection sub-model.
[0063] In a third aspect, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and configured to run on the processor. When the processor executes the computer program, the detection method for surface defects of metal parts as described above is implemented.
[0064] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the detection method for surface defects of metal parts as described above is implemented.
[0065] On the basis of conforming to common general knowledge in the art, the above preferred conditions can be combined arbitrarily to obtain various preferred examples of the present disclosure.
[0066] The positive and progressive effects of the present disclosure are as follows:
[0067] The detection method, system, device and medium for surface defects of metal parts according to the present disclosure obtain the original surface image of the metal part to be detected and the region recognition image corresponding to the original surface image, input the region recognition image into a preset defect detection model to determine the surface defect state of the metal part to be detected, and determine whether there are surface defects and the defect types of the surface defects of the metal part to be detected according to the surface defect state; by classifying the surface defect state, an obvious bruise defect state, a to-be-confirmed bruise defect state and a non-bruise defect state are classified, and different surface defect states correspond to different detection priorities, so that defects with a higher occurrence frequency can be preferentially detected, improving the detection efficiency; since the preset defect detection model includes a preset end face defect detection sub-model, a preset side face defect detection sub-model and a preset prompt word detection sub-model, it can be used in combination according to the detection needs, and can comprehensively and fully detect surface micro-defects, improving the defect detection rate and achieving zero missed detection. Description of the Drawings
[0068] Figure 1 It is the first process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0069] Figure 2 It is the second process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0070] Figure 3 It is the third process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0071] Figure 4 It is the fourth process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0072] Figure 5 It is the fifth process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0073] Figure 6 It is the sixth process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0074] Figure 7 It is the seventh process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0075] Figure 8 It is the eighth process flow chart of the detection method for surface defects of metal parts provided by Embodiment 1 of the present disclosure;
[0076] Figure 9 It is a schematic diagram of the types of surface defects of a compressor piston provided by Embodiment 1 of the present disclosure;
[0077] Figure 10 The detection effect diagram of the surface defect of the compressor piston provided in Embodiment 1 of the present disclosure in the end face area recognition image;
[0078] Figure 11 For the same surface defect corresponding to the compressor piston provided in Embodiment 1 of the present disclosure, Figure 10 the detection effect in the side area recognition image;
[0079] Figure 12 The structural schematic diagram of the detection system for the surface defect of the metal part provided in Embodiment 2 of the present disclosure;
[0080] Figure 13 The structural schematic diagram of the electronic device provided in Embodiment 3 of the present disclosure. Specific Embodiments
[0081] The present disclosure will be further described below by way of embodiments, but the present disclosure is not limited to the scope of the described embodiments.
[0082] In the embodiments of the present disclosure, prefix words such as "first" and "second" are only used to distinguish different described objects, and have no limiting effect on the position, order, priority, quantity or content of the described objects. The use of ordinal numbers and other prefix words for distinguishing described objects in the embodiments of the present disclosure does not constitute a limitation on the described objects. The statements of the described objects refer to the descriptions in the context of the embodiments, and should not constitute unnecessary limitations due to the use of such prefix words. In addition, in the description of this embodiment, unless otherwise specified, the meaning of "a plurality" is two or more.
[0083] Embodiment 1
[0084] This embodiment provides a method for detecting surface defects of metal parts. As Figure 1 shown, the detection method includes:
[0085] S1. Obtain the original surface image of the metal part to be detected.
[0086] S2. Obtain the area recognition image corresponding to the original surface image.
[0087] S3. Input the area recognition image into a preset defect detection model, determine the surface defect state of the metal part to be detected, and determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state.
[0088] Among them, the region recognition image represents the region position of the metal part to be detected in the original surface image; the surface defect state includes an obvious bruise defect state, a bruise defect state to be confirmed, and a non-bruise defect state. Different surface defect states correspond to different detection priorities. The preset defect detection model includes a preset end face defect detection sub-model, a preset side face defect detection sub-model, and a preset prompt word detection sub-model.
[0089] The bruise defect can also be called a surface protrusion defect, and the original surface image is the image obtained by shooting the metal part to be detected with a shooting tool.
[0090] In the present disclosure, the square root of the ratio of the micro defect to the original surface image is only 0.312% (if the ratio is less than 3%, it is a micro target), and the detection of surface micro defects can be realized.
[0091] In this embodiment, by classifying the surface defect states, the obvious bruise defect state, the bruise defect state to be confirmed, and the non-bruise defect state are classified. Different surface defect states correspond to different detection priorities, and defects with a higher occurrence frequency can be preferentially detected, improving the detection efficiency; since the preset defect detection model includes a preset end face defect detection sub-model, a preset side face defect detection sub-model, and a preset prompt word detection sub-model, they can be used in combination according to the detection needs, and the surface micro defects can be detected comprehensively and fully, improving the defect detection rate and achieving zero missed detection.
[0092] In an alternative embodiment, the detection priorities of the obvious bruise defect state, the bruise defect state to be confirmed, and the non-bruise defect state decrease in sequence.
[0093] The obvious bruise defect state corresponds to defects with a higher occurrence frequency, so the detection priority of the obvious bruise defect state is the highest; the non-bruise defect state corresponds to defects with a lower occurrence frequency, so the detection priority of the obvious bruise defect state is the lowest; the bruise defect state to be confirmed can also be called a suspected bruise defect state, that is, it cannot be directly determined whether there is a bruise defect and further detection is required. The bruise defect state to be confirmed corresponds to defects with a medium occurrence frequency, so the detection priority of the bruise defect state to be confirmed is between the obvious bruise defect state and the non-bruise defect state.
[0094] In this embodiment, by classifying the surface defect states, the obvious bruise defect state, the bruise defect state to be confirmed, and the non-bruise defect state are classified. The detection priorities of the obvious bruise defect state, the bruise defect state to be confirmed, and the non-bruise defect state decrease in sequence, and the obvious bruise defect with a higher occurrence frequency can be preferentially detected, improving the detection efficiency.
[0095] In an alternative embodiment, such as Figure 2As shown, the method for detecting surface defects of metal parts further includes:
[0096] S4. After determining that the metal part to be detected has surface defects, output the position of the surface defects in the region recognition image.
[0097] After determining that the metal part to be detected has surface defects, frame the surface defects in the region recognition image, so that the user can know the position of the surface defects in the region recognition image, improving the user experience.
[0098] In an optional embodiment, as Figure 3 shown, the above step S2 includes:
[0099] S21. Input the original surface image and the part description corresponding to the metal part to be detected into a preset region recognition model, and output the region recognition image corresponding to the original surface image.
[0100] The preset region recognition model can also be called a cropped part region large model or an open-set object detection model based on text prompts or an open-set object detection model based on visual prompts or a multimodal large language model.
[0101] The preset region recognition model belongs to an existing mature model for region recognition and cropping; the part description can also be called open vocabulary, which represents the description of the part, facilitating the preset region recognition model to identify the region where the part is located. By giving open vocabulary to identify the part region, zero-shot localization of the part region is realized, and the part region is cropped to eliminate background interference, and at the same time, the proportion of surface defects in the image is also increased. This method is more general than the traditional machine vision method that needs to adjust the threshold according to the ambient light, while methods such as YOLO (You Only Look Once: Unified, Real-Time Object Detection, an object detection method based on a single neural network) and Fasterrcnn need to collect a large number of samples for model training. The preset region recognition model does not need to be trained and can directly identify the part region with zero samples, identify and crop the part region in the original surface image to obtain the region recognition image.
[0102] In an optional embodiment, the original surface image includes an original end face image, and the region recognition image includes an end face region recognition image corresponding to the original end face image; as Figure 4 shown, the above step S1 includes:
[0103] S11. Irradiate the metal part to be detected with a blue dome surface light source, and use a black and white area array camera with a first preset resolution and a telecentric lens to photograph the end face of the metal part to be detected to obtain an original end face image;
[0104] The above step S2 includes:
[0105] S21. Input the original end face image and the part description corresponding to the metal part to be detected into the preset area recognition model, and output the end face area recognition image.
[0106] In an optional embodiment, the original surface image includes the original side image, and the area recognition image includes the side area recognition image corresponding to the original side image; as Figure 5 shown, the above step S1 includes:
[0107] S12. Irradiate the metal part to be detected with a blue dome line light source, and use a black and white line array camera and a line array lens with a second preset resolution to capture the side of the metal part to be detected, obtaining the original side image;
[0108] The above step S2 includes:
[0109] S22. Input the original side image and the part description corresponding to the metal part to be detected into the preset area recognition model, and output the side area recognition image.
[0110] The surface of the metal part mainly refers to the upper end face, the lower end face and the outer diameter. Among them, the upper end face and the lower end face are collectively referred to as the end face. The original end face image is the image corresponding to the end face of the metal part to be detected, and the original side image is the image corresponding to the side of the metal part to be detected.
[0111] Due to problems such as high reflectivity, rust, and small pits on the surface of the metal part, by using a suitable light source and camera for illumination and shooting, a clear original image is obtained, so that the detected metal part can be clearly distinguished from the background as much as possible. The original image with high quality and high contrast helps to improve the accuracy and speed of image processing and simplifies the algorithm difficulty.
[0112] Since the blue light has a short wavelength and strong energy, it can penetrate the metal surface, thereby reducing reflection. In addition, the blue light can form a good contrast on the metal surface, making the defects more obvious; the dome light source can retain the original features of the object surface and edge contour, and the lamp beads in the dome light source emit from the inner wall of the bowl, and the light emitted will make the object surface show very uniformly, which has a good effect on defect detection of high-reflective objects such as the metal surface. Therefore, a blue dome surface light source can be used to irradiate the end face of the metal part to be detected, and a black and white area array camera and a telecentric lens with a first preset resolution are used for shooting to obtain an original end face image with extremely high imaging quality; a blue dome line light source is used to irradiate the side of the metal part to be detected, and a black and white line array camera and a line array lens with a second preset resolution are used for shooting to obtain an original side image with extremely high imaging quality.
[0113] Specifically, the black and white area array camera with the first preset resolution can be an industrial black and white high-resolution area array camera with 20 million pixels, and the black and white line array camera with the second preset resolution can be a 4K industrial black and white high-resolution line array camera. The first preset resolution and the second preset resolution can be adjusted according to actual needs.
[0114] In an alternative embodiment, the region recognition image includes an end face region recognition image; as Figure 6 shown, the above step S3 includes:
[0115] S31. Input the end face region recognition image into a preset end face defect detection sub-model, and output the surface defect state of the metal part to be detected.
[0116] S32. Based on the surface defect state, determine whether the metal part to be detected has surface defects and the defect type of the surface defects.
[0117] Since defects are likely to occur on its end face, the detection of end face defects is particularly important.
[0118] In this embodiment, the end face region recognition image is input into a preset end face defect detection sub-model, and the surface defect state of the metal part to be detected is output. Furthermore, based on the surface defect state, it is determined whether the metal part to be detected has surface defects and the defect type of the surface defects.
[0119] In an alternative embodiment, the region recognition image includes an end face region recognition image; as Figure 6 shown, the above step S3 includes:
[0120] S31. Input the end face region recognition image into a preset end face defect detection sub-model, and output the surface defect state of the metal part to be detected.
[0121] S33. Based on the surface defect state and a preset side face defect detection sub-model, determine whether the metal part to be detected has surface defects and the defect type of the surface defects.
[0122] In this embodiment, the end face region recognition image is input into a preset end face defect detection sub-model, and the surface defect state of the metal part to be detected is output. Furthermore, based on the surface defect state and a preset side face defect detection sub-model, it is determined whether the metal part to be detected has surface defects and the defect type of the surface defects.
[0123] In an alternative embodiment, the region recognition image includes an end face region recognition image; as Figure 6 shown, the above step S3 includes:
[0124] S31. Input the end face region recognition image into a preset end face defect detection sub-model, and output the surface defect state of the metal part to be detected.
[0125] S34. Determine whether there are surface defects and the defect types of the surface defects on the metal part to be detected based on the surface defect status and the preset prompt word detection sub-model.
[0126] In this embodiment, the end face area recognition image is input into the preset end face defect detection sub-model, and the surface defect status of the metal part to be detected is output. Furthermore, based on the surface defect status and the preset prompt word detection sub-model, it is determined whether there are surface defects and the defect types of the surface defects on the metal part to be detected.
[0127] In an alternative embodiment, as Figure 7 shown, the above step S32 includes:
[0128] S321. If the surface defect status is an obvious bruise defect status, it is determined that there are surface defects on the metal part to be detected, and the defect type of the surface defect is an end face bruise defect.
[0129] The obvious bruise defect status corresponds to defects with a relatively high occurrence frequency. When the surface defect status is an obvious bruise defect status, it can be determined that there is an end face bruise defect on the metal part to be detected. That is, it can be determined that there are surface defects on the metal part to be detected only through the preset end face defect detection sub-model, and the defect type of the surface defect is an end face bruise defect.
[0130] In an alternative embodiment, as Figure 7 shown, the above step S34 includes:
[0131] S341. If the surface defect status is a non-bruise defect status, obtain the defect prompt word corresponding to the end face area recognition image.
[0132] S342. Input the end face area recognition image and the corresponding defect prompt word into the preset prompt word detection sub-model, and determine whether there are non-bruise surface defects and the defect types of the non-bruise surface defects on the metal part to be detected.
[0133] The non-bruise defect status corresponds to defects with a relatively low occurrence frequency. When the surface defect status is a non-bruise defect status, it is impossible to directly determine whether there are non-bruise surface defects on the metal part to be detected only relying on the preset end face defect detection sub-model. At this time, it is necessary to further detect by combining the preset prompt word detection sub-model to determine whether there are non-bruise surface defects and the defect types of the non-bruise surface defects on the metal part to be detected.
[0134] In an alternative embodiment, the area recognition image further includes a side area recognition image. As Figure 7 shown, the above step S33 includes:
[0135] S331. If the surface defect status is the to-be-confirmed bruised defect status, obtain the recognition image of the side area of the metal part to be detected.
[0136] S332. Use the sliding window technique to segment the recognition image of the side area to obtain several window area recognition images.
[0137] S333. Input each window area recognition image and the recognition image of the side area into the preset side defect detection sub-model respectively to determine whether there is a surface defect on the metal part to be detected and whether the defect type of the surface defect is an end face bruised defect.
[0138] The recognition image of the side area is the recognition image of the area corresponding to the side of the metal part to be detected.
[0139] If the surface defect status is the to-be-confirmed bruised defect status, that is, it cannot be directly determined whether there is a bruised defect on the metal part to be detected only through the preset end face defect detection sub-model, it is necessary to combine the preset side defect detection sub-model for further detection.
[0140] In this embodiment, the gray area that is difficult to quantify and the defect with unclear defect boundary in the end face defect detection problem are classified as the to-be-confirmed bruised defect status, and the preset side defect detection sub-model is combined for secondary discrimination, the outer diameter of the part is detected, and whether there is an end face bruised defect is judged from other dimensions.
[0141] In an optional embodiment, the preset end face defect detection sub-model is trained based on the Fasterrcnn model.
[0142] The Fasterrcnn model includes the following two stages: The first stage consists of two networks, a convolutional neural network (CNN) and a region proposal network (RPN). Among them, the CNN is used to extract general features. After extracting the general features, the RPN network extracts candidate object bounding boxes based on the general features. The RPN network usually consists of a simple convolutional network and a classification and regression network; The second stage extracts features from the candidate regions from the RPN and performs class classification and bounding box regression.
[0143] Specifically, the preset end face defect detection sub-model includes a CNN network, an RPN network, an ROIPooling network, and an ROI Head network connected in sequence;
[0144] The CNN network is used to receive the recognition image of the end face area and generate an initial end face image feature map corresponding to the recognition image of the end face area;
[0145] The RPN network is used to generate end face candidate regions based on the initial end face image feature map;
[0146] The ROI Pooling network is used to map the end-face candidate regions to the end-face initial image feature map and generate an end-face target feature map with a preset size;
[0147] The ROI Head network is used to process the end-face target feature map based on the Double-RCNN structure and output the surface defect status;
[0148] Among them, the CNN is used to extract general features and output the end-face initial image feature map corresponding to the end-face region recognition image. For example, ResNet-50 can be used to extract general features.
[0149] In the CNN network, an FPN (Feature Pyramid Network) is added. As the number of network layers increases, the feature information and location information of small targets are gradually lost. The FPN network is used to fuse the low-level features and high-level features to obtain a high-resolution and strong-semantic end-face initial image feature map, which is beneficial to the detection of small targets and can also enhance the network's processing ability for different target defect scales. The RPN network generates end-face candidate regions (candidate target bounding boxes) according to the end-face initial image feature map. The RPN network is usually composed of a simple convolutional network, a classification network, and a regression network; the ROI Pooling network maps the end-face candidate regions to the end-face initial image feature map and generates an end-face target feature map with a preset size (fixed size); the original Fasterrcnn model has poor positioning ability for defect positions. Replace the Fasterrcnn detection head with a Double-RCNN dual-head structure and add a convolutional layer structure to the regression branch, which can enhance the network's ability to locate defect bounding boxes and improve the positioning accuracy of small targets; the ROI Head network performs class classification and bounding box regression on the end-face target feature map based on the Double-RCNN structure and outputs the surface defect status.
[0150] In an optional implementation manner, the preset prompt word detection sub-model is trained based on a visual detection model.
[0151] The preset prompt word detection sub-model can also be called an open-set object detection model based on visual prompt words.
[0152] Since the defect occurrence frequency corresponding to the non-bumping defect state is relatively low, it is difficult to collect a sufficient number of defective parts for model training. However, this type of defect has relatively obvious features in the image. Therefore, a defect detection method based on visual prompts is adopted, using a small number of annotated images to fine-tune the prompts without changing the weights of the existing large visual detection model, realizing cross-image reasoning. Taking the images of each type of non-bumping defect and the defect annotation prompts as the training set to train the existing large visual detection model, a preset prompt detection sub-model (which can also be called the large visual detection model of visual prompts) is obtained. Subsequently, cross-image detection and reasoning of defects can solve the problem of detecting long-tail defects with relatively low occurrence frequency and obvious features in industrial scenarios.
[0153] In an optional implementation manner, the preset side defect detection sub-model is trained based on the Fasterrcnn model.
[0154] The Fasterrcnn model includes the following two stages: The first stage consists of two networks, a convolutional neural network (CNN) and a region proposal network (RPN). Among them, the CNN is used to extract general features. After extracting the general features, the RPN network extracts candidate object bounding boxes based on the general features. The RPN network is usually composed of a simple convolutional network and a classification and regression network; The second stage extracts features from the candidate regions from the RPN and performs class classification and bounding box regression.
[0155] Specifically, the preset side defect detection sub-model includes a CNN network, an RPN network, an ROI Pooling network, an ROIHead network, and a non-maximum suppression network;
[0156] The CNN network is used to receive the window region recognition image and generate an initial window image feature map corresponding to the window region recognition image. The CNN network is also used to receive the side region recognition image and generate a side initial image feature map corresponding to the side region recognition image;
[0157] The RPN network is used to generate window candidate regions based on the initial window image feature map and generate side candidate regions based on the side initial image feature map;
[0158] The ROI Pooling network is used to map the window candidate regions to the initial window image feature map and generate a window target feature map of a preset size. The ROI Pooling network is also used to map the side candidate regions to the side initial image feature map and generate a side target feature map of a preset size;
[0159] The ROI Head network is used to process the window target feature map based on the Double-RCNN structure, output the sub-surface defect states of each part, and process the side target feature map to output the side defect state.
[0160] The non-maximum suppression network is used to merge and filter the sub-surface defect states and side defect states of each part by using the non-maximum suppression technique to obtain the surface defect state.
[0161] First, use the method of slice-assisted hyper-inference to divide the side region recognition image by the sliding window technique, divide the image into several regional sub-images, obtain several window region recognition images, and improve the image resolution; use CNN to extract general features and output the initial window image feature map corresponding to the window region recognition image, and the RPN network generates window candidate regions based on the initial window image feature map; the ROI Pooling network maps the window candidate regions to the initial window image feature map and generates a window target feature map of a preset size; the ROI Head network processes the window target feature map based on the Double-RCNN structure, outputs the sub-surface defect states of each part, and predicts each regional sub-image separately.
[0162] At the same time, the CNN network receives the side region recognition image and generates the side initial image feature map corresponding to the side region recognition image. The RPN network generates side candidate regions based on the side initial image feature map. The ROI Pooling network maps the side candidate regions to the side initial image feature map and generates a side target feature map of a preset size. The ROI Head network is used to process the side target feature map based on the Double-RCNN structure, output the side defect state, and perform inference on the entire image.
[0163] Then, merge the prediction results of each region (i.e., the sub-surface defect states of each part) and the prediction result of the entire image (i.e., the side defect state), and finally filter them with the non-maximum suppression technique to obtain the surface defect state; further improve the proportion of tiny defects in the image, thereby enhancing the detection ability of tiny defects.
[0164] The following combines Figure 8 , and further elaborates on the working principle of the present disclosure:
[0165] First, obtain the original end face image of the metal part to be detected, input the original end face image into a preset region recognition model for recognition and cropping, output the end face region recognition image, and input the end face region recognition image into a preset end face defect detection sub-model to determine the surface defect state of the metal part to be detected.
[0166] If the surface defect state is an obvious bruised defect state, it is determined that the metal part to be detected has a surface defect, belongs to a defective part, and the defect type of the surface defect is an end face bruised defect;
[0167] If the surface defect state is a non-bruised defect state, obtain the defect prompt word corresponding to the end face area recognition image; input the end face area recognition image and the corresponding defect prompt word into the preset prompt word detection sub-model to determine whether the metal part to be detected has a non-bruised surface defect and the defect type of the non-bruised surface defect; if there is a non-bruised surface defect, it is determined that the metal part to be detected has a surface defect, belongs to a defective part, and output the defect type; if there is no non-bruised surface defect, it is determined that the part is a normal part.
[0168] If the surface defect state is a to-be-confirmed bruised defect state, obtain the side area recognition image of the metal part to be detected; use the sliding window technique to segment the side area recognition image to obtain several window area recognition images; respectively input each window area recognition image and the side area recognition image into the preset side defect detection sub-model to determine whether the metal part to be detected has a surface defect and whether the defect type of the surface defect is an end face bruised defect; if there is a bruised surface defect, it is determined that the metal part to be detected has a surface defect, belongs to a defective part, and the defect type of the surface defect is an end face bruised defect; if there is no bruised surface defect, it is determined that the part is a normal part.
[0169] Taking the compressor piston as an example, the surface defects of the compressor piston are mainly end face bruised defects. Except for the end face bruised defects, the non-bruised defects are mainly other types of defects such as sand holes, cluster sands, and unground areas. For example, when the compressor piston has an obvious bruised defect state, its defect is usually more than 20*20 pixels. 1 pixel is about 1 silk in the image, that is, 10um, and 20 pixels is equivalent to 0.2mm; when the compressor piston has a to-be-confirmed bruised defect state, its defect is usually between 5*5 and 20*20 pixels. Figure 9 Shows several types of surface defects of the compressor piston, Figure 10 Shows the detection effect of the surface defect in the end face area recognition image. The surface defect is determined to be a to-be-confirmed bruised defect state by the preset end face defect detection sub-model. Among them, the box part is the specific position of the surface defect in the image (that is, the position of the surface defect in the area recognition image); Figure 11 Shows for Figure 10 The same surface defect, the detection effect in the side area recognition image. For the surface defect determined to be a to-be-confirmed bruised defect state by the preset end face defect detection sub-model, through the preset side defect detection sub-model, the surface micro-protrusions can be clearly observed, and it is confirmed that there is an end face bruised defect.
[0170] Embodiment 2
[0171] This embodiment provides a detection system for surface defects of metal parts, as Figure 12 shown, the detection system for surface defects of metal parts includes:
[0172] An original image acquisition module 1, configured to acquire an original surface image of a metal part to be detected;
[0173] An identification image acquisition module 2, configured to acquire a region identification image corresponding to the original surface image;
[0174] Wherein, the region identification image represents the region position of the metal part to be detected in the original surface image;
[0175] A defect detection module 3, configured to input the region identification image into a preset defect detection model, determine the surface defect state of the metal part to be detected, and determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state;
[0176] Wherein, the surface defect state includes an obvious bruise defect state, a bruise defect state to be confirmed, and a non-bruise defect state. Different surface defect states correspond to different detection priorities. The preset defect detection model includes a preset end face defect detection sub-model, a preset side face defect detection sub-model, and a preset prompt word detection sub-model.
[0177] In an optional implementation manner, the detection priorities of the obvious bruise defect state, the bruise defect state to be confirmed, and the non-bruise defect state decrease in sequence.
[0178] In an optional implementation manner, the detection system for surface defects of metal parts further includes:
[0179] A defect position output module 4, configured to output the position of the surface defect in the region identification image after determining that there is a surface defect on the metal part to be detected.
[0180] In an optional implementation manner, the identification image acquisition module 2 is configured to input the original surface image and the part description language corresponding to the metal part to be detected into a preset region identification model, and output the region identification image corresponding to the original surface image.
[0181] In an optional implementation manner, the original surface image includes an original end face image, and the region identification image includes an end face region identification image corresponding to the original end face image; the original image acquisition module 1 includes:
[0182] An end face image acquisition unit 11, configured to irradiate the metal part to be detected with a blue dome surface light source, and use a black and white area array camera and a telecentric lens with a first preset resolution to photograph the end face of the metal part to be detected, so as to obtain an original end face image;
[0183] The recognition image acquisition module 2 includes:
[0184] The end-face image processing unit 21 is configured to input the original end-face image and the part description corresponding to the metal part to be detected into a preset region recognition model, and output an end-face region recognition image.
[0185] Specifically, the end-face image acquisition unit 11 includes, but is not limited to, a blue dome surface light source, a black-and-white area array camera with a first preset resolution, and a telecentric lens.
[0186] In an alternative embodiment, the original surface image includes an original side image, and the region recognition image includes a side region recognition image corresponding to the original side image; the original image acquisition module 1 includes:
[0187] The side image acquisition unit 12 is configured to irradiate the metal part to be detected with a blue dome linear light source, and use a black-and-white linear array camera with a second preset resolution and a linear array lens to capture the side of the metal part to be detected, so as to obtain an original side image;
[0188] The recognition image acquisition module 2 includes:
[0189] The side image processing unit 22 is configured to input the original side image and the part description corresponding to the metal part to be detected into a preset region recognition model, and output a side region recognition image.
[0190] The side image acquisition unit 12 includes, but is not limited to, a blue dome linear light source, a black-and-white linear array camera with a second preset resolution, and a linear array lens.
[0191] In an alternative embodiment, the region recognition image includes an end-face region recognition image; the defect detection module 3 includes:
[0192] The defect status determination unit 31 is configured to input the end-face region recognition image into a preset end-face defect detection sub-model, and output the surface defect status of the metal part to be detected;
[0193] The defect type determination unit 32 is configured to determine whether there is a surface defect and the defect type of the surface defect of the metal part to be detected based on the surface defect status;
[0194] Or, the defect type determination unit 32 is configured to determine whether there is a surface defect and the defect type of the surface defect of the metal part to be detected based on the surface defect status and a preset side defect detection sub-model;
[0195] Or, the defect type determination unit 32 is configured to determine whether there is a surface defect and the defect type of the surface defect of the metal part to be detected based on the surface defect status and a preset prompt word detection sub-model.
[0196] In an optional implementation manner, the defect type determination unit 32 is configured to determine that the metal part to be detected has a surface defect and the defect type of the surface defect is an end face bruise defect if the surface defect state is an obvious bruise defect state;
[0197] Alternatively, the defect type determination unit 32 is configured to obtain a defect prompt word corresponding to the end face region recognition image if the surface defect state is a non-bruise defect state; input the end face region recognition image and the corresponding defect prompt word into a preset prompt word detection sub-model, and determine whether the metal part to be detected has a non-bruise surface defect and the defect type of the non-bruise surface defect.
[0198] In an optional implementation manner, the region recognition image further includes a side region recognition image; the defect type determination unit 32 is configured to obtain the side region recognition image of the metal part to be detected if the surface defect state is a to-be-confirmed bruise defect state; perform segmentation processing on the side region recognition image by using a sliding window technique to obtain a plurality of window region recognition images; respectively input each window region recognition image and the side region recognition image into a preset side defect detection sub-model, and determine whether the metal part to be detected has a surface defect and whether the defect type of the surface defect is an end face bruise defect.
[0199] In an optional implementation manner, the preset end face defect detection sub-model is trained based on the Fasterrcnn model;
[0200] The preset end face defect detection sub-model includes a CNN network, an RPN network, an ROI Pooling network, and an ROI Head network connected in sequence;
[0201] The CNN network is configured to receive the end face region recognition image and generate an initial end face image feature map corresponding to the end face region recognition image;
[0202] The RPN network is configured to generate end face candidate regions based on the initial end face image feature map;
[0203] The ROI Pooling network is configured to map the end face candidate regions to the initial end face image feature map and generate an end face target feature map with a preset size;
[0204] The ROI Head network is configured to process the end face target feature map based on the Double-RCNN structure and output the surface defect state.
[0205] In an optional implementation manner, the preset prompt word detection sub-model is trained based on a visual detection model.
[0206] In an optional implementation manner, the preset side defect detection sub-model is trained based on the Fasterrcnn model;
[0207] The preset side defect detection sub-model includes a CNN network, an RPN network, an ROI Pooling network, an ROI Head network, and a non-maximum suppression network;
[0208] The CNN network is used to receive the window area recognition image and generate an initial window image feature map corresponding to the window area recognition image. The CNN network is also used to receive the side area recognition image and generate a side initial image feature map corresponding to the side area recognition image;
[0209] The RPN network is used to generate window candidate regions based on the initial window image feature map and generate side candidate regions based on the side initial image feature map;
[0210] The ROI Pooling network is used to map the window candidate regions to the initial window image feature map and generate a window target feature map of a preset size. The ROI Pooling network is also used to map the side candidate regions to the side initial image feature map and generate a side target feature map of a preset size;
[0211] The ROI Head network is used to process the window target feature map based on the Double-RCNN structure, output the states of each subsurface defect, and process the side target feature map to output the side defect state;
[0212] The non-maximum suppression network is used to merge and filter the states of each subsurface defect and the side defect state by using the non-maximum suppression technique to obtain the surface defect state.
[0213] The detection system for the surface defects of metal parts in this embodiment divides the surface defect state into an obvious bruise defect state, a bruise defect state to be confirmed, and a non-bruise defect state. Different surface defect states correspond to different detection priorities, and defects with a higher occurrence frequency can be preferentially detected, improving the detection efficiency; since the preset defect detection model includes a preset end face defect detection sub-model, a preset side defect detection sub-model, and a preset prompt word detection sub-model, it can be used in combination according to the detection needs, and can comprehensively and fully detect the surface micro-defects, improving the defect detection rate and achieving zero missed detection.
[0214] The working principle of the detection system for the surface defects of metal parts in this embodiment is the same as that of the detection method for the surface defects of metal parts in Embodiment 1, and the specific content will not be elaborated here.
[0215] For the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can be referred to the partial description of the method embodiment.
[0216] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present disclosure solution.
[0217] Embodiment 3
[0218] Figure 13 The following is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present disclosure. The electronic device includes a memory, a processor, and a computer program stored in the memory and configured to run on the processor. When the processor executes the computer program, it implements the method for detecting surface defects of metal parts in the above embodiments. Figure 13 The electronic device 80 shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.
[0219] As Figure 13 shown, the electronic device 80 may be presented in the form of a general computing device, for example, it may be a server device. The components of the electronic device 80 may include, but are not limited to: at least one of the above-mentioned processors 81, at least one of the above-mentioned memories 82, and a bus 83 connecting different system components (including the memory 82 and the processor 81).
[0220] The bus 83 includes a data bus, an address bus, and a control bus.
[0221] The memory 82 may include volatile memory, such as a random access memory (RAM) 821 and / or a cache memory 822, and may further include a read-only memory (ROM) 823.
[0222] The memory 82 may further include a program tool 825 (or utility) having a set (at least one) of program modules 824. Such program modules 824 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.
[0223] The processor 81 executes various functional applications and data processing by running the computer program stored in the memory 82, such as the method for detecting surface defects of metal parts provided in the above embodiments.
[0224] The electronic device 80 can also communicate with one or more external devices 84 (such as a keyboard, a pointing device, etc.). Such communication can be carried out through the input / output (I / O) interface 85. Moreover, the electronic device 80 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 86. As shown in the figure, the network adapter 86 communicates with other modules of the electronic device 80 through the bus 83. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in combination with the electronic device 80, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (redundant array of independent disks) systems, tape drives, and data backup storage systems, etc.
[0225] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more of the above-described units / modules can be embodied in one unit / modules. Conversely, the features and functions of one unit / modules described above can be further divided and embodied by multiple units / modules.
[0226] Embodiment 4
[0227] The embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the detection method for surface defects of metal parts provided in the above embodiments is implemented.
[0228] Among them, the more specific computer-readable storage medium that can be adopted can include but not limited to: portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0229] Embodiment 5
[0230] The embodiments of the present disclosure also provide a computer program product, including a computer program. When the computer program is executed by a processor, the detection method for surface defects of metal parts provided in the above embodiments is implemented.
[0231] Among them, the program code for executing the computer program product of the present disclosure can be written in any combination of one or more programming languages. The program code can be executed entirely on the user device, partially on the user device, executed as an independent software package, partially on the user device and partially on a remote device, or entirely on a remote device.
[0232] Although the specific embodiments of the present disclosure have been described above, those skilled in the art should understand that this is only an example, and the protection scope of the present disclosure is defined by the appended claims. Without departing from the principles and essence of the present disclosure, those skilled in the art can make various changes or modifications to these embodiments, but such changes and modifications all fall within the protection scope of the present disclosure.
Claims
1. A method for detecting surface defects of metal parts, characterized in that, The detection method includes: Obtaining an original surface image of the metal part to be detected; Obtaining a region recognition image corresponding to the original surface image; Wherein, the region recognition image characterizes the region position of the metal part to be detected in the original surface image; Inputting the region recognition image into a preset defect detection model, determining the surface defect state of the metal part to be detected, and determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state; Wherein, the surface defect state includes an obvious bruise defect state, a bruise defect state to be confirmed, and a non-bruise defect state. Different surface defect states correspond to different detection priorities. The preset defect detection model includes a preset end face defect detection sub-model, a preset side face defect detection sub-model, and a preset prompt word detection sub-model.
2. The detection method according to claim 1, wherein The detection priorities of the obvious bruise defect state, the bruise defect state to be confirmed, and the non-bruise defect state decrease in sequence; And / or, the detection method further includes: After determining that the metal part to be detected has a surface defect, outputting the position of the surface defect in the region recognition image; And / or, the step of obtaining the region recognition image corresponding to the original surface image includes: Inputting the original surface image and the part description language corresponding to the metal part to be detected into a preset region recognition model, and outputting the region recognition image corresponding to the original surface image; And / or, the original surface image includes an original end face image, and the region recognition image includes an end face region recognition image corresponding to the original end face image; The step of obtaining the original surface image of the metal part to be detected includes: Irradiating the metal part to be detected with a blue dome surface light source, and using a black and white area array camera with a first preset resolution and a telecentric lens to photograph the end face of the metal part to be detected, so as to obtain the original end face image; The step of inputting the original surface image and the part description language corresponding to the metal part to be detected into a preset region recognition model and outputting the region recognition image corresponding to the original surface image includes: Inputting the original end face image and the part description language corresponding to the metal part to be detected into the preset region recognition model, and outputting the end face region recognition image; And / or, the original surface image includes an original side face image, and the region recognition image includes a side face region recognition image corresponding to the original side face image; The step of obtaining the original surface image of the metal part to be detected includes: Irradiating the metal part to be detected with a blue dome line light source, and using a black and white line array camera with a second preset resolution and a line array lens to photograph the side face of the metal part to be detected, so as to obtain the original side face image; The step of inputting the original surface image and the part description language corresponding to the metal part to be detected into a preset region recognition model and outputting the region recognition image corresponding to the original surface image includes: Inputting the original side face image and the part description language corresponding to the metal part to be detected into the preset region recognition model, and outputting the side face region recognition image.
3. The detection method according to claim 1, characterized in that The region recognition image includes an end face region recognition image; The step of inputting the region recognition image into a preset defect detection model, determining the surface defect state of the metal part to be detected, and determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state includes: Input the end face region recognition image into the preset end face defect detection sub-model, and output the surface defect state of the metal part to be detected; Based on the surface defect state, determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect; Or, based on the surface defect state and the preset side defect detection sub-model, determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect; Or, based on the surface defect state and the preset prompt word detection sub-model, determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect.
4. The detection method according to claim 3, wherein The step of determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state includes: If the surface defect state is the obvious bruised defect state, it is determined that there is a surface defect on the metal part to be detected, and the defect type of the surface defect is an end face bruised defect; Or, if the surface defect state is the non-bruised defect state, obtain the defect prompt word corresponding to the end face region recognition image; Input the end face region recognition image and the corresponding defect prompt word into the preset prompt word detection sub-model, and judge whether there is a non-bruised surface defect on the metal part to be detected and the defect type of the non-bruised surface defect.
5. The detection method according to claim 3, wherein The region recognition image further includes a side region recognition image; The step of determining whether there is a surface defect on the metal part to be detected and the defect type of the surface defect based on the surface defect state includes: If the surface defect state is the to-be-confirmed bruised defect state, obtain the side region recognition image of the metal part to be detected; Use the sliding window technique to segment the side region recognition image to obtain several window region recognition images; Input each of the window region recognition images and the side region recognition image into the preset side defect detection sub-model respectively, and judge whether there is a surface defect on the metal part to be detected and whether the defect type of the surface defect is an end face bruised defect.
6. The detection method according to claim 4, wherein The preset end face defect detection sub-model is trained based on the Fasterrcnn model; The preset end face defect detection sub-model includes a CNN network, an RPN network, an ROI Pooling network, and an ROI Head network connected in sequence; The CNN network is used to receive the end face region recognition image and generate an initial end face image feature map corresponding to the end face region recognition image; The RPN network is used to generate end face candidate regions based on the initial end face image feature map; The ROI Pooling network is used to map the end face candidate regions to the initial end face image feature map and generate an end face target feature map of a preset size; The ROI Head network is used to process the end face target feature map based on the Double-RCNN structure and output the surface defect state; and / or, the preset prompt word detection sub-model is trained based on a visual detection model.
7. The detection method according to claim 5, wherein The preset side defect detection sub-model is trained based on the Fasterrcnn model; The preset side defect detection sub-model includes a CNN network, an RPN network, an ROI Pooling network, an ROI Head network, and a non-maximum suppression network; The CNN network is used to receive the window area recognition image and generate an initial window image feature map corresponding to the window area recognition image. The CNN network is also used to receive the side area recognition image and generate a side initial image feature map corresponding to the side area recognition image; The RPN network is used to generate window candidate regions based on the initial window image feature map and generate side candidate regions based on the side initial image feature map; The ROI Pooling network is used to map the window candidate regions to the initial window image feature map and generate a window target feature map of a preset size. The ROI Pooling network is also used to map the side candidate regions to the side initial image feature map and generate a side target feature map of a preset size; The ROI Head network is used to process the window target feature map based on the Double-RCNN structure, output the sub-surface defect states, and process the side target feature map to output the side defect state; The non-maximum suppression network is used to merge and filter the sub-surface defect states and the side defect state by using non-maximum suppression technology to obtain the surface defect state.
8. A detection system for surface defects of metal parts, characterized in that, The detection system includes: An original image acquisition module, configured to acquire an original surface image of a metal part to be detected; An identification image acquisition module, configured to acquire a region identification image corresponding to the original surface image; wherein the region identification image represents the region position of the metal part to be detected in the original surface image; A defect detection module, configured to input the region identification image into a preset defect detection model, determine the surface defect state of the metal part to be detected, and determine whether there is a surface defect on the metal part to be detected and the defect type of the surface defect according to the surface defect state; wherein the surface defect state includes an obvious bruise defect state, a bruise defect state to be confirmed, and a non-bruise defect state. Different surface defect states correspond to different detection priorities. The preset defect detection model includes a preset end face defect detection sub-model, a preset side defect detection sub-model, and a preset prompt word detection sub-model.
9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and adapted to run on the processor, wherein, When the processor executes the computer program, it implements the method for detecting surface defects of a metal part according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for detecting surface defects of a metal part according to any one of claims 1 to 7.
Citation Information
Cited By
Passenger car part anomaly detection method based on deep residual network
CN122223009A