PvC plastic pipe fitting defect detection method and device based on machine vision
By dynamically adjusting the difference area range and comprehensive multi-feature analysis, the problem of irregular selection of the difference area range in the existing technology is solved, the accuracy and robustness of defect detection of PvC plastic pipe fittings are significantly improved, and the Efficient and stable detection results.
Patent Information
- Application Number
- CN202411857036.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the selection of the difference area range is not standardized, and there is a lack of a dynamic adjustment mechanism to adapt to different defect types, resulting in information omission or noise interference, which seriously restricts the accuracy and applicability of defect detection of PvC plastic pipe accessories.
By acquiring images of PVC plastic pipe fittings, extracting defect contours and calculating the minimum circumscribed circle, the initial difference area range is set based on geometric features, and the range is dynamically adjusted through expansion and corrosion operations, combining hue consistency, similarity vector and difference degree Vectors are used for defect detection, and a difference area range evaluation model is constructed to optimize the detection effect.
It significantly improves the accuracy and robustness of defect detection, reduces false detections and missed detections, achieves efficient and stable defect detection, and is suitable for a variety of complex detection environments.
Smart Images

Figure CN119313675A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PVC plastic pipes, and more specifically, to a method and device for detecting defects of PVC plastic pipe accessories based on machine vision. Background Art
[0002] PVC plastic pipes are widely used in construction, drainage and industrial fields, and the quality of their accessories directly affects the performance and life of the entire system. Traditional defect detection methods usually rely on manual inspection or simple sensor detection, which has problems such as low noise suppression, poor accuracy, and high missed detection rate, making it difficult to meet the high standards of modern production.
[0003] Existing technologies mainly include two categories: the first is the detection method based on manual experience, where workers check the surface quality and geometry of pipe fittings by visual observation or with the help of simple tools. Although this method is flexible, it is easily affected by subjective factors and it is difficult to ensure consistency, especially in large-scale production, which is prone to missed detection or false detection. The second is the method based on traditional detection equipment, such as detecting dimensional deviations through mechanical measuring equipment, or detecting obvious surface defects through simple optical equipment. However, these methods can usually only detect a certain type of specific defects, and it is difficult to effectively handle complex defect morphology and small defects. At the same time, the equipment cost is high and the flexibility is insufficient.
[0004] In contrast, the machine vision-based method utilizes the powerful capabilities of computers and image processing technology to perform all-round, high-resolution scans of the surface of pipe fittings through industrial cameras, light source systems, and intelligent algorithms. This method can not only detect common defects such as cracks, bubbles, deformations, and dimensional deviations, but also identify subtle and complex quality issues by training deep learning models. In addition, machine vision inspection can realize automated operation, greatly improve detection noise suppression, reduce labor costs, and provide visual data support for quality control. This technology is gradually becoming a core tool in the field of intelligent manufacturing, providing reliable guarantees for the high-quality production of plastic pipe fittings.
[0005] For example, the invention patent with announcement number: CN116630332A announces a PVC plastic pipe mouth defect detection method based on image processing, including obtaining a grayscale image and an HSV image corresponding to the PVC plastic pipe mouth; obtaining a defect contour curve in the grayscale image; calculating an appearance feature factor based on the defect contour curve; obtaining a minimum circumscribed circle of the defect contour curve, constructing pixel pairs according to the minimum circumscribed circle and the pixel points on the defect contour curve, calculating the weight value of the pixel pair according to the appearance feature factor, and obtaining a weight matrix; obtaining a similarity vector and a difference vector based on the weight matrix; obtaining a difference area between the defect contour curve and the area enclosed by its minimum circumscribed circle; calculating hue consistency according to the difference area; detecting whether the PVC plastic pipe mouth has defects according to the similarity vector, the difference vector and the hue consistency, and accurately determining whether the PVC plastic pipe mouth has defects.
[0006] The above disclosed technical solutions have at least the following technical problems: When detecting defects in PVC plastic pipe fittings, the size of the difference area directly affects the detection accuracy and reliability of defects in PVC plastic pipe fittings. The calculation range of the difference area is too wide and may contain a lot of background information that is irrelevant to the defect, such as the texture of the pipe surface, light reflection or dust, etc. This irrelevant information will interfere with the accuracy of subsequent feature extraction and increase the possibility of false alarms, especially in the complex lighting and environmental background of industrial sites.
[0007] If the difference area is too small, it may not cover the complete boundary of the defect, resulting in partial neglect of key feature information of the defect (such as shape, size or color distribution). This information loss will reduce the sensitivity of the detection algorithm, especially when identifying small or diffuse defects, which is prone to missed detection.
[0008] In the prior art, the difference region range is not selected in a standardized manner and lacks a dynamic adjustment mechanism to adapt to different defect types, resulting in information omission or noise interference, which seriously restricts the accuracy and applicability of defect detection. In view of the above problems, the present invention proposes a solution. Summary of the invention
[0009] In order to overcome the above-mentioned defects of the prior art, the embodiments of the present invention provide a PVC plastic pipe fittings defect detection method and device based on machine vision, which analyzes the defect detection effects under different difference area ranges to solve the problems in the prior art such as the non-standard selection of difference area ranges and the lack of a dynamic adjustment mechanism to adapt to different defect types, resulting in information omission or noise interference, which seriously restricts the accuracy and applicability of defect detection.
[0010] To achieve the above-mentioned purpose, the present invention provides the following technical solutions: a method for defect detection of PVC plastic pipe fittings based on machine vision, comprising the following steps: acquiring an image of PVC plastic pipe fittings, extracting the image defect contour by edge detection and calculating the minimum circumscribed circle of the defect contour; setting an initial difference region range based on the geometric features of the defect contour, and performing several expansion operations and corrosion operations on the initial difference region range to obtain several adjustable difference region ranges; respectively calculating the hue consistency, similarity vector and difference vector between several adjustable difference region ranges and the minimum circumscribed circle to perform defect detection; respectively obtaining defect location data and detection robustness data of defect detection under different adjustable difference region ranges; respectively constructing a difference region range evaluation model based on a convolutional neural network according to the defect location data and the detection robustness data; constructing a difference region range-detection effect relationship curve according to the output of the difference region range evaluation model and the corresponding difference region range, and performing data analysis to obtain the adjusted difference region range, and applying it to the defect detection of PVC plastic pipe fittings.
[0011] In a preferred embodiment, the method of acquiring an image of a PVC plastic pipe fitting, extracting the image defect contour by edge detection, and calculating and generating the minimum circumscribed circle of the defect contour is specifically as follows: acquiring an image of a PVC plastic pipe fitting, and preprocessing the collected original image; performing edge detection based on the Canny algorithm to obtain an edge image; detecting all contours in the edge image based on OpenCV to obtain the coordinate points of the contour; and calculating the minimum circumscribed circle of the contour based on the coordinate points of the contour based on OpenCV.
[0012] In a preferred embodiment, the initial difference region range is set based on the geometric features of the defect contour, specifically: the minimum bounding rectangle of the defect contour is calculated based on OpenCV; the center of the difference region is set as the center point of the minimum bounding rectangle, and the width and height of the minimum bounding rectangle are used to increase the preset margin to obtain the initial difference region range. The initial difference region range is subjected to several expansion operations and erosion operations to obtain several adjustable difference region ranges, specifically: based on the preset structural element, the initial difference region is expanded by cv2.dilate(), and the initial difference region is eroded by cv2.erode(); several expansion operations and erosion operations are performed to obtain several adjustable difference region ranges.
[0013] In a preferred embodiment, the hue consistency, similarity vector and difference vector between several adjustable difference area ranges and the minimum circumscribed circle are calculated respectively to perform defect detection, specifically: extract H channel data in the HSV image; for each difference area range (calculate the hue value of each pixel in the area; for the area surrounded by the minimum circumscribed circle, calculate the H channel hue value in the area; obtain hue consistency by calculating the mean difference between the hue value of the pixel in the difference area range and the hue value of the pixel in the minimum circumscribed circle area; calculate the pixel level similarity between the difference area range and the minimum circumscribed circle area based on the Euclidean distance to obtain the similarity vector; calculate the difference vector based on the absolute difference of the pixel values; and combine the hue consistency, similarity vector and difference vector to comprehensively analyze the detection results.
[0014] In a preferred embodiment, the defect location data includes a defect location accuracy influence coefficient; the specific method for obtaining the defect location accuracy influence coefficient is as follows: obtain the intensity change of the terahertz wave signal under different terahertz wave frequencies and beam widths, the fluctuation of the wall thickness distribution, and construct a wall thickness positioning accuracy evaluation model through a signal processing algorithm; cluster the wall thickness positioning accuracy evaluation model; perform feature extraction on the processed wall thickness positioning accuracy evaluation model, and calculate the measurement accuracy evaluation coefficient based on the wall thickness measurement error, positioning error and noise interference; simulate the measurement accuracy under different terahertz wave frequencies and beam widths through the wall thickness positioning accuracy evaluation model, and establish an accuracy timeliness model to obtain the accuracy timeliness evaluation coefficient; calculate the defect location accuracy influence coefficient in combination with the measurement accuracy evaluation coefficient.
[0015] In a preferred embodiment, the detection robustness data includes a robustness fluctuation anomaly coefficient and a noise suppression anomaly coefficient; the specific method for obtaining the robustness fluctuation anomaly coefficient is as follows: based on the defect detection process under different difference area ranges, a set of events in which multiple preset environmental conditions affect the detection results is obtained, and the set of events in which multiple preset environmental conditions affect the detection results includes abnormal detection results caused by various environmental conditions, and a weighted valuation is performed on the abnormal detection results based on historical data; a regression model is constructed based on the set of events in which multiple preset environmental conditions affect the detection results and the corresponding scores to generate a robustness fluctuation anomaly coefficient.
[0016] In a preferred embodiment, the specific method for obtaining the noise suppression anomaly coefficient is as follows: obtain the ratio of several noise signals to defect signals under different terahertz wave frequencies and beam widths; calculate the noise suppression standard deviation and the noise suppression average of the ratio of several noise signals to defect signals under different terahertz wave frequencies and beam widths; calculate the coefficient of variation of the ratio of noise signals to defect signals based on the noise suppression standard deviation and the noise suppression average; calculate the noise suppression anomaly coefficient based on the coefficient of variation of the ratio of noise signals to defect signals based on a preset noise suppression anomaly coefficient calculation formula.
[0017] In a preferred embodiment, the difference area range-detection effect relationship curve is constructed based on the output of the difference area range evaluation model and the corresponding difference area range, specifically: the difference area range evaluation coefficient of the output under different adjustable difference area ranges is obtained from the area range evaluation model; the X-axis is set to the difference area range, and the Y-axis is represented as the difference area range evaluation coefficient to establish a rectangular coordinate system; the difference area range evaluation coefficient corresponding to each difference area range is marked on the rectangular coordinate system to form a marking point, and the interpolation method is used for smoothing to obtain the difference area range-effect curve.
[0018] In a preferred embodiment, the data analysis is performed to obtain an adjusted difference area range, and applied to PVC plastic pipe fittings defect detection, specifically: the difference area ranges corresponding to the maximum values of the difference area range-effect curve are screened to obtain a first selected set; the minimum values of the integrals on the difference area range-effect curve corresponding to the difference area ranges in the first selected set are compared, and the difference area range with the smallest comparison result is used as the adjusted difference area range, and applied to PVC plastic pipe fittings defect detection.
[0019] The technical effects and advantages of the present invention's PVC plastic pipe fitting defect detection method and device based on machine vision are as follows: 1. The present invention accurately extracts defect features by combining mature image processing technologies, such as Canny edge detection, contour extraction and minimum circumscribed circle calculation. By dynamically adjusting the range of the difference area and combining expansion and corrosion operations, it can effectively adapt to different defect types and shapes, and significantly improve the accuracy and robustness of detection. In addition, the reliability of defect identification is further improved through the analysis of comprehensive hue consistency, similarity vector and difference vector. The introduction of the defect positioning accuracy influence coefficient and the robustness fluctuation anomaly coefficient solves the problems of false detection and missed detection caused by unreasonable selection of difference areas in traditional methods, and realizes efficient and stable defect detection. It is suitable for a variety of complex detection environments and has strong practical value and innovation.
[0020] 2. The present invention realizes quantitative analysis of key parameters of the detection process by constructing a difference area range evaluation model through the defect location accuracy influence coefficient, robustness fluctuation anomaly coefficient and noise suppression anomaly coefficient in combination with a convolutional neural network. The construction and data analysis of the difference area range-detection effect relationship curve make it possible to accurately screen out the optimal difference area range in a variety of complex detection environments. Finally, the interpolation method and integral minimum value screening strategy are used to dynamically adjust the difference area range, which improves the detection accuracy, robustness and noise resistance, while reducing the probability of false detection and missed detection. This method not only realizes efficient defect detection, but also has strong versatility and scalability. It is suitable for other similar industrial detection scenarios and embodies great technical innovation and application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 The present invention is a schematic flow chart of a method for detecting defects in PVC plastic pipe fittings based on machine vision. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] Embodiment 1, Figure 1 The present invention provides a method for detecting defects of PVC plastic pipe fittings based on machine vision, comprising the following steps: S1, acquiring an image of a PVC plastic pipe fitting, extracting the image defect contour by edge detection and calculating the minimum circumscribed circle of the defect contour; The method of obtaining an image of a PVC plastic pipe fitting, extracting the image defect contour by edge detection, and calculating and generating the minimum circumscribed circle of the defect contour is as follows: Acquire images of PVC plastic pipe fittings and pre-process the acquired original images; Perform edge detection based on the Canny algorithm to obtain an edge image; Detect all contours in the edge image based on OpenCV and obtain the coordinate points of the contours; According to the coordinate points of the contour, the minimum circumscribed circle of the contour is calculated based on OpenCV.
[0024] It should be noted that the image processing steps involved in the above technology, including image preprocessing, Canny edge detection, contour extraction, and minimum circumscribed circle calculation, are all mature technologies in the field of computer vision and image processing. These methods have been widely used in image edge recognition and contour analysis, and related algorithms and tools (such as OpenCV library) have been verified by a large number of practices. Therefore, this article will no longer elaborate on the specific implementation of these common technologies, but aims to focus on how to combine these basic technologies for innovative applications of PVC plastic pipe fittings defect detection.
[0025] S2, setting an initial difference region range based on the geometric features of the defect contour, and performing several expansion operations and erosion operations on the initial difference region range to obtain several adjustable difference region ranges; The initial difference area range is set based on the geometric features of the defect contour, specifically: Calculate the minimum enclosing rectangle of the defect contour based on OpenCV; The center of the difference area is set as the center point of the minimum enclosing rectangle, and the width and height of the minimum enclosing rectangle are used to increase the preset margin to obtain the initial difference area range.
[0026] The initial difference region range is subjected to several expansion operations and corrosion operations to obtain several adjustable difference region ranges, specifically: Based on the preset structural element, the initial difference area is expanded by cv2.dilate(), and the initial difference area is eroded by cv2.erode(); Through several dilation operations and erosion operations, several adjustable difference region ranges are obtained.
[0027] It should be noted that the minimum enclosing rectangle of the defect contour is calculated by analyzing the defect contour in the image and using the minimum enclosing rectangle to surround the defect contour; the minimum enclosing rectangle is a rectangle that can enclose the entire contour. Its edges are not necessarily parallel to the contour, but the area is the smallest. Through this rectangle, we can determine the rough position, size and direction of the defect.
[0028] In the dilation and erosion operations, the choice of structural element has a significant impact on the results. The size and shape of the structural element determine the operation method. Common structural elements, rectangular structural elements: suitable for uniform dilation or erosion, especially in the case of irregular contours; circular structural elements: suitable for areas that need to be smoothed to avoid sharp edges; cross structural elements: used for local dilation or erosion operations on areas, especially in areas with smoother edges.
[0029] The dilation operation will expand the region, while the erosion operation will reduce the region. By adjusting the number of times each operation is performed, different sizes of difference regions can be obtained. The combination of these two operations can form difference regions of different ranges. Generally, the dilation operation will increase the width and height of the region, while the erosion operation will reduce these dimensions.
[0030] S3, respectively calculating the hue consistency, similarity vector and difference vector between a number of adjustable difference regions and the minimum circumscribed circle to perform defect detection; The color consistency, similarity vector and difference vector between the adjustable difference area range and the minimum circumscribed circle are calculated respectively to perform defect detection, specifically: Extract the H channel data in the HSV image; for each difference area range (calculate the hue value of each pixel in the area; For the area enclosed by the minimum circumscribed circle, calculate the hue value of the H channel in the area; The hue consistency is obtained by calculating the mean difference between the hue value of the pixels within the difference area and the hue value of the pixels in the minimum circumscribed circle area; Based on the Euclidean distance, the pixel-level similarity between the difference area range and the minimum circumscribed circle area is calculated to obtain a similarity vector; Calculate a disparity vector based on the absolute difference of pixel values; The detection results are comprehensively analyzed by combining hue consistency, similarity vector and difference vector.
[0031] It should be noted that the comprehensive analysis process involves weighted fusion, standardization, and threshold judgment of multiple feature vectors (hue consistency, similarity vector, and difference vector in this application). These technologies have been widely used in the fields of image processing and defect detection. Image-based multi-feature fusion analysis methods, such as color consistency, shape features, and texture analysis, have been verified and applied in many industrial inspection systems. Therefore, the application of these technologies in this field is mature, and the relevant implementation and optimization methods have been proven by multiple research and practical application cases, so they will not be repeated here.
[0032] It should be noted that the higher the hue consistency and similarity, the more complete and regular defects may exist in the area; and the higher the difference, the more irregular or defective areas with obvious edges may be.
[0033] S4, respectively obtaining defect location data and detection robustness data of defect detection under different adjustable difference area ranges; The defect location data includes a defect location accuracy influence coefficient; the detection robustness data includes a robustness fluctuation anomaly coefficient and a noise suppression anomaly coefficient.
[0034] The defect location accuracy influence coefficient is used to measure the impact of changes in the difference area range on the defect location accuracy. The size of the difference area is directly related to the boundary extraction accuracy of the defect. A smaller difference area can capture the details of the defect more accurately, especially for edge or small-scale defects, and can effectively reduce the positioning error. However, a too small difference area may cause interference from background noise or miss some information about larger defects. On the contrary, although a larger difference area can cover a wider area, it may lead to inaccurate defect location, especially for smaller defects or those with unclear edges, which are prone to overfitting or inaccurate positioning. Therefore, the defect location accuracy influence coefficient can quantify the positioning error and contour fitting by analyzing the impact of the difference area range on the actual defect position, thereby helping to evaluate the defect detection effect under different difference area ranges.
[0035] The defect location accuracy influence coefficient is analyzed to evaluate the effect of defect detection under different difference area ranges, thereby solving the problem that the difference area range selection is not standardized in the prior art, lacks a dynamic adjustment mechanism to adapt to different defect types, leads to information omission or noise interference, and seriously restricts the accuracy and applicability of defect detection. It has the following advantages: Accurate positioning: By dynamically adjusting the difference area range, the defect area can be accurately extracted according to the characteristics of different defect types, reducing errors and ensuring the accuracy of defect positioning.
[0036] Strong adaptability: This method can automatically optimize the difference area range according to the shape, size and edge characteristics of different defects, adapt to various types of defect detection, and avoid inaccurate positioning caused by fixed area settings.
[0037] Noise suppression: By optimizing the size of the difference area, noise interference can be effectively suppressed, the impact of background noise on defect detection can be reduced, and robustness and stability can be improved.
[0038] Improve detection accuracy: By accurately calculating the defect location accuracy influence coefficient, optimization adjustments can be made under different difference area ranges, thereby improving the overall accuracy and reliability of defect detection, especially in complex detection environments.
[0039] Dynamic adjustment mechanism: It has the ability to dynamically adjust the range of the difference area, and can flexibly adjust according to different situations in the actual detection environment, improve the adaptability of defect detection, and avoid omissions or misdetections of various defect types.
[0040] By introducing the defect location accuracy influence coefficient, this method can effectively make up for the unreasonable difference area selection problem in traditional technology, thereby improving the overall performance of the defect detection system.
[0041] The specific method for obtaining the defect location accuracy influence coefficient is as follows: Obtain the intensity changes of terahertz wave signals at different terahertz wave frequencies and beam widths, as well as the fluctuations in wall thickness distribution, and build a wall thickness positioning accuracy evaluation model through signal processing algorithms; The wall thickness positioning accuracy evaluation model is clustered; Extract features from the processed wall thickness positioning accuracy assessment model, and calculate the measurement accuracy assessment coefficient based on the wall thickness measurement error, positioning error and noise interference; The measurement accuracy under different terahertz wave frequencies and beam widths is simulated through the wall thickness positioning accuracy evaluation model, and the accuracy timeliness model is established to obtain the accuracy timeliness evaluation coefficient; the defect positioning accuracy influence coefficient is calculated in combination with the measurement accuracy evaluation coefficient.
[0042] The specific calculation formula of the measurement accuracy evaluation coefficient is as follows:
[0043] The specific calculation formula of the accuracy and timeliness evaluation coefficient is as follows:
[0044] The specific calculation formula of the defect location accuracy influence coefficient is as follows:
[0045] In the formula, is the measurement accuracy evaluation coefficient, is the accuracy and timeliness evaluation coefficient, is the defect location accuracy influence coefficient, is the deviation value, is the terahertz wave energy consumption under different terahertz wave frequencies and beam widths, is the penetration range under different terahertz wave frequencies and beam widths, is the positioning feedback rate, is the positioning error, is the signal propagation model, is the signal propagation loss, To measure the stability of the system, This is the penetration time adjustment item.
[0046] The robustness fluctuation anomaly coefficient is used to measure the stability and reliability of the defect detection system under different environmental conditions, especially in the case of changes in illumination, angle changes or noise interference. This coefficient describes the impact of the difference area size on the robustness of the system. Larger or smaller difference areas may make the detection algorithm too sensitive to environmental changes, resulting in instability in the detection results. By evaluating the error rate (such as the number of false detections and missed detections), the robustness fluctuation anomaly coefficient can reflect the fault tolerance of the detection system under different environmental conditions. The calculation of this coefficient helps to optimize the difference area range, ensure that defect detection can maintain a high degree of stability in various complex environments, avoid error fluctuations caused by environmental changes, and thus improve the reliability and practicality of the detection results.
[0047] The robustness fluctuation anomaly coefficient is analyzed to evaluate the effect of defect detection under different difference area ranges, thereby solving the problem that the difference area range selection is not standardized in the prior art, lacks a dynamic adjustment mechanism to adapt to different defect types, leads to information omission or noise interference, and seriously restricts the accuracy and applicability of defect detection. It has the following advantages: Solve the problem of irregular selection of difference area range: In the existing technology, the selection of difference area range often lacks a unified standard or adaptive adjustment mechanism, resulting in unstable or inaccurate detection results. The robust fluctuation anomaly coefficient helps identify and correct these irregular area selection problems by evaluating the stability of the detection results under different difference area ranges, ensuring that the setting of the difference area can better meet the detection task requirements.
[0048] Dynamic adjustment mechanism to adapt to different defect types: When facing different defect types, the difference area range of traditional methods usually does not have the ability to adapt, resulting in some defects being missed or excessive noise interference affecting the results. The robust fluctuation anomaly coefficient can dynamically adjust the difference area range according to the environment and defect type, thereby achieving more accurate detection of different defect types and improving the detection effect.
[0049] Reduce information omission and noise interference: In complex environments, light, stains or other interference factors may lead to false detection or missed detection. The robustness fluctuation anomaly coefficient helps the detection system adjust the difference area range by analyzing the fluctuation of the detection results in different environments, reducing noise interference and information omission, thereby improving the accuracy and stability of defect detection.
[0050] Improve the accuracy and applicability of the detection system: Through the evaluation of the robustness fluctuation anomaly coefficient, the difference area range can be dynamically adjusted so that the system can maintain a high detection accuracy under various environmental conditions. This adjustment mechanism solves the shortcomings of traditional systems that cannot adapt under specific conditions and improves the applicability of the system in different application scenarios.
[0051] The specific method for obtaining the robust fluctuation anomaly coefficient is as follows: Based on the defect detection process under different difference area ranges, a set of events of the influence of various preset environmental conditions on the detection results is obtained, wherein the set of events of the influence of various preset environmental conditions on the detection results includes abnormal detection results caused by various environmental conditions, and a weighted valuation is performed on the abnormal detection results based on historical data; A regression model is constructed based on the event set and corresponding scores of the impact of various preset environmental conditions on the detection results to generate a robust fluctuation anomaly coefficient.
[0052] The specific calculation formula of the robust fluctuation anomaly coefficient is as follows: In the formula, is the robust fluctuation anomaly coefficient, … is the weight estimation corresponding to the influencing events of the defect detection process at different resolutions, … is the proportion of influencing events of the defect detection process at different resolutions to all influencing events of the defect detection process, is the corresponding recall rate of the influencing events of the defect detection process at different resolutions, n is the number of the influencing events of the defect detection process at different resolutions, and e is a natural number.
[0053] The noise suppression anomaly coefficient is used to describe the ability of the difference area range to suppress the influence of noise during the defect detection process. The choice of the difference area range directly affects the performance of noise in the detection results. A difference area that is too large may include background noise together with the defect signal, causing noise to interfere with the detection results; while a difference area that is too small may not be able to effectively remove noise, causing the noise to mix with the actual defect signal, thus affecting the detection accuracy. The noise suppression anomaly coefficient calculates the ratio between noise and defects and evaluates the noise suppression effect of different difference areas, thereby optimizing the detection system, ensuring effective noise suppression under different environmental conditions, and improving the accuracy and stability of defect detection.
[0054] The noise suppression anomaly coefficient is analyzed to evaluate the effect of defect detection under different difference area ranges, thereby solving the problem that the difference area range selection in the prior art is not standardized, lacks a dynamic adjustment mechanism to adapt to different defect types, leads to information omission or noise interference, and seriously restricts the accuracy and applicability of defect detection. It has the following advantages: Enhanced detection stability: Through quantitative analysis of noise suppression capabilities, the noise suppression anomaly coefficient helps identify the most appropriate difference area range to avoid the impact of too large or too small areas on noise. Ensure that under different environmental conditions, the system can stably output accurate defect detection results and improve detection stability.
[0055] Improve defect location accuracy: By optimizing the selection of the difference area, the noise suppression anomaly coefficient avoids the interference of background noise on defect location, improves the precision and accuracy of defect location, and thus makes the defect detection results more reliable.
[0056] Support dynamic adjustment: The noise suppression anomaly coefficient provides a dynamic adjustment mechanism for the defect detection system, which can adaptively adjust the difference area range according to different defect types and environmental changes. This solves the problem of the lack of dynamic adjustment mechanism to adapt to different defect types in the existing technology, allowing the system to flexibly respond to various detection scenarios.
[0057] Reduce information omission: Reasonable selection of the difference area range and noise suppression can effectively avoid information omission caused by too small an area, ensuring that all potential defects can be identified and detected.
[0058] Improve system adaptability: By effectively suppressing noise, the interference of external factors (such as changes in ambient light, surface stains, etc.) on the detection system is reduced, the adaptability and accuracy of the system in various complex environments are improved, and the application scope of detection is expanded.
[0059] In summary, the noise suppression anomaly coefficient solves key problems such as noise interference and information omission in evaluating and optimizing the difference area range, improves the accuracy, stability and applicability of the defect detection system, and enables the system to better cope with different defect types and complex environmental conditions.
[0060] The specific method for obtaining the noise suppression anomaly coefficient is as follows: Obtain the ratio of several noise signals to defect signals at different terahertz wave frequencies and beam widths; Calculate the noise suppression standard deviation and the noise suppression average value of the ratio of several noise signals to defect signals under different terahertz wave frequencies and beam widths; Calculate the coefficient of variation of the ratio of noise signal to defect signal based on the noise suppression standard deviation and noise suppression mean value; The noise suppression anomaly coefficient is calculated based on the preset noise suppression anomaly coefficient calculation formula by using the ratio variation coefficient of the noise signal to the defect signal.
[0061] The specific calculation formula of the ratio variation coefficient of the noise signal to the defect signal is as follows:
[0062] The specific calculation formula of the noise suppression anomaly coefficient is as follows:
[0063] In the formula, is the coefficient of variation of the ratio of noise signal to defect signal, is the ratio of the jth noise signal to the defect signal, is the total number of data collected under different terahertz wave frequencies and beam widths, and j is the data number; is the noise suppression anomaly coefficient.
[0064] This embodiment combines mature image processing technologies, such as Canny edge detection, contour extraction, and minimum circumscribed circle calculation, to accurately extract defect features. By dynamically adjusting the difference area range and combining expansion and corrosion operations, it effectively adapts to different defect types and shapes, significantly improving the accuracy and robustness of detection. In addition, the reliability of defect identification is further improved through comprehensive analysis of hue consistency, similarity vectors, and difference vectors. The introduction of the defect location accuracy influence coefficient and the robustness fluctuation anomaly coefficient solves the problems of false detection and missed detection caused by unreasonable selection of difference areas in traditional methods, and realizes efficient and stable defect detection. It is suitable for a variety of complex detection environments and has strong practical value and innovation.
[0065] Embodiment 2, S5, constructing a difference area range assessment model based on a convolutional neural network according to the defect location data and the detection robustness data; The difference area range assessment model is constructed based on the convolutional neural network according to the defect location data and the detection robustness data, specifically: The acquired defect location accuracy influence coefficient, robustness fluctuation anomaly coefficient and noise suppression anomaly coefficient are used to establish a regional range assessment model to generate a regional range assessment coefficient; The specific calculation formula of the difference area range evaluation coefficient is as follows:
[0066] In the formula, is the defect location accuracy influence coefficient, is the robust fluctuation anomaly coefficient, is the noise suppression anomaly coefficient, is the difference area range assessment coefficient, is the preset proportional coefficient of the defect location accuracy influence coefficient, is the preset proportional coefficient of the robust fluctuation anomaly coefficient, A preset scaling factor for the noise suppression anomaly factor.
[0067] S6, constructing a difference area range-detection effect relationship curve according to the output of the difference area range evaluation model and the corresponding difference area range, and performing data analysis to obtain the adjusted difference area range, and applying it to the defect detection of PVC plastic pipe accessories.
[0068] The difference area range-detection effect relationship curve is constructed according to the output of the difference area range evaluation model and the corresponding difference area range, specifically: Obtaining difference area range assessment coefficients of outputs under different adjustable difference area ranges from the area range assessment model; The X-axis is set as the difference area range, and the Y-axis is represented as the difference area range evaluation coefficient, and a rectangular coordinate system is established; The difference area range evaluation coefficients corresponding to each difference area range are marked on the rectangular coordinate system to form marking points, which are smoothed by interpolation method to obtain the difference area range-effect curve.
[0069] The data analysis is performed to obtain the adjusted difference area range, and applied to the defect detection of PVC plastic pipe fittings, specifically: The difference area range corresponding to each maximum value of the difference area range-effect curve is screened to obtain a first candidate set; The minimum values of the integrals on the difference area range-effect curve corresponding to each difference area range in the first candidate set are compared, and the difference area range with the smallest comparison result is used as the adjusted difference area range and applied to PVC plastic pipe fittings defect detection.
[0070] This embodiment realizes the quantitative analysis of the key parameters of the detection process by constructing a difference area range evaluation model through the defect location accuracy influence coefficient, robustness fluctuation anomaly coefficient and noise suppression anomaly coefficient in combination with a convolutional neural network. The construction and data analysis of the difference area range-detection effect relationship curve make it possible to accurately screen out the optimal difference area range in a variety of complex detection environments. Finally, the interpolation method and integral minimum value screening strategy are used to dynamically adjust the difference area range, which improves the detection accuracy, robustness and noise resistance, while reducing the probability of false detection and missed detection. This method not only realizes efficient defect detection, but also has strong versatility and scalability. It is suitable for other similar industrial detection scenarios and embodies great technical innovation and application value.
[0071] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0072] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product.
[0073] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0074] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0075] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0076] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting defects in PVC plastic pipe fittings based on machine vision, characterized in that: The steps include: Obtain images of PVC plastic pipe fittings, extract image defect contours through edge detection, and calculate the minimum circumscribed circle of the defect contours; An initial difference region range is set based on the geometric features of the defect contour, and the initial difference region range is subjected to several expansion operations and erosion operations to obtain several adjustable difference region ranges; Calculate the hue consistency, similarity vector and difference vector between several adjustable difference regions and the minimum circumscribed circle respectively to perform defect detection; Obtain defect location data and detection robustness data of defect detection under different adjustable difference area ranges respectively; According to the defect location data and the detection robustness data, a difference area range assessment model is constructed based on a convolutional neural network. According to the output of the difference area range evaluation model and the corresponding difference area range, a difference area range-detection effect relationship curve is constructed, and data analysis is performed to obtain the adjusted difference area range, which is then applied to the defect detection of PVC plastic pipe fittings.
2. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 1, characterized in that: The method of acquiring an image of a PVC plastic pipe fitting, extracting the image defect contour by edge detection, and calculating and generating the minimum circumscribed circle of the defect contour is as follows: Acquire images of PVC plastic pipe fittings and pre-process the acquired original images; Perform edge detection based on the Canny algorithm to obtain an edge image; Detect all contours in the edge image based on OpenCV and obtain the coordinate points of the contours; According to the coordinate points of the contour, the minimum circumscribed circle of the contour is calculated based on OpenCV.
3. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 2, characterized in that: The initial difference area range is set based on the geometric features of the defect contour, specifically: Calculate the minimum enclosing rectangle of the defect contour based on OpenCV; The center of the difference area is set as the center point of the minimum circumscribed rectangle, and the width and height of the minimum circumscribed rectangle are used to increase the preset margin to obtain the initial difference area range; The initial difference region range is subjected to several expansion operations and corrosion operations to obtain several adjustable difference region ranges, specifically: Based on the preset structural element, the initial difference area is expanded by cv2.dilate(), and the initial difference area is eroded by cv2.erode(); Through several dilation operations and erosion operations, several adjustable difference region ranges are obtained.
4. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 3, characterized in that: The color consistency, similarity vector and difference vector between the adjustable difference area range and the minimum circumscribed circle are calculated respectively to perform defect detection, specifically: Extract the H channel data in the HSV image; for each difference area range, calculate the hue value of each pixel in the area; For the area enclosed by the minimum circumscribed circle, calculate the hue value of the H channel in the area; The hue consistency is obtained by calculating the mean difference between the hue value of the pixels within the difference area and the hue value of the pixels in the minimum circumscribed circle area; Based on the Euclidean distance, the pixel-level similarity between the difference area range and the minimum circumscribed circle area is calculated to obtain a similarity vector; Calculate a disparity vector based on the absolute difference of pixel values; The detection results are comprehensively analyzed by combining hue consistency, similarity vector and difference vector.
5. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 4, characterized in that: The defect location data includes a defect location accuracy influence coefficient; the specific method for obtaining the defect location accuracy influence coefficient is as follows: Obtain the intensity changes of terahertz wave signals at different terahertz wave frequencies and beam widths, as well as the fluctuations in wall thickness distribution, and build a wall thickness positioning accuracy evaluation model through signal processing algorithms; The wall thickness positioning accuracy evaluation model is clustered; Extract features from the processed wall thickness positioning accuracy assessment model, and calculate the measurement accuracy assessment coefficient based on the wall thickness measurement error, positioning error and noise interference; The measurement accuracy under different terahertz wave frequencies and beam widths is simulated through the wall thickness positioning accuracy evaluation model, and the accuracy timeliness model is established to obtain the accuracy timeliness evaluation coefficient; the defect positioning accuracy influence coefficient is calculated in combination with the measurement accuracy evaluation coefficient.
6. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 5, characterized in that: The detection robustness data includes a robustness fluctuation anomaly coefficient and a noise suppression anomaly coefficient; the specific method for obtaining the robustness fluctuation anomaly coefficient is as follows: Based on the defect detection process under different difference area ranges, a set of events of the influence of various preset environmental conditions on the detection results is obtained, wherein the set of events of the influence of various preset environmental conditions on the detection results includes abnormal detection results caused by various environmental conditions, and a weighted valuation is performed on the abnormal detection results based on historical data; A regression model is constructed based on the event set and corresponding scores of the impact of various preset environmental conditions on the detection results to generate a robust fluctuation anomaly coefficient.
7. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 6, characterized in that: The specific method for obtaining the noise suppression anomaly coefficient is as follows: Obtain the ratio of several noise signals to defect signals at different terahertz wave frequencies and beam widths; Calculate the noise suppression standard deviation and the noise suppression average value of the ratio of several noise signals to defect signals under different terahertz wave frequencies and beam widths; Calculate the coefficient of variation of the ratio of noise signal to defect signal based on the noise suppression standard deviation and noise suppression mean value; The noise suppression anomaly coefficient is calculated based on the preset noise suppression anomaly coefficient calculation formula by using the ratio variation coefficient of the noise signal to the defect signal.
8. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 7, characterized in that: The difference area range-detection effect relationship curve is constructed according to the output of the difference area range evaluation model and the corresponding difference area range, specifically: Obtaining difference area range assessment coefficients of outputs under different adjustable difference area ranges from the area range assessment model; The X-axis is set as the difference area range, and the Y-axis is represented as the difference area range evaluation coefficient, and a rectangular coordinate system is established; The difference area range evaluation coefficients corresponding to each difference area range are marked on the rectangular coordinate system to form marking points, which are smoothed by interpolation method to obtain the difference area range-effect curve.
9. A method for detecting defects of PVC plastic pipe fittings based on machine vision according to claim 8, characterized in that: The data analysis is performed to obtain the adjusted difference area range, and applied to the defect detection of PVC plastic pipe fittings, specifically: The difference area range corresponding to each maximum value of the difference area range-effect curve is screened to obtain a first candidate set; The minimum values of the integrals on the difference area range-effect curve corresponding to each difference area range in the first candidate set are compared, and the difference area range with the smallest comparison result is used as the adjusted difference area range and applied to PVC plastic pipe fittings defect detection.
10. A device using a PVC plastic pipe fitting defect detection method based on machine vision as described in any one of claims 1 to 9, characterized in that: It includes a circumscribed circle acquisition module, an adjustable difference area range acquisition module, a defect detection module, a data analysis module, a difference area range evaluation module and a difference area range screening module; The circumscribed circle acquisition module is used to acquire images of PVC plastic pipe fittings, extract image defect contours through edge detection, and calculate and generate the minimum circumscribed circle of the defect contour; An adjustable difference region range acquisition module is used to set an initial difference region range based on the geometric features of the defect contour, and perform several expansion operations and erosion operations on the initial difference region range to obtain several adjustable difference region ranges; A defect detection module is used to calculate the hue consistency, similarity vector and difference vector between several adjustable difference area ranges and the minimum circumscribed circle to perform defect detection; A data analysis module, used to respectively obtain defect location data and detection robustness data of defect detection under different adjustable difference area ranges; A difference area range assessment module is used to construct a difference area range assessment model based on a convolutional neural network according to defect location data and detection robustness data; The difference area range screening module is used to construct a difference area range-detection effect relationship curve according to the output of the difference area range evaluation model and the corresponding difference area range, and perform data analysis to obtain the adjusted difference area range, which is applied to the defect detection of PVC plastic pipe accessories.
Citation Information
Patent Citations
PVC plastic pipe orifice defect detection method based on image processing
CN116630332A
Method and device for identifying and locating top bud of main stalk based on terahertz light
CN107389594A
Underwater sensor node positioning method based on layered ocean current model
CN110730415A
Corrosion imaging method based on ultrasonic guided waves and convolutional neural network
CN113848252A
Terahertz imaging cable defect detection method and device
CN118111998A