Circular hole burr defect detection method, system and storage medium based on deep learning
By combining deep learning models and geometric feature analysis methods, the problem of missed detection of round pore burr defects in the prior art is solved, and higher detection accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202411433469.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The existing deep learning-based round pore burr defect detection method is prone to missed or missed detection when dealing with unseen or complex morphological burr defects, which is difficult to meet the needs of efficient and accurate detection.
Combining deep learning models and geometric feature analysis, geometric defect verification is performed on the circular hole image through radial projection and edge deviation analysis, a second detection result is generated, and the final detection result is generated through the final detection result fusion rule.
It improves the accuracy and reliability of detection, reduces the occurrence of false detection and missed detection, and can effectively identify complex and tiny burr defects, adapt to the detection needs of diversified and complex defects.
Smart Images

Figure CN118941568B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a method, system and storage medium for detecting burr defects in round holes based on deep learning. Background Art
[0002] With the continuous development of industrial manufacturing, the requirements for product quality are becoming increasingly stringent, especially in the manufacturing process of precision parts, where any tiny defects may have a significant impact on product performance. As a common structural element in various mechanical and electronic equipment, the processing quality of round holes is crucial to the functionality and durability of the entire product. Therefore, quality inspection of the edges of round holes, especially the detection of burr defects, has become an important topic in the manufacturing industry.
[0003] With the continuous development of deep learning technology, neural network models are gradually being used to detect burr defects on the edges of round holes. Specifically, existing technologies identify burr defects on the edges of round holes by building defect detection models. This process usually includes two main steps: first, collect and annotate a large amount of defect type data for neural network model training; second, after the model training is completed, the image of the round hole is input into the model, and the model outputs the detection results. This deep learning-based detection method has significantly improved accuracy and automation compared to traditional visual inspection technology.
[0004] However, the existing technology still has certain limitations when it relies solely on deep learning models for round hole burr defect detection. Since model training is highly dependent on a large amount of labeled data, it is difficult to cover all possible defect types, which leads to the problem of false detection or missed detection when the model is dealing with unseen or complex burrs. Therefore, the method of using only deep learning models for detection still has room for improvement in accuracy, especially when dealing with diverse and complex burr defects, the existing technology is difficult to meet the needs of efficient and accurate detection. Summary of the invention
[0005] The present application provides a method, system and storage medium for detecting round hole burr defects based on deep learning, which can improve the accuracy of round hole burr defects. The present application provides the following technical solutions:
[0006] In a first aspect, the present application provides a method for detecting round hole burr defects based on deep learning, the method comprising:
[0007] Collecting a circular hole image and preprocessing the circular hole image;
[0008] Acquire a training image set, wherein the training image set includes a known round hole image set, each round hole image in the round hole image set is marked with whether there is a burr defect, and use the round hole image set as input and the presence or absence of the burr defect as output to train a preset neural network model to obtain a defect detection model;
[0009] Inputting the circular hole image into the defect detection model and outputting a first detection result;
[0010] Performing geometric defect verification on the circular hole image based on radial projection and edge deviation analysis to generate a second detection result;
[0011] A final detection result is generated based on the first detection result and the second detection result.
[0012] In a specific implementation scheme, the collecting the circular hole image and preprocessing the circular hole image comprises:
[0013] A filter is used to remove noise in the circular hole image, and the clarity of the circular hole edge in the circular hole image is improved through histogram equalization or other contrast enhancement techniques. An edge detection algorithm is used to perform edge detection on the preprocessed circular hole image to preliminarily mark the edge of the circular hole.
[0014] In a specific implementation scheme, the geometric defect verification of the circular hole image based on radial projection and edge deviation analysis to generate the second detection result includes:
[0015] Determine the center position of the circular hole and radius , projected outward from the center of the circle by geometric methods radial lines, and then for each radial line, at a position where the distance from the center of the circle is the radius, calculate the grayscale value change at that location, and project the grayscale change along each radial line into a one-dimensional space to form a radial projection vector as follows:
[0016] in, represents the pixel gray value along the radial line, and are the distances from the center to the inner and outer boundaries respectively;
[0017] Calculate the actual projection vector for each radial line With the standard projection vector The difference is calculated by the following formula Edge deviation on radial lines:
[0018] Use the calculation results of the deviation to determine whether there is a burr defect in the circular hole image. Use the following formula to calculate all The average deviation of the radial lines and the maximum deviation :
[0019] ;
[0020] ;
[0021] After the calculation is completed, if the average deviation Or the maximum deviation If it exceeds the preset threshold, it is determined that the circular hole has a burr defect, and the generated second detection result is that there is a defect; otherwise, the second detection result is that there is no defect.
[0022] In a specific implementation scheme, determining the center position and radius of the circular hole includes:
[0023] The preprocessed circular hole image is input into the Hough circle transform algorithm, where the mathematical process of the Hough circle transform is implemented through a voting mechanism, that is, finding edge pixel points in the circular hole image that meet the following circle equation:
[0024] Among them, the algorithm output is the detected center coordinate of the circle. is the radius of the circular hole.
[0025] In a specific embodiment, projecting multiple radial lines outward from the center of the circle by a geometric method includes:
[0026] From the center Project outward at equal angles radial lines, the angle of each radial line is determined by the following formula:
[0027] in, is the number of radial lines, which extend from the center to the circumference and are used to collect image data along the radial direction.
[0028] In a specific implementation scheme, generating a final test result based on the first test result and the second test result includes:
[0029] According to the fusion rule of the test results, if any result shows that there is a defect, the final test result is that there is a defect;
[0030] Only when both results are free of defects, the final result is free of defects.
[0031] In a specific embodiment, the method further comprises:
[0032] Using a local area difference analysis formula, detecting whether there is a burr defect in the circular hole, generating a third detection result, and generating a final detection result based on the first detection result and the third detection result;
[0033] After determining the center and radius of the circular hole image, the actual area of the circular hole is calculated using the pixel counting method , and then calculate the theoretical area :
[0034] Calculate local area difference :
[0035] in, Based on the radius The actual local area calculated, Based on the radius The theoretical local area calculated, , is the deviation of the local radius, is a smoothing parameter used to control the local radius deviation, is the total number of local areas;
[0036] Get the coordinates of the center of the circle Then, from the center Extract the position of the edge point along each radial line outward to find the coordinates of the edge point in the image , for each radial line, calculate the distance from the center to the edge point, that is, the actual radius :
[0037] Calculate the local area difference Afterwards, a local area difference threshold is set. If the local area difference is greater than the local area difference threshold, it is judged that there is a burr defect, and the third detection result outputs that there is a defect; if the local area difference is less than or equal to the local area difference threshold, it is judged that there is no burr defect, and the third detection result outputs that there is no defect.
[0038] In the second aspect, the present application provides a round hole burr defect detection system based on deep learning, which adopts the following technical solution:
[0039] A round hole burr defect detection system based on deep learning, comprising:
[0040] An image acquisition module, used for acquiring a circular hole image and preprocessing the circular hole image;
[0041] A model training module is used to obtain a training image set, wherein the training image set includes a known round hole image set, each round hole image in the round hole image set is marked with whether there is a burr defect, and the round hole image set is used as input, and the presence or absence of the burr defect is used as output to train a preset neural network model to obtain a defect detection model;
[0042] A model output module, used for inputting the circular hole image into the defect detection model and outputting a first detection result;
[0043] A geometric verification module, used to perform geometric defect verification on the circular hole image based on radial projection and edge deviation analysis to generate a second detection result;
[0044] A result generating module is used to generate a final detection result based on the first detection result and the second detection result.
[0045] In a third aspect, the present application provides an electronic device comprising a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to implement a method for detecting burr defects of circular holes based on deep learning as described in the first aspect.
[0046] In a fourth aspect, the present application provides a computer-readable storage medium, wherein a program is stored in the storage medium, and when the program is executed by a processor, the program is used to implement a method for detecting burr defects of circular holes based on deep learning as described in the first aspect.
[0047] In summary, the beneficial effects of this application include at least:
[0048] 1) By combining deep learning models and geometric feature analysis, this application can perform multi-level detection of burr defects in round holes. The deep learning model is used to automatically identify most defects, while the geometric feature analysis further verifies and compensates for complex or minor defects that may be missed by deep learning. This combined method effectively improves the accuracy and reliability of detection and reduces the occurrence of false detection and missed detection.
[0049] 2) Geometric feature analysis uses radial projection and edge deviation calculation methods to accurately quantify the shape of the circular hole edge, especially for small and irregular burr defects. This method can capture complex defects that are difficult for deep learning models to identify, significantly enhancing the ability of the detection system to deal with diverse and complex defects.
[0050] 3) Geometric feature analysis is based on the physical features of the image, such as the center, radius, and edge shape, rather than relying on a large amount of labeled data. This means that even when there is insufficient training data or a limited number of defect samples, effective detection can still be performed, thereby reducing dependence on large-scale datasets and improving the adaptability and flexibility of the detection solution.
[0051] The accuracy and reliability of detection are improved by combining deep learning models with geometric feature analysis. Specifically, the deep learning model is first used to perform preliminary detection on the circular hole image to generate the first detection result. This model can automatically identify most burr defects, but may have limitations when dealing with complex shapes or unseen defects. To make up for the shortcomings of the deep learning model, the circular hole image is further verified by geometric feature analysis to generate the second detection result. This analysis method accurately identifies geometric defects on the edge of the circular hole, especially small and complex burrs, through radial projection and edge deviation calculation. This step not only verifies and supplements the detection results of the deep learning model, but also provides reliable detection in the absence of a large amount of training data. By combining the first and second detection results, a comprehensive defect judgment is finally generated. Such a multi-level detection strategy can reduce the possibility of false detection and missed detection, especially in high-precision manufacturing processes, to ensure that the quality of the circular hole meets strict requirements. This method effectively solves the problem that traditional detection methods are difficult to identify complex and small defects, and significantly improves the comprehensiveness and accuracy of detection.
[0052] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present application in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 It is a flow chart of a method for detecting burr defects of circular holes based on deep learning in an embodiment of the present application.
[0054] Figure 2 It is a schematic diagram of the overall process of the circular hole burr defect detection method based on deep learning in an embodiment of the present application.
[0055] Figure 3 It is a structural block diagram of a circular hole burr defect detection system based on deep learning in an embodiment of the present application.
[0056] Figure 4 It is a block diagram of an electronic device for circular hole burr defect detection based on deep learning in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The specific implementation methods of the present application are further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present application but are not intended to limit the scope of the present application.
[0058] Optionally, the present application takes the deep learning-based round hole burr defect detection method provided in each embodiment as an example of being used in an electronic device, where the electronic device is a terminal or a server. The terminal may be a computer, a tablet computer, etc. This embodiment does not limit the type of electronic device.
[0059] Reference Figure 1 , is a flow chart of a method for detecting round hole burr defects based on deep learning provided by an embodiment of the present application, the method comprising at least the following steps:
[0060] Step S101, collecting a circular hole image and preprocessing the circular hole image.
[0061] In step S101, firstly, a high-resolution industrial camera is used to capture the image of the circular hole to be detected. In implementation, the camera is fixed on a bracket in a stable state to ensure the clarity and consistency of the image during acquisition. In addition, it is necessary to ensure that the light source is uniform during the acquisition process to avoid strong shadows or reflections. The acquired circular hole image is then preprocessed. Specifically, the color image is converted into a grayscale image, the color information in the image is reduced, and the brightness change is focused on to highlight the edge features. At the same time, a filter (such as a median filter or a Gaussian filter) is used to remove noise from the image to avoid noise interference with subsequent edge detection and feature extraction. Then, through histogram equalization or other contrast enhancement techniques, the clarity of the circular hole edge in the image is improved, making defects such as burrs more prominent. In addition, edge detection algorithms such as Sobel and Canny are used to perform edge detection on the preprocessed image, and the edges of the circular holes are preliminarily marked.
[0062] Step S102, obtaining a training image set, wherein the training image set includes a known round hole image set, wherein each round hole image in the round hole image set is marked with whether there is a burr defect, and the round hole image set is used as input and the presence or absence of burr defects is used as output to train a preset neural network model to obtain a defect detection model.
[0063] In step S102, a training image set is obtained, wherein the training image set includes a known circular hole image set, wherein each circular hole image in the circular hole image set is marked with whether there is a burr defect, and the circular hole image set is used as input, and the presence or absence of burr defects is used as output to train a preset neural network model to obtain a defect detection model. In this application, a convolutional neural network is selected as the neural network model. It should be noted that the circular hole image set in the training image set is updated regularly, so the model will be retrained with a new training image set every once in a while, thereby forming a dynamically updated defect detection model. In this application, a convolutional neural network model is selected as the preset neural network model.
[0064] Optionally, the circular hole image set may be obtained from a public image material library, or from past circular hole image detection results. The present application does not impose any restrictions on the method for obtaining the circular hole image set.
[0065] Step S103: input the circular hole image into the defect detection model, and output a first detection result.
[0066] In step S103, the circular hole image preprocessed in step S101 is input into the defect detection model, and the model outputs the detection result of the circular hole image as the first detection result, that is, the first detection result is that the circular hole image has a burr defect or the circular hole image does not have a burr defect.
[0067] Step S104: verify the geometric defects of the circular hole image based on radial projection and edge deviation analysis to generate a second detection result.
[0068] In step S104, after obtaining the first detection result through the defect detection model, a secondary geometric feature analysis is performed on the circular hole image in combination with radial projection and deviation analysis. The geometric feature analysis can more accurately identify whether there is a burr defect on the edge and verify the first detection result of the deep learning model.
[0069] In practice, when performing geometric analysis on the circular hole image, it is first necessary to determine the position of the center of the circular hole. In this application, the Hough circle transform is used to locate the center of the circular hole. Specifically, the preprocessed circular hole image is input into the Hough circle transform algorithm, which detects possible circular edge points in the image and finds the best matching circle and its center and radius. The mathematical process of the Hough circle transform is implemented through a voting mechanism, that is, finding edge pixel points in the circular hole image that meet the following circle equation:
[0070] Among them, the algorithm output is the detected center coordinate of the circle. is the radius of the circular hole.
[0071] In practice, after the center and radius of the circle are determined, multiple radial lines are projected outward from the center of the circle by geometric methods to analyze the deviation of the edge of the circular hole. Project outward at equal angles radial lines, the angle of each radial line is determined by the following formula:
[0072] in, is the number of radial lines, which is usually 360 to ensure that the interval between each radial line is one degree. The radial lines extend from the center of the circle to the circumference and are used to collect image data along the radial direction.
[0073] In practice, for each radial line, a distance from the center of the circle is , calculate the gray value change at that location, and project the gray value change along each radial line into one-dimensional space to form a radial projection vector as follows:
[0074] in, represents the pixel gray value along the radial line, and are the distances from the center to the inner and outer boundaries respectively. By comparing the projection vector The standard projection vector to the edge of the perfect circle The difference can detect the presence of burrs.
[0075] In implementation, to identify burr defects, the actual projection vector of each radial line is calculated. With the standard projection vector The difference is used to quantify the edge deviation. First, the following formula is used to calculate the first Edge deviation on radial lines:
[0076] The above formula expresses the The absolute difference between the actual edge projection and the ideal edge projection. If the difference is large, it means that there may be a burr defect there.
[0077] In addition, as a preferred embodiment, the following improved formula can also be used to calculate the Edge deviation on radial lines:
[0078] in, is a very small constant, such as 0.01, used to avoid division by zero errors and enhance numerical stability. In the original formula, if Close to zero, division by zero errors or numerical instability may occur when calculating the deviation. This can be prevented and the stability of the calculation process can be ensured. In addition, the improved formula uses relative error Instead of absolute error. In this way, the deviation evaluation can be standardized as relative error, reducing the impact of absolute gray value changes, thereby more accurately reflecting the degree of relative deviation. Relative error makes the detection of burr defects more sensitive, especially in areas where the ideal projection value is close to zero, and can more accurately detect tiny defects.
[0079] Finally, the deviation calculation results are used to determine whether there is a burr defect in the circular hole image. The following formula is used to calculate all The average deviation of the radial lines and the maximum deviation :
[0080] ;
[0081] ;
[0082] After the calculation is completed, if the average deviation Or the maximum deviation If the value exceeds the preset threshold, the circular hole is judged to have a burr defect, and the second test result generated is "defective", otherwise, the second test result is "no defect". Calculating the average deviation and maximum deviation on all radial lines can comprehensively evaluate the defect situation of the circular hole edge. This method can provide an overall view of the defect distribution, not just the local test results.
[0083] During the verification process of step S104, the geometric analysis method can verify and supplement the detection results of the deep learning model. Even if the deep learning model misses or misdetects due to insufficient data or insufficient training, the geometric method can correct these errors by quantitatively analyzing the actual edges. In addition, the geometric analysis method relies on physical features in the image (such as the center, radius, and edge shape) rather than a large amount of training data. This means that effective detection can be performed even when there is insufficient data or limited defect samples, reducing the reliance on large-scale data sets.
[0084] Step S105: Generate a final detection result based on the first detection result and the second detection result.
[0085] In step S105, the final defect judgment is generated based on the deep learning model detection result in step S103 and the geometric analysis result in step S104. The goal of this step is to combine the two results to ensure that the final judgment result can accurately reflect whether there is a burr defect in the circular hole. Specifically, according to the fusion rule of the detection results, if any result shows that there is a defect, the final detection result is "there is a defect". Only when both results are "no defect", the final result is "no defect".
[0086] In another feasible embodiment, a local area difference analysis formula may also be used to detect whether a circular hole has a burr defect, thereby generating a third detection result.
[0087] Specifically, after determining the center and radius of the circular hole image by the same method as in step S104, the actual area of the circular hole is first calculated using the pixel counting method. , and then calculate the theoretical area :
[0088] Finally, the local features and local area changes of the circular hole edge are introduced to calculate the local area difference :
[0089] in, Based on the radius The actual local area calculated, Based on the radius The theoretical local area calculated, , is the deviation of the local radius, is a smoothing parameter used to control the local radius deviation, is the total number of local regions.
[0090] In implementation, the coordinates of the center of the circle are obtained Then, from the center Extract the position of edge points along each radial line outward. The position of edge points can be identified by edge detection algorithms (such as Canny edge detection algorithm) to find the coordinates of edge points in the image. , for each radial line, calculate the distance from the center to the edge point, that is, the actual radius :
[0091] Calculate the local area difference After that, a local area difference threshold is set. If the local area difference is greater than the local area difference threshold, it is judged that there is a burr defect, and the third detection result outputs "defect exists". If the local area difference is less than or equal to the local area difference threshold, it is judged that there is no burr defect, and the third detection result outputs "no defect".
[0092] Defect detection is performed by the above detection method. The traditional method is to directly compare the theoretical area with the actual area, which can only identify the overall area difference. It is difficult to detect local tiny burrs or irregular changes. The local area difference analysis formula can more sensitively detect tiny and irregular burr defects by subdividing the edge of the circular hole into multiple local areas and calculating the area differences of these areas one by one. Even if these defects have little effect on the overall area, they can be accurately identified. In addition, the introduced smoothing parameters and radius deviations are used to weight the area differences of each local area. Through the exponential decay function, higher weights can be given to those areas with larger deviations, making local burr defects on the edge easier to be magnified and identified, while areas with smaller deviations have relatively little impact on the results. This weighted processing can more accurately reflect the actual situation of burr defects.
[0093] Optionally, after obtaining the third test result, the final test result can be generated based on the first test result and the third test result, or based on the first test result, the second test result and the third test result, all of which follow the rule that if any result shows a defect, the final test result is "defective". Only when all test results are "no defect", the final result is "no defect".
[0094] In summary, combined with Figure 2 , by combining multiple detection methods, the accuracy and reliability of detection are improved. Specifically, this method first uses a deep learning model for preliminary detection to obtain the first detection result, then uses geometric feature analysis to perform radial projection and deviation calculation on the edge of the circular hole to obtain the second detection result, and finally introduces local area difference analysis to perform detailed detection on the local area of the circular hole to obtain the third detection result. Each detection method has its own focus. The deep learning model can automatically identify most burr defects, the geometric feature analysis supplements the model's shortcomings in dealing with complex morphological defects, and the local area difference analysis is particularly sensitive to small and irregular burr defects. Through the combination of these three methods, it can not only make up for the limitations of a single detection method and avoid missed detection or false detection, but also more comprehensively evaluate the edge quality of the circular hole. The final detection result ensures that even if one method misses detection, other methods can still accurately capture defects by integrating the output of each detection method. This multi-level detection strategy is particularly suitable for industrial manufacturing scenarios with high precision and high reliability requirements. It effectively solves the problem that traditional methods are difficult to deal with complex defect morphology and improves the comprehensiveness and sensitivity of detection.
[0095] Figure 3 This is a structural block diagram of a round hole burr defect detection system based on deep learning provided by an embodiment of the present application. The device includes at least the following modules:
[0096] An image acquisition module, used for acquiring circular hole images and preprocessing the circular hole images;
[0097] A model training module is used to obtain a training image set, wherein the training image set includes a known round hole image set, wherein each round hole image in the round hole image set is marked with whether there is a burr defect, and the round hole image set is used as input, and the presence or absence of a burr defect is used as output to train a preset neural network model to obtain a defect detection model;
[0098] A model output module, used for inputting the circular hole image into the defect detection model and outputting a first detection result;
[0099] A geometric verification module, used to verify the geometric defects of the circular hole image based on radial projection and edge deviation analysis, and generate a second detection result;
[0100] The result generating module is used to generate a final detection result based on the first detection result and the second detection result.
[0101] For relevant details, refer to the above method embodiment.
[0102] Figure 4 4 is a block diagram of an electronic device provided by an embodiment of the present application. The device at least includes a processor 401 and a memory 402.
[0103] The processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0104] The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, which is used to be executed by the processor 401 to implement the circular hole burr defect detection method based on deep learning provided in the method embodiment of the present application.
[0105] In some embodiments, the electronic device may further optionally include: a peripheral device interface and at least one peripheral device. The processor 401, the memory 402 and the peripheral device interface may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface via a bus, a signal line or a circuit board. Schematically, the peripheral devices include but are not limited to: a radio frequency circuit, a touch display screen, an audio circuit, and a power supply.
[0106] Of course, the electronic device may also include fewer or more components, which is not limited in this embodiment.
[0107] Optionally, the present application also provides a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the circular hole burr defect detection method based on deep learning of the above method embodiment.
[0108] Optionally, the present application also provides a computer product, which includes a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the deep learning-based circular hole burr defect detection method of the above-mentioned method embodiment.
[0109] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.
[0110] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for detecting round hole burr defects based on deep learning, characterized in that: The method comprises: Collecting a circular hole image and preprocessing the circular hole image; Acquire a training image set, wherein the training image set includes a known round hole image set, each round hole image in the round hole image set is marked with whether there is a burr defect, and use the round hole image set as input and the presence or absence of the burr defect as output to train a preset neural network model to obtain a defect detection model; Inputting the circular hole image into the defect detection model and outputting a first detection result; The geometric defect verification of the circular hole image is performed based on radial projection and edge deviation analysis to generate a second detection result; the geometric defect verification of the circular hole image is performed based on radial projection and edge deviation analysis to generate a second detection result includes: Determine the center position (x0, y0) and radius r of the circular hole, project n radial lines outward from the center of the circle by geometric methods, and then calculate the grayscale value change at the position where the distance from the center of the circle is the radius for each radial line, and project the grayscale change along each radial line into a one-dimensional space to form a radial projection vector P i (r) as follows: Among them, I(x i (r),y i (r)) represents the pixel gray value along the radial line, r min and r max are the distances from the center to the inner and outer boundaries respectively; Calculate the actual projection vector P for each radial line i The difference between the projection vector P0(r) and the standard projection vector P0(r) is calculated, and the edge deviation on the i-th radial line is calculated by the following formula: Use the calculation result of the deviation to determine whether there is a burr defect in the circular hole image. Use the following formula to calculate the average deviation D of all n radial lines. avg and the maximum deviation D max : D max =max(D1,D2,…,D n ); After the calculation is completed, if the average deviation D avg Or the maximum deviation D max If the value exceeds the preset threshold, it is determined that the circular hole has a burr defect, and the second detection result generated is that there is a defect; otherwise, the second detection result is that there is no defect; A final detection result is generated based on the first detection result and the second detection result.
2. The method for detecting round hole burr defects based on deep learning according to claim 1, characterized in that: The collecting of the circular hole image and preprocessing of the circular hole image comprises: A filter is used to remove noise in the circular hole image, and the clarity of the circular hole edge in the circular hole image is improved through histogram equalization or other contrast enhancement techniques. An edge detection algorithm is used to perform edge detection on the preprocessed circular hole image to preliminarily mark the edge of the circular hole.
3. The method for detecting round hole burr defects based on deep learning according to claim 1, characterized in that: Determining the center position and radius of the circular hole includes: The preprocessed circular hole image is input into the Hough circle transform algorithm, where the mathematical process of the Hough circle transform is implemented through a voting mechanism, that is, finding edge pixel points in the circular hole image that meet the following circle equation: (x-x0) 2 +(y-y0) 2 =r 2 Among them, the algorithm output (x0, y0) is the detected coordinates of the center of the circle, and r is the radius of the circular hole.
4. The method for detecting round hole burr defects based on deep learning according to claim 1, characterized in that: The projecting of multiple radial lines outward from the center of the circle by a geometric method comprises: Project n radial lines outward at equal angles from the center of the circle (x0, y0). The angle of each radial line is determined by the following formula: Wherein, n is the number of radial lines, which extend from the center of the circle to the circumference and are used to collect image data along the radial direction.
5. The method for detecting round hole burr defects based on deep learning according to claim 1, characterized in that: The generating a final detection result based on the first detection result and the second detection result includes: According to the fusion rule of the test results, if any result shows that there is a defect, the final test result is that there is a defect; Only when both results are free of defects, the final result is free of defects.
6. The method for detecting round hole burr defects based on deep learning according to claim 1, characterized in that: The method further comprises: Using a local area difference analysis formula, detecting whether there is a burr defect in the circular hole, generating a third detection result, and generating a final detection result based on the first detection result and the third detection result; After determining the center and radius of the circular hole image, the actual area A of the circular hole is calculated using the pixel counting method. actual , and then calculate the theoretical area A theoretical : A theotetical =π·r 2 Calculate the local area difference ΔA local : Among them, A actual (r i ) is based on the radius r i The actual local area calculated, A theoretical (r i ) is based on the radius r i Calculated theoretical local area, Δr i =r i -r, is the deviation of the local radius, σ is the smoothing parameter used to control the deviation of the local radius, and N is the total number of local regions; After obtaining the coordinates of the center of the circle (x0, y0), extract the position of the edge point along each radial line from the center of the circle (x0, y0) outward to find the coordinates of the edge point in the image (x i ,y i ), for each radial line, calculate the distance from the center to the edge point, that is, the actual radius r i : Calculate the local area difference ΔA local Afterwards, a local area difference threshold is set. If the local area difference is greater than the local area difference threshold, it is judged that there is a burr defect, and the third detection result outputs that there is a defect; if the local area difference is less than or equal to the local area difference threshold, it is judged that there is no burr defect, and the third detection result outputs that there is no defect.
7. A round hole burr defect detection system based on deep learning, characterized in that: include: An image acquisition module, used for acquiring a circular hole image and preprocessing the circular hole image; A model training module is used to obtain a training image set, wherein the training image set includes a known round hole image set, each round hole image in the round hole image set is marked with whether there is a burr defect, and the round hole image set is used as input, and the presence or absence of the burr defect is used as output to train a preset neural network model to obtain a defect detection model; A model output module, used for inputting the circular hole image into the defect detection model and outputting a first detection result; A geometric verification module is used to perform geometric defect verification on the circular hole image based on radial projection and edge deviation analysis to generate a second detection result; the geometric defect verification on the circular hole image based on radial projection and edge deviation analysis to generate a second detection result includes: Determine the center position (x0, y0) and radius r of the circular hole, project n radial lines outward from the center of the circle by geometric methods, and then calculate the grayscale value change at the position where the distance from the center of the circle is the radius for each radial line, and project the grayscale change along each radial line into a one-dimensional space to form a radial projection vector P i (r) as follows: Among them, I(x i (r),y i (r)) represents the pixel gray value along the radial line, r min and r max are the distances from the center to the inner and outer boundaries respectively; Calculate the actual projection vector P for each radial line i The difference between the projection vector P0(r) and the standard projection vector P0(r) is calculated, and the edge deviation on the i-th radial line is calculated by the following formula: Use the calculation result of the deviation to determine whether there is a burr defect in the circular hole image. Use the following formula to calculate the average deviation D of all n radial lines. avg and the maximum deviation D max : D max =max(D1,D2,…,D n ); After the calculation is completed, if the average deviation D avg Or the maximum deviation D max If the value exceeds the preset threshold, it is determined that the circular hole has a burr defect, and the second detection result generated is that there is a defect; otherwise, the second detection result is that there is no defect; A result generating module is used to generate a final detection result based on the first detection result and the second detection result.
8. An electronic device, characterized in that: The device includes a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to implement a circular hole burr defect detection method based on deep learning as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The storage medium stores a program, which, when executed by a processor, is used to implement a method for detecting burr defects of circular holes based on deep learning as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method for detecting internal burr defect of ball cage dust cover
CN115456955A