A method and system for detecting puncturing quality in combination with image contrast similarity
By constructing a dynamic template library and setting dynamic compensation coefficients, the problem of false alarms in drilling quality inspection caused by tool wear was solved, achieving efficient drilling quality inspection and adapting to wear changes throughout the tool's entire life cycle.
Patent Information
- Application Number
- CN202610488363.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-14
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, static templates cannot adapt to feature drift caused by tool wear, resulting in a high false alarm rate in drilling quality detection and affecting production line operating efficiency.
By loading the wear data of the target drilling tool, a dynamic template library is constructed, matching the wear stage templates, and setting a dynamic compensation coefficient based on the wear confidence level. Joint image comparison is then performed to dynamically correct the similarity score and update the template library.
It achieves adaptive matching of the detection template to the wear state of the tool throughout its entire life cycle, reducing the false alarm rate and improving the accuracy of drilling quality detection and production line operating efficiency.
Smart Images

Figure CN122115416A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method and system for detecting punch quality based on combined image comparison similarity. Background Technology
[0002] In the field of drilling, visual inspection technology is widely used for online monitoring of workpiece hole quality. Traditional visual inspection methods often employ static template matching, which involves pre-collecting a standard hole image as a template and determining the pass / fail status of the current hole by comparing the similarity of the combined images. However, in actual production, cutting tools gradually wear down with each machining cycle, causing regular changes in the edge sharpness, roundness, and burr morphology of the machined holes. Static templates cannot adapt to this feature drift caused by physical wear, easily misjudging qualified holes as defects, resulting in frequent production line downtime and a persistently high false alarm rate.
[0003] In existing technologies, the "A Method and System for Detecting the Status of Boring Tools for Intersection Holes" (application number CN202411294167.3) proposed by Huazhong University of Science and Technology monitors the wear degree of the tool itself through machining timing signals and rake face images. However, this method only focuses on the health status of the tool and does not use wear information for visual inspection of workpiece hole quality, thus failing to solve the problem of false alarms in hole detection caused by tool wear. The "Rapid Detection System for Full-Layout Defects Based on Pattern Matching and Classification" (application number CN202510600509.8) disclosed by Shanghai Xinwushuang Simulation Technology Co., Ltd. introduces a dynamic template generation mechanism and constructs defect templates from real-time data through clustering algorithms. However, its application scenario is the detection of micro-defects in semiconductor wafers. Template generation relies on image feature clustering, lacks prior utilization of the physical laws of tool wear in machining, and does not establish a mapping relationship between wear stages and templates, making it difficult to directly transfer to the drilling quality inspection scenario.
[0004] Therefore, there is an urgent need for a drilling quality inspection method that can adapt to the tool wear state and dynamically adjust the inspection template to eliminate false alarms caused by normal wear and improve inspection accuracy and production line operating efficiency. Summary of the Invention
[0005] This invention addresses the problem in existing technologies where static templates cannot adapt to feature drift caused by physical wear, easily misjudging qualified holes as defects, leading to frequent production line downtime and a persistently high false alarm rate. It provides a hole-punching quality detection method and system that combines image comparison and similarity to solve this problem.
[0006] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: In a first aspect, the present invention provides a method for detecting punch quality based on joint image comparison similarity, comprising: Load the current wear data of the target drilling tool; Based on the current wear data, a corresponding wear stage template is matched from a preset dynamic template library, and a wear confidence score associated with the wear stage template is generated and stored. The dynamic template library contains standard template images associated with several wear stages, corresponding feature vector sets, and the wear confidence score. Acquire images of the hole positions on the workpiece to be tested, and extract images of the holes to be tested; Based on the wear confidence level, a dynamic compensation coefficient for joint image comparison is set, and the wear stage template is invoked; The image of the hole to be tested is compared with the wear stage template to calculate the similarity. The similarity is then weighted and corrected based on the dynamic compensation coefficient to obtain the corrected comprehensive similarity score. Based on the corrected comprehensive similarity score and the preset dynamic threshold, the punching quality detection result is output, and the wear confidence is reversed according to the punching quality detection result, and the dynamic template library is updated.
[0007] Optionally, load the current wear data of the target drilling tool, including: Load the tool's own parameters for the target drilling tool, wherein the tool's own parameters include at least the tool material parameters; Load the historical machining condition parameters and historical workpiece parameters of the target drilling tool since it entered service. The historical machining condition parameters include at least cutting speed and feed rate, cooling and lubrication conditions, and machining frequency. The historical workpiece parameters include at least workpiece hardness and workpiece strength. The tool's own parameters, historical machining condition parameters, and historical machined workpiece parameters are stored as the current wear data.
[0008] Optionally, based on the current wear data, a corresponding wear stage template is matched from a preset dynamic template library, and a wear confidence score associated with and stored with the wear stage template is generated simultaneously, including the following: Collect a set of historical machining images of the target drilling tool model throughout its entire life cycle, wherein the set of historical machining images includes images of qualified workpieces corresponding to several machining sequences; Collect historical wear data corresponding to each machining sequence. The historical wear data includes tool parameters, historical machining condition parameters, and historical workpiece parameters. The entire life cycle is divided into several consecutive wear stages, and a corresponding wear data range is assigned to each wear stage. Extract the qualified workpiece image corresponding to each wear stage, perform feature extraction, and generate a stage standard template corresponding to each wear stage. The stage standard template includes contour feature vector, grayscale distribution features, and geometric parameter benchmark. The confidence level of each stage standard template is calibrated, and the degree of agreement between the features of the stage standard template and the features of the samples in the corresponding wear data interval is used as the wear confidence level. This is then associated with and stored in the corresponding wear data interval to construct the dynamic template library.
[0009] The confidence level of the standard template for each stage is calibrated, including: Obtain the individual feature dispersion of each historical processing image in the historical processing image set corresponding to each wear stage; Calculate the average similarity between the feature vector of the stage standard template and the feature vector of each historical processed image; The wear confidence score is generated by weighted calculation based on the individual feature dispersion and the average similarity, wherein the individual feature dispersion is negatively correlated with the wear confidence score, and the average similarity is positively correlated with the wear confidence score.
[0010] Optionally, based on the wear confidence level, a dynamic compensation coefficient for joint image comparison is set, including: A first confidence threshold and a second confidence threshold are preset, wherein the first confidence threshold is greater than the second confidence threshold; When the wear confidence level is higher than the first confidence threshold, the dynamic compensation coefficient is set to a first coefficient range, in which the contour feature weight is higher than the geometric feature weight. When the wear confidence level is lower than the second confidence threshold, the dynamic compensation coefficient is set to the second coefficient interval, in which the weight of geometric features is higher than the weight of contour features. When the wear confidence level is greater than or equal to the second confidence threshold and less than or equal to the first confidence threshold, the dynamic compensation coefficient is set to an intermediate coefficient range that is linearly correlated with the wear confidence level.
[0011] Specifically, the image of the hole to be tested is compared with the wear stage template to calculate the similarity. The similarity is then weighted and corrected based on the dynamic compensation coefficient to obtain a corrected comprehensive similarity score, including: Extract the hole edge contour point set from the hole image to be tested, and calculate the Hausdorff distance with the contour feature vector of the wear stage template to obtain the initial contour similarity score; Within a preset region of interest, the structural similarity index between the image of the hole to be tested and the wear stage template is calculated and used as the initial structural similarity score. The geometric parameters of the image of the hole to be tested are measured, and the difference is calculated with the geometric parameter reference of the wear stage template to obtain the initial geometric deviation score; The dynamic compensation coefficient is multiplied by the initial contour similarity score, the initial structural similarity score, and the initial geometric deviation score to obtain the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score. The corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are weighted and fused to obtain the corrected comprehensive similarity score.
[0012] Optionally, based on the corrected comprehensive similarity score and a preset dynamic threshold, a punching quality detection result is output, and the wear confidence is reverse-corrected according to the punching quality detection result, and the dynamic template library is updated, including: When the corrected overall similarity score is greater than or equal to the dynamic threshold, a qualified identifier is output, and a first adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is increased by the corresponding first adjustment step size. When the corrected overall similarity score is less than the dynamic threshold, the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are compared with their respective individual thresholds, the corresponding defect type is output, and a second adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is lowered by the corresponding second adjustment step size. The adjusted wear confidence is re-associated with the current wear data, and the wear confidence of the corresponding wear stage template in the dynamic template library is updated.
[0013] Optional, also includes: Obtain the number of false alarms and missed alarms caused by normal tool wear during the historical detection cycle for the target drilling tool; Calculate the ratio of the number of false alarms to the number of missed alarms, and set it as the threshold adjustment coefficient; Obtain the hardness fluctuation range and working condition fluctuation range of the workpiece material in the current batch, and calculate the environmental disturbance coefficient based on the hardness fluctuation range and working condition fluctuation range. The dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level.
[0014] Specifically, the dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level, including: The product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient is calculated as the basic threshold adjustment amount; Obtain the current wear confidence level and normalize the wear confidence level to a preset confidence influence coefficient range to obtain the confidence influence coefficient; Multiply the basic threshold adjustment amount by the confidence level influence coefficient to obtain the dynamic threshold adjustment amplitude; The dynamic threshold adjustment amplitude is added to the dynamic threshold of the previous detection cycle to obtain the dynamic threshold of the current detection cycle.
[0015] Secondly, the present invention provides a punching quality detection system based on joint image comparison similarity, comprising: Wear data loading module, used to load the current wear data of the target drilling tool; The wear confidence acquisition module is used to match the corresponding wear stage template from a preset dynamic template library based on the current wear data, and at the same time generate a wear confidence associated with the wear stage template. The dynamic template library includes standard template images, corresponding feature vector sets, and the wear confidence associated with several wear stages. The hole image extraction module is used to acquire hole position images of the workpiece to be tested and extract the hole images. The dynamic compensation coefficient configuration module is used to set the dynamic compensation coefficient for joint image comparison based on the wear confidence level, and to call the wear stage template. The comprehensive similarity score acquisition module is used to perform joint image comparison between the image of the hole to be tested and the wear stage template, calculate the similarity, and weight and correct the similarity based on the dynamic compensation coefficient to obtain the corrected comprehensive similarity score. The quality inspection result acquisition module is used to output the punching quality inspection result based on the corrected comprehensive similarity score and the preset dynamic threshold, and to reverse correct the wear confidence based on the punching quality inspection result and update the dynamic template library.
[0016] By implementing this invention, it is possible to load the current wear data of the target drilling tool; obtain wear-related data from multiple dimensions such as the tool itself, the machining process, and the machined object, which can accurately reflect the actual wear state of the tool, avoid the one-sidedness of wear judgment based on single-dimensional data, and lay an accurate data foundation for subsequent template matching and detection calibration.
[0017] By implementing this invention, it is possible to match corresponding wear stage templates from a preset dynamic template library based on the current wear data, and simultaneously generate wear confidence scores associated with the wear stage templates. The dynamic template library includes standard template images associated with each wear stage, corresponding feature vector sets, and the wear confidence scores. This overcomes the limitations of traditional static templates, achieving precise matching of detection templates for different tool wear stages, allowing the detection templates to adapt to the feature drift of physical wear on the tool. The generation of wear confidence scores quantifies the reliability of template matching, providing a quantitative basis for setting subsequent dynamic compensation coefficients and improving the targeting of the detection.
[0018] By implementing this invention, it is possible to acquire hole position images of the workpiece to be tested and extract images of the holes to be tested; it is possible to focus on detecting the core area, reduce the interference of irrelevant image information on subsequent similarity calculation, improve the efficiency and accuracy of feature extraction and comparison calculation, and ensure the relevance and effectiveness of subsequent image comparison.
[0019] By implementing this invention, it is possible to: set dynamic compensation coefficients for joint image comparison based on the wear confidence level, and call the wear stage template; achieve dynamic adaptive adjustment of the compensation coefficients; differentiate the weights of features such as contour and geometry for different wear confidence levels, so that subsequent similarity corrections are more in line with the actual detection needs of current tool wear; and accurately call the matching template to ensure that the benchmark for image comparison is consistent with the tool wear state.
[0020] By implementing this invention, it is possible to perform joint image comparison between the image of the hole to be tested and the template at the wear stage, calculate the similarity, and then weight and correct the similarity based on the dynamic compensation coefficient to obtain a corrected comprehensive similarity score. Multi-dimensional image comparison can comprehensively characterize the degree of matching between the hole to be tested and the standard template, avoiding the omissions of single-dimensional comparison. Through the weighted correction of the dynamic compensation coefficient, the influence of feature deviations caused by normal tool wear on the similarity judgment is eliminated, so that the comprehensive similarity score can truly reflect the actual quality of drilling, rather than the apparent differences caused by tool wear.
[0021] By implementing this invention, it is possible to output drilling quality detection results based on the corrected comprehensive similarity score and a preset dynamic threshold, and to reverse-correct the wear confidence level based on the drilling quality detection results, and update the dynamic template library, thereby achieving accurate judgment of drilling quality, clarifying defect types, and providing specific basis for production adjustments; the reverse correction of wear confidence level based on detection results allows the confidence level to be dynamically optimized according to actual detection conditions, improving the accuracy of subsequent compensation coefficient settings; the continuous updating of the dynamic template library allows the templates to adapt to the dynamic changes in tool wear, while accumulating detection data, realizing the self-learning and self-optimization of the detection model.
[0022] In summary, by implementing this invention, the detection template can be adaptively matched to the wear state of the drilling tool throughout its entire life cycle, effectively eliminating false alarms in drilling quality detection caused by normal physical wear of the tool. Simultaneously, through multi-dimensional image comparison and dynamic weighted correction, the accuracy of drilling quality detection is improved. Combined with the self-updating and self-optimizing template library, the detection system can continuously adapt to changes in tool wear and operating conditions during the production process, significantly reducing the frequency of production line downtime due to false alarms and improving the operating efficiency and intelligent detection level of the drilling production line. Attached Figure Description
[0023] Figure 1 A flowchart illustrating a punch quality detection method based on joint image comparison similarity provided by the present invention; Figure 2 This is a schematic diagram of a punch quality detection system based on joint image comparison similarity provided by the present invention.
[0024] In the attached diagram, the components represented by each number are as follows: Wear data loading module 11, wear confidence acquisition module 12, image extraction module for hole under test 13, dynamic compensation coefficient configuration module 14, comprehensive similarity score acquisition module 15, and quality inspection result acquisition module 16. Detailed Implementation
[0025] Example 1, as Figure 1 As shown, this embodiment of the invention provides a method for detecting punch quality based on joint image comparison similarity, including: S100: Load the current wear data of the target drilling tool; S200: Based on the current wear data, match the corresponding wear stage template from the preset dynamic template library, and simultaneously generate a wear confidence score associated with the wear stage template. The dynamic template library includes standard template images, corresponding feature vector sets, and the wear confidence scores that are associated with several wear stages. S300: Acquire images of the hole positions on the workpiece to be tested and extract images of the holes to be tested; S400: Based on the wear confidence level, set the dynamic compensation coefficient for joint image comparison and call the wear stage template; S500: Compare the image of the hole to be tested with the wear stage template to calculate the similarity, and adjust the similarity based on the dynamic compensation coefficient to obtain the adjusted comprehensive similarity score; S600: Based on the corrected comprehensive similarity score and the preset dynamic threshold, output the punching quality detection result, and reverse correct the wear confidence based on the punching quality detection result, and update the dynamic template library.
[0026] In step S100 of this application embodiment, loading the current wear data of the target drilling tool includes: Load the tool's own parameters for the target drilling tool, wherein the tool's own parameters include at least the tool material parameters; Load the historical machining condition parameters and historical workpiece parameters of the target drilling tool since it entered service. The historical machining condition parameters include at least cutting speed and feed rate, cooling and lubrication conditions, and machining frequency. The historical workpiece parameters include at least workpiece hardness and workpiece strength. The tool's own parameters, historical machining condition parameters, and historical machined workpiece parameters are stored as the current wear data.
[0027] In step S100 of this application embodiment, the purpose of the above steps is to provide accurate tool wear-related data for matching the corresponding wear stage template from the preset dynamic template library and generating wear confidence, so that the template matching and confidence generation can fit the actual wear state of the tool, avoid false alarms in drilling quality detection caused by the static template being unable to adapt to the physical wear of the tool, and lay the data foundation for the entire adaptive tool wear state drilling quality detection process.
[0028] To achieve the above objectives, it is first necessary to load the tool's own parameters, which include at least the tool material parameters. This step involves extracting the tool's basic attribute data. The tool material parameters are inherent factors that determine the tool's wear characteristics and are the basis for judging the tool's wear state. For example, if the target drilling tool is made of a certain cemented carbide material, then the tool material parameters such as the hardness and wear resistance of that cemented carbide are loaded.
[0029] Then, the historical machining condition parameters and historical workpiece parameters of the target drilling tool since its service are loaded. The historical machining condition parameters include at least cutting speed and feed rate, cooling and lubrication conditions, and machining frequency. The historical workpiece parameters include at least workpiece hardness and workpiece strength. This step involves collecting external machining-related data that affects the wear of the cutting tool after it has been put into use. Working conditions and workpiece parameters directly affect the wear rate and wear pattern of the cutting tool, and are key references for judging the current wear stage of the cutting tool. For example, the cutting speed of the cutting tool since its use is 80m / min, the feed rate is 0.2mm / r, the cooling and lubrication conditions are continuous emulsion spraying, the machining frequency is 500 workpieces in total, and the parameters of the historical workpieces processed are 45 steel, with a workpiece hardness of 220HB and a workpiece strength of 600MPa.
[0030] Finally, the tool's own parameters, historical machining condition parameters, and historical machined workpiece parameters are stored as the current wear data.
[0031] This step involves integrating and storing the various scattered data extracted above to form a complete dataset that reflects the current wear state of the tool. This makes it easier for subsequent modules to directly call and analyze the dataset. For example, the parameters of the loaded cemented carbide material, historical machining conditions such as cutting speed and feed rate, and historical workpiece parameters such as the hardness and strength of 45 steel are integrated and stored as the current wear data of the target drilling tool.
[0032] In step S200 of this embodiment, based on the current wear data, a corresponding wear stage template is matched from a preset dynamic template library, and a wear confidence score associated with and stored with the wear stage template is generated simultaneously. This includes the following steps: Collect a set of historical machining images of the target drilling tool model throughout its entire life cycle, wherein the set of historical machining images includes images of qualified workpieces corresponding to several machining sequences; Collect historical wear data corresponding to each machining sequence. The historical wear data includes tool parameters, historical machining condition parameters, and historical workpiece parameters. The entire life cycle is divided into several consecutive wear stages, and a corresponding wear data range is assigned to each wear stage. Extract the qualified workpiece image corresponding to each wear stage, perform feature extraction, and generate a stage standard template corresponding to each wear stage. The stage standard template includes contour feature vector, grayscale distribution features, and geometric parameter benchmark. The confidence level of each stage standard template is calibrated, and the degree of agreement between the features of the stage standard template and the features of the samples in the corresponding wear data interval is used as the wear confidence level. This is then associated with and stored in the corresponding wear data interval to construct the dynamic template library.
[0033] In step S200 of this application embodiment, the purpose of the above steps is to construct a preset dynamic template library, which provides a standardized template carrier and data support for matching the corresponding wear stage template based on the current wear data and generating wear confidence. This allows the template matching to accurately correspond to the wear pattern of the tool's entire life cycle, and the generation of wear confidence has a well-calibrated reference basis, thereby realizing the adaptive adaptation of the detection template to the tool wear state and eliminating false alarms in drilling quality detection caused by normal tool wear.
[0034] To achieve the above objectives, it is first necessary to collect a set of historical processing images of the target drilling tool model throughout its entire life cycle. The set of historical processing images includes images of qualified workpieces corresponding to several processing sequences. This step involves collecting image data of qualified drilled workpieces at different processing time points throughout the entire process from the time the tool is put into use to its scrapping. This provides image samples for generating standard templates based on wear stages. For example, images of qualified hole positions are taken once for every 100 workpieces processed by a certain carbide drilling tool from its first processing to its wear and scrapping, and these images are integrated to form a historical processing image set for that tool model.
[0035] Then, historical wear data corresponding to each machining sequence is collected. The historical wear data includes tool parameters, historical machining condition parameters, and historical workpiece parameters. This step involves matching each image sample in the historical processing image set with corresponding tool wear-related data, establishing a correspondence between image features and wear data, and providing data basis for subsequent division of wear stages. For example, for each qualified hole position image taken for processing 100 workpieces, the corresponding tool material parameters and other tool parameters, historical processing condition parameters such as cutting speed and feed rate, and historical processing workpiece parameters such as workpiece hardness and workpiece strength are matched to form historical wear data for each processing sequence.
[0036] Next, the entire life cycle is divided into several consecutive wear stages, and a corresponding wear data range is assigned to each wear stage. This step is based on the physical laws of tool wear, dividing the entire service life of the tool into different wear stages, and defining a corresponding wear data range for each stage to achieve a precise correspondence between wear data and wear stages. For example, the entire life cycle of the aforementioned carbide drilling tool is divided into three consecutive stages: the initial wear stage, the intermediate wear stage, and the late wear stage. The initial wear stage is allocated a wear data range of 0-500 machining cycles, the intermediate wear stage is allocated a wear data range of 501-1500 machining cycles, and the late wear stage is allocated a wear data range of 1501-2000 machining cycles.
[0037] Furthermore, the qualified workpiece image corresponding to each wear stage is extracted, feature extraction is performed, and a stage standard template corresponding to each wear stage is generated. The stage standard template includes contour feature vector, grayscale distribution features, and geometric parameter benchmark. This step involves extracting core features from qualified workpiece images corresponding to each wear stage and generating standardized templates, namely stage standard templates, so that each wear stage has its own exclusive detection reference template. For example, extract all qualified hole images corresponding to the initial wear stage, and obtain the contour feature vector of the hole edge, the gray-scale distribution features of the hole surface, and the geometric parameter benchmarks of the hole diameter and roundness through image feature extraction algorithms, and integrate them to generate the stage standard template for the initial wear stage.
[0038] Finally, the confidence level of each stage standard template is calibrated, and the degree of agreement between the features of the stage standard template and the features of the samples in the corresponding wear data interval is used as the wear confidence level. This is then associated with and stored in the corresponding wear data interval to construct the dynamic template library.
[0039] This step involves calibrating the wear confidence level for each stage's standard template and completing data association and storage, forming a complete and callable dynamic template library. This provides a direct basis for subsequent template matching and confidence level generation. For example, the degree of match between the stage standard template features of the initial wear stage and the features of all sample images within the wear data range of 0-500 machining frequencies is calculated, resulting in a wear confidence level of 0.95 for this stage template. This wear confidence level is then associated and stored with the wear data range of 0-500 machining frequencies and the standard template of the initial wear stage. At the same time, the relevant calibration and storage for the middle and later wear stages are completed, ultimately constructing a dynamic template library for this tool model.
[0040] In step S200 of this application embodiment, the confidence level of each stage standard template is calibrated, including: Obtain the individual feature dispersion of each historical processing image in the historical processing image set corresponding to each wear stage; Calculate the average similarity between the feature vector of the stage standard template and the feature vector of each historical processed image; The wear confidence score is generated by weighted calculation based on the individual feature dispersion and the average similarity, wherein the individual feature dispersion is negatively correlated with the wear confidence score, and the average similarity is positively correlated with the wear confidence score.
[0041] In step S200 of this application embodiment, the purpose of the above steps is to generate a quantified wear confidence score for the stage standard template of each wear stage. The wear confidence score can reflect the degree of consistency between the stage standard template and the sample features in the corresponding wear data interval, providing an accurate quantitative basis for setting the dynamic compensation coefficient for joint image comparison in the future, so that the configuration of the dynamic compensation coefficient can fit the actual reference value of each wear stage template, thereby improving the accuracy of similarity weighted correction in hole quality detection.
[0042] To achieve the above objectives, it is first necessary to obtain the individual feature dispersion of each historical processing image in the historical processing image set corresponding to each wear stage. This step involves statistically analyzing the dispersion of features across all historical processed images corresponding to the wear stage. This dispersion index reflects the consistency of sample features and is a crucial reference indicator for calibrating wear confidence. Furthermore, individual feature dispersion is negatively correlated with wear confidence. For example, by acquiring all qualified hole images from the historical processed image set corresponding to the initial wear stage, and using feature analysis algorithms, the individual feature dispersion of these images in dimensions such as contour feature vector and grayscale distribution is calculated to be 0.05. The specific method for calculating individual feature dispersion using feature analysis algorithms is existing technology and will not be elaborated upon here.
[0043] Next, the average similarity between the feature vector of the stage standard template and the feature vector of each historical processed image is calculated; This step involves calculating the average similarity between the feature vectors of the stage standard template and all historical processed images under the corresponding wear stage. This indicator reflects the overall fit between the stage standard template and the sample features, and is the core indicator for calibrating wear confidence. Moreover, the average similarity is positively correlated with the wear confidence. For example, by calculating the similarity between the feature vector of the stage standard template in the initial wear stage and the feature vectors of all historical processed images under that stage, the similarity values obtained are 0.96, 0.95, 0.97, etc. After calculating the average, the average similarity is 0.96.
[0044] Then, based on the individual feature dispersion and the average similarity, the wear confidence score is generated by weighted calculation, wherein the individual feature dispersion is negatively correlated with the wear confidence score, and the average similarity score is positively correlated with the wear confidence score.
[0045] This step involves quantitative calculations based on the weights and correlations of two core indicators to generate a wear confidence score that accurately reflects the degree of match between the standard template and the corresponding sample features at each stage. For example, a weight of 0.3 is assigned to the individual feature dispersion in the initial wear stage, and a weight of 0.7 is assigned to the average similarity. The wear confidence score is calculated using the preset formula: Wear Confidence Score = Average Similarity × 0.7 - Individual Feature Dispersion × 0.3, resulting in a wear confidence score of 0.96 × 0.7 - 0.05 × 0.3 = 0.657 for the standard template at this stage.
[0046] S200: Based on the current wear data, match the corresponding wear stage template from the preset dynamic template library, and at the same time generate the wear confidence level associated with the wear stage template.
[0047] In step S200 of this application embodiment, the purpose of the above steps is to match a dedicated detection template that adapts to the current wear state of the tool for drilling quality detection, and at the same time obtain the corresponding wear confidence level, so as to provide a core quantitative basis for setting the dynamic compensation coefficient for subsequent joint image comparison, so as to detect the actual wear of the tool, avoid misjudgment caused by fixed template, and improve detection accuracy.
[0048] To achieve the above objectives, it is first necessary to retrieve a pre-defined dynamic template library. This library contains standard template images associated with several wear stages, corresponding feature vector sets, and wear confidence scores. Simultaneously, the current wear data of the loaded target drilling tool is extracted to prepare the data and library for subsequent template matching. For example, the dynamic template library constructed for carbide drilling tools is retrieved. This library contains standard template images for the initial, middle, and late wear stages, feature vector sets such as the contour feature vectors of each template, and the wear confidence scores corresponding to each stage. At the same time, the current wear data of the carbide drilling tool is extracted, where the machining frequency is 450 times, the tool material is carbide, and the cutting speed is 80 m / min.
[0049] Then, the current wear data of the target drilling tool is matched with the wear data range corresponding to each wear stage in the dynamic template library. The wear stage that matches the current wear data is selected, and the wear stage template corresponding to the wear stage is determined to achieve accurate template matching. For example, the current wear data with a processing frequency of 450 times is compared with the wear data ranges of the initial wear stage (0-500 times), the intermediate wear stage (501-1500 times), and the late wear stage (1501-2000 times) in the dynamic template library to match the corresponding initial wear stage, and then the wear stage template corresponding to the initial wear stage in the dynamic template library is determined.
[0050] The wear confidence score associated with the matched wear stage template is extracted from the dynamic template library. This wear confidence score is used as the quantitative indicator corresponding to the current wear stage template to complete the generation and acquisition of the wear confidence score. For example, the wear confidence score of 0.95 associated with the initial wear stage template is extracted from the dynamic template library. This value is the wear confidence score corresponding to the currently matched wear stage template.
[0051] In step S300 of this embodiment, it is necessary to acquire the hole position image of the workpiece to be tested and extract the hole image.
[0052] In step S300 of this application embodiment, the purpose of the above step is to acquire visual image data of the hole position of the punched workpiece to be inspected, strip away irrelevant background areas, and obtain the image of the hole to be inspected containing only the hole position features. This provides an accurate image of the object to be inspected for subsequent joint image comparison and similarity calculation with the wear stage template. It is the basic image acquisition and preprocessing step for visual inspection of punching quality.
[0053] To achieve the above objectives, the first step is to acquire images of the hole positions on the workpiece to be tested. This step involves using a vision inspection device to acquire images of the hole positions on the workpiece after drilling, obtaining original visual images that include the hole positions and the surrounding background. For example, an industrial camera can be used to photograph the hole positions on a 45# steel workpiece that has just been drilled, acquiring images that include the hole positions and the background of the workpiece surface.
[0054] Then, the image of the hole to be tested is extracted. This step involves preprocessing the acquired hole position image by image segmentation, background removal, etc., to separate the image region containing only the hole position from the original image and obtain the image of the hole to be tested. For example, edge detection and background cropping are performed on the original hole position image acquired above to remove the background area on the workpiece surface and retain only the outline and internal area of the hole position to extract the corresponding image of the hole to be tested.
[0055] In step S400 of this embodiment, based on the wear confidence level, a dynamic compensation coefficient for joint image comparison is set, including: A first confidence threshold and a second confidence threshold are preset, wherein the first confidence threshold is greater than the second confidence threshold; When the wear confidence level is higher than the first confidence threshold, the dynamic compensation coefficient is set to a first coefficient range, in which the contour feature weight is higher than the geometric feature weight. When the wear confidence level is lower than the second confidence threshold, the dynamic compensation coefficient is set to the second coefficient interval, in which the weight of geometric features is higher than the weight of contour features. When the wear confidence level is greater than or equal to the second confidence threshold and less than or equal to the first confidence threshold, the dynamic compensation coefficient is set to an intermediate coefficient range that is linearly correlated with the wear confidence level.
[0056] In step S400 of this application embodiment, the purpose of the above step is to configure an appropriate weight coefficient range for the similarity scores of various features in subsequent image comparisons based on the reference value quantification index of the wear stage template, so that the similarity weight correction can fit the hole position feature change law under the current wear state of the tool, improve the calculation accuracy of the comprehensive similarity score, and thus ensure the reliability of the drilling quality detection results.
[0057] To achieve the above objective, it is first necessary to preset a first confidence threshold and a second confidence threshold, wherein the first confidence threshold is greater than the second confidence threshold. This step defines the confidence interval for wear, setting a benchmark for matching different coefficient intervals in the future. For example, the first confidence threshold is preset to 0.9 and the second confidence threshold is preset to 0.7, serving as the boundary between high and low confidence levels for wear.
[0058] When the wear confidence level is higher than the first confidence threshold, the dynamic compensation coefficient is set to a first coefficient range, in which the contour feature weight is higher than the geometric feature weight. This step targets wear stage templates with high reference value, increasing the weight of contour features in similarity calculation. For example, if the current wear confidence is 0.95, which is higher than the first confidence threshold of 0.9, the dynamic compensation coefficient is set to the first coefficient range, with the contour feature weight set to 0.6 and the geometric feature weight set to 0.3. Correspondingly, the structural similarity weight is 1 - 0.6 - 0.3 = 0.1.
[0059] The contour features are the contour-related features of the hole edge in the image of the hole to be tested or the template during the wear stage. Using the contour feature vector as the core representation, they are the feature extraction and quantification results of the contour point set of the hole edge, accurately reflecting the shape, direction, sharpness, burr morphology, and other edge appearance features of the hole edge. The geometric features are the geometric parameter benchmark-related quantification features of the hole position in the image of the hole to be tested or the template during the wear stage. They are the basic geometric dimensions and morphological indicators of the hole position, including geometric parameters such as hole diameter, roundness, hole position, and perpendicularity.
[0060] When the wear confidence level is lower than the second confidence threshold, the dynamic compensation coefficient is set to the second coefficient interval, in which the weight of geometric features is higher than the weight of contour features. This step targets wear stage templates with low reference value and increases the weight of geometric features in similarity calculation. For example, if the current wear confidence is 0.6, which is lower than the second confidence threshold of 0.7, the dynamic compensation coefficient is set to the second coefficient range, with the geometric feature weight set to 0.6 and the contour feature weight set to 0.3. Correspondingly, the structural similarity weight is 1 - 0.6 - 0.3 = 0.1.
[0061] When the wear confidence level is greater than or equal to the second confidence threshold and less than or equal to the first confidence threshold, the dynamic compensation coefficient is set to an intermediate coefficient range that is linearly correlated with the wear confidence level.
[0062] This step is for a wear stage template with moderate reference value. The coefficients are adjusted linearly with the confidence level to match the actual reference value of the template. For example, if the current wear confidence level is 0.8, which is between the second confidence threshold of 0.7 and the first confidence threshold of 0.9, the dynamic compensation coefficient is set to the intermediate coefficient range, the contour feature weight is linearly set to 0.45 with the confidence level, and the geometric feature weight is linearly set to 0.45.
[0063] Here, "linear correlation" refers to the fact that when the wear confidence level changes between the second and first confidence thresholds, the weights of each feature in the dynamic compensation coefficient change linearly and synchronously with the wear confidence level value, without non-linear fluctuations. The higher the wear confidence level, the linearly higher the weight of the contour feature and the linearly lower the weight of the geometric feature; conversely, the lower the wear confidence level, the linearly higher the weight of the geometric feature and the linearly lower the weight of the contour feature. The weight changes are proportional to the wear confidence level value, allowing the dynamic compensation coefficient configuration to accurately match the gradual change in the template reference value and adapt to the continuous change in tool wear. This avoids jumps in detection results caused by threshold switching, improving the system's stability and smoothness.
[0064] The dynamic compensation coefficients are three values set according to the weight ratio of contour feature weight, structural similarity weight, and geometric feature weight; the ratio between the dynamic compensation coefficients strictly corresponds to the ratio between the three weights. For example, the contour feature weights, structural similarity weights, and geometric feature weights obtained by the above method are 0.40, 0.33, and 0.27, respectively, with a ratio of approximately 0.6:0.5:0.4. Therefore, the dynamic compensation coefficients can be set to values corresponding to this ratio. For example, based on this ratio, three dynamic compensation coefficients corresponding to contour features, structural similarity, and geometric deviation can be obtained as 0.6, 0.5, and 0.4, respectively.
[0065] The dynamic compensation coefficients adjust the weights of different image features in the similarity calculation, and their relative proportions determine the contribution of each feature to the final result. Since the coefficients are directly multiplied by the feature scores during subsequent weighted correction, they only need to be kept consistent with the original weight proportions and do not require normalization.
[0066] The absolute value of the dynamic compensation coefficient determines the contribution of each feature score to the overall score, while the relative proportion determines the weighting relationship between features. If the dynamic compensation coefficient is too small, it will excessively weaken the influence of all features, making the overall score insensitive to image differences and prone to missed detections; if the dynamic compensation coefficient is too large, it will excessively amplify minute differences, leading to false alarms.
[0067] Therefore, choosing moderate values like 0.6, 0.5, and 0.4, which are on the same order of magnitude as the weighting ratio, preserves the discriminative power between features while ensuring the overall score fluctuates within a reasonable range, thus balancing detection sensitivity and stability. Adjustments can be made based on actual circumstances during implementation.
[0068] In step S500 of this embodiment, the image of the hole to be tested is compared with the wear stage template to calculate the similarity, and the similarity is weighted and corrected based on the dynamic compensation coefficient to obtain a corrected comprehensive similarity score, including: Extract the hole edge contour point set from the hole image to be tested, and calculate the Hausdorff distance with the contour feature vector of the wear stage template to obtain the initial contour similarity score; Within a preset region of interest, the structural similarity index between the image of the hole to be tested and the wear stage template is calculated and used as the initial structural similarity score. The geometric parameters of the image of the hole to be tested are measured, and the difference is calculated with the geometric parameter reference of the wear stage template to obtain the initial geometric deviation score; The dynamic compensation coefficient is multiplied by the initial contour similarity score, the initial structural similarity score, and the initial geometric deviation score to obtain the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score. The corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are weighted and fused according to the contour feature weight, geometric feature weight, and structural similarity weight to obtain the corrected comprehensive similarity score.
[0069] In step S500 of this application embodiment, the purpose of the above step is to calculate the initial similarity between the hole to be tested and the template in the wear stage by comparing multiple dimensions of the joint image, and then combine the dynamic compensation coefficient to weight and correct the scores of each dimension and fuse them to obtain a comprehensive similarity score that fits the current wear state of the tool, so as to provide an accurate quantitative indicator for subsequent determination of drilling quality based on dynamic threshold and improve the accuracy of the detection results.
[0070] To achieve the above objectives, it is first necessary to extract the hole edge contour point set from the hole image to be tested, and perform Hausdorff distance calculation with the contour feature vector of the wear stage template to obtain the initial contour similarity score. This step compares the matching degree between the hole to be tested and the wear stage template in terms of contour dimension. For example, the set of contour points of the hole edge in the image of the hole to be tested is extracted, and the Hausdorff distance is calculated with the contour feature vector of the initial wear stage template, resulting in an initial contour similarity score of 0.92. The method for calculating the Hausdorff distance is existing technology and will not be described in detail here.
[0071] Then, within the preset region of interest, the structural similarity index between the image of the hole to be tested and the wear stage template is calculated as the initial structural similarity score; This step involves comparing the matching degree at the structural level in the core area of the hole. For example, a region of interest is preset within the diameter range of the hole to be tested, and the structural similarity index (SSIM) between the region of interest and the template in the wear stage is calculated to obtain an initial structural similarity score of 0.90.
[0072] The region of interest (ROI) is a pre-defined image region containing only the core features of the hole, excluding irrelevant parts such as the workpiece background. This dedicated region is used to calculate the structural similarity index (SSIM), allowing the calculation to focus on the hole's intrinsic features and avoiding interference from irrelevant areas, thus improving the accuracy of the SSIM calculation. It is typically defined as the hole's outline and internal area. The SSIM is a recognized standard algorithm in image processing and a mature, widely used technology, which will not be elaborated upon here.
[0073] Next, the geometric parameters of the image of the hole to be tested are measured, and the difference is calculated with the geometric parameter reference of the wear stage template to obtain the initial geometric deviation score. This step compares the deviation between the hole to be tested and the template at the geometric parameter level. For example, the geometric parameters such as the diameter and roundness of the hole to be tested are measured and the difference is calculated with the geometric parameter benchmark of the template in the wear stage to obtain an initial geometric deviation score of 0.88. The difference calculation = difference / deviation is a common basic operation in geometric measurement and image processing and is common knowledge, so it will not be elaborated here.
[0074] The calculation of the geometric parameter difference with the wear stage template involves first measuring the geometric parameters such as the diameter and roundness of the hole image to be tested, and then calculating the difference with the corresponding geometric parameter benchmark in the wear stage template. The calculation result is converted into a quantified score according to a preset rule, such as 0.88. This score is the initial geometric deviation score. The level of the initial geometric deviation score reflects the degree of deviation between the geometric parameters of the hole to be tested and the template benchmark. The higher the initial geometric deviation score, the smaller the deviation between the geometric parameters of the hole to be tested and the geometric parameter benchmark of the wear stage template.
[0075] Furthermore, the dynamic compensation coefficient is multiplied by the initial contour similarity score, the initial structural similarity score, and the initial geometric deviation score respectively to obtain the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score. This step corrects the initial scores for each dimension according to the tool wear condition. For example, the dynamic compensation coefficients of 0.6, 0.5, and 0.4 corresponding to contour features, structural similarity, and geometric deviation, respectively, are multiplied by the three initial scores to obtain the corrected contour similarity score of 0.552, structural similarity score of 0.45, and geometric deviation similarity score of 0.352.
[0076] Finally, the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are weighted and fused to obtain the corrected comprehensive similarity score.
[0077] This step integrates the multi-dimensional correction scores to obtain the final quantitative indicator. For example, assigning a 1 / 3 weight to each of the three correction scores and weighting them together yields a corrected comprehensive similarity score of 0.451. The specific weighting can be adjusted according to the specific implementation situation.
[0078] In step S600 of this embodiment, based on the corrected comprehensive similarity score and a preset dynamic threshold, a punching quality detection result is output, and the wear confidence is reverse-corrected according to the punching quality detection result, and the dynamic template library is updated, including: When the corrected overall similarity score is greater than or equal to the dynamic threshold, a qualified identifier is output, and a first adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is increased by the corresponding first adjustment step size. When the corrected overall similarity score is less than the dynamic threshold, the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are compared with their respective individual thresholds, the corresponding defect type is output, and a second adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is lowered by the corresponding second adjustment step size. The adjusted wear confidence is re-associated with the current wear data, and the wear confidence of the corresponding wear stage template in the dynamic template library is updated.
[0079] In step S600 of this application embodiment, the purpose of the above steps is to determine the drilling quality result based on the corrected comprehensive similarity score and dynamic threshold, and at the same time, to reverse the wear confidence and update the dynamic template library based on the detection result, so that the wear confidence and template library can be dynamically optimized with the actual detection data, continuously adapt to the changes in the tool wear state, further improve the accuracy of subsequent drilling quality detection, and reduce the false alarm rate.
[0080] To achieve the above objective, when the corrected comprehensive similarity score is greater than or equal to the dynamic threshold, a qualified identifier needs to be output, and a first adjustment step size needs to be configured according to the difference ratio between the corrected comprehensive similarity score and the dynamic threshold, and the current wear confidence level needs to be increased by the corresponding first adjustment step size. This step determines the hole position is acceptable and positively optimizes the wear confidence level. Specifically, a first adjustment step size is configured based on the ratio of the difference between the corrected overall similarity score and the dynamic threshold. This can be achieved by first calculating the difference between the corrected overall similarity score and the dynamic threshold, then comparing this difference to the dynamic threshold to obtain the difference ratio. Following a preset ratio-step size correspondence rule, a corresponding value is assigned to this difference ratio as the first adjustment step size. Generally, the larger the difference ratio, the larger the first adjustment step size. For example, if the corrected overall similarity score is 0.93, which is greater than the dynamic threshold of 0.85, the difference ratio is 0.09. In this case, a first adjustment step size of 0.02 is configured, increasing the current wear confidence level from 0.95 to 0.97.
[0081] When the corrected overall similarity score is less than the dynamic threshold, the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are compared with their respective individual thresholds, the corresponding defect type is output, and a second adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is lowered by the corresponding second adjustment step size. This step determines whether the hole position is unqualified and locates the defect type. At the same time, the wear confidence level is adjusted in reverse. The corresponding defect type is output. First, the corresponding individual thresholds can be preset for the corrected contour similarity score, structural similarity score, and geometric deviation score. Then, the corrected score of each dimension is compared with its own individual threshold. If a certain score is lower than the corresponding threshold, it is determined that there is a hole position defect in that dimension. The defect type corresponding to that dimension is directly output. For example, if the contour similarity score does not meet the standard, the contour defect is output. If the geometric deviation score does not meet the standard, the geometric parameter defect is output. If multiple dimensions do not meet the standard, the corresponding defect types are output separately.
[0082] For example, if the corrected overall similarity score of 0.78 is less than the dynamic threshold of 0.85, and the comparison shows that the corrected contour similarity score is lower than the individual threshold, a contour defect identifier will be output.
[0083] Specifically, the second adjustment step size is configured based on the difference ratio between the corrected comprehensive similarity score and the dynamic threshold. First, the difference between the corrected comprehensive similarity score and the dynamic threshold is calculated. Then, the difference ratio is obtained by comparing the difference with the dynamic threshold. According to the preset ratio-step size correspondence rule, the corresponding second adjustment step size is matched for the difference ratio. The larger the difference ratio, the larger the configured second adjustment step size value, so that the reduction of the wear confidence is matched with the deviation of the detection result, thereby achieving accurate reverse correction of the confidence.
[0084] Continuing with the previous example, the second adjustment step size of 0.03 is configured according to the difference ratio of 0.08, and the current wear confidence level of 0.95 is reduced to 0.92.
[0085] The adjusted wear confidence is re-associated with the current wear data, and the wear confidence of the corresponding wear stage template in the dynamic template library is updated.
[0086] This step synchronizes the corrected wear confidence level to the dynamic template library, completing the dynamic update of the template library. For example, the increased or decreased wear confidence level of 0.97 or 0.92 is re-associated with the current tool's processing frequency, working conditions, and other wear data, updating the wear confidence level corresponding to the initial wear stage template in the dynamic template library.
[0087] In step S600 of the embodiments of this application, the following is also included: Obtain the number of false alarms and missed alarms caused by normal tool wear during the historical detection cycle for the target drilling tool; Calculate the ratio of the number of false alarms to the number of missed alarms, and set it as the threshold adjustment coefficient; Obtain the hardness fluctuation range and working condition fluctuation range of the workpiece material in the current batch, and calculate the environmental disturbance coefficient based on the hardness fluctuation range and working condition fluctuation range. The dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level.
[0088] In step S600 of this application embodiment, the purpose of the above steps is to dynamically adjust the dynamic threshold. By comprehensively calculating the threshold adjustment coefficient based on historical false alarms and missed alarms, current workpiece and working condition fluctuations, the dynamic threshold can better fit the actual processing environment and tool status, reduce misjudgments, and improve detection stability.
[0089] To achieve the above objectives, it is first necessary to obtain the number of false alarms and missed alarms caused by normal tool wear during the historical detection cycle of the target drilling tool. This involves obtaining the number of false alarms and missed alarms caused by normal tool wear during the historical testing period for the target drilling tool. This information is used to statistically analyze the detection deviation and provide a basis for threshold adjustment. For example, the statistics show that there were 5 false alarms and 10 missed alarms during the historical testing period.
[0090] Then, the ratio of the number of false alarms to the number of missed alarms is calculated and set as the threshold adjustment coefficient; The ratio of false alarms to false misses is calculated and set as the threshold adjustment coefficient. This ratio reflects the detection bias. For example, dividing the number of false alarms (5) by the number of false misses (10) yields a threshold adjustment coefficient of 0.5.
[0091] Next, the hardness fluctuation range and working condition fluctuation range of the workpiece material in the current batch are obtained, and the environmental disturbance coefficient is calculated based on the hardness fluctuation range and working condition fluctuation range. This involves obtaining the hardness fluctuation range and operating condition fluctuation range of the workpiece material in the current batch, and calculating the environmental disturbance coefficient based on these ranges. This coefficient is used to quantify the impact of environmental changes on the test. For example, if the workpiece hardness fluctuation range is ±5HRC and the operating condition fluctuation range is ±3%, the calculated environmental disturbance coefficient is 1.2.
[0092] The environmental disturbance coefficient is a quantitative coefficient calculated based on the fluctuation range of the workpiece material hardness and the fluctuation range of the working conditions in the current batch. The larger the fluctuation range of the workpiece material hardness and the fluctuation range of the working conditions, the larger the environmental disturbance coefficient. Specifically, the environmental disturbance coefficient can be obtained by summing or normalizing the two fluctuation ranges according to preset weights, which reflects the degree of influence of the processing environment on the test results.
[0093] Furthermore, the dynamic threshold needs to be dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level.
[0094] In step S600 of this embodiment, the dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level, including: The product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient is calculated as the basic threshold adjustment amount; Obtain the current wear confidence level and normalize the wear confidence level to a preset confidence influence coefficient range to obtain the confidence influence coefficient; Multiply the basic threshold adjustment amount by the confidence level influence coefficient to obtain the dynamic threshold adjustment amplitude; The dynamic threshold adjustment amplitude is added to the dynamic threshold of the previous detection cycle to obtain the dynamic threshold of the current detection cycle.
[0095] In step S600 of this application embodiment, the purpose of the above steps is to calculate the dynamic threshold adjustment amplitude step by step based on the threshold adjustment coefficient, environmental disturbance coefficient, preset reference coefficient and wear confidence, and then update the dynamic threshold of the current detection cycle so that the dynamic threshold can adapt to historical detection results, processing environment and tool wear status, thereby improving detection accuracy.
[0096] To achieve the above objectives, it is first necessary to calculate the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, as the basic threshold adjustment amount. This step involves taking into account three factors: the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, to obtain the basic threshold adjustment amount. For example, assuming the threshold adjustment coefficient is 0.5, the environmental disturbance coefficient is 1.2, and the preset benchmark coefficient is 0.1, multiplying the three together yields a basic threshold adjustment amount of 0.06.
[0097] Then, the current wear confidence level is obtained, and the wear confidence level is normalized to a preset confidence influence coefficient range to obtain the confidence influence coefficient; Obtain the current wear confidence level and normalize it to a preset confidence influence coefficient range to obtain the confidence influence coefficient. This step maps the confidence level to a specified range to participate in the threshold calculation. For example, the preset confidence influence coefficient range is 0.9 to 1.1 with a range length of 0.2. The current wear confidence level is 0.95. After normalization to the 0.9 to 1.1 range, the confidence influence coefficient is obtained as 0.9 + 0.95 × 0.2 = 1.09.
[0098] Next, the threshold base adjustment amount is multiplied by the confidence level influence coefficient to obtain the dynamic threshold adjustment amplitude; This step introduces the influence of confidence level to obtain the final adjustment range. For example, the basic threshold adjustment of 0.06 is multiplied by the confidence level influence coefficient of 1.09 to obtain the dynamic threshold adjustment range of 0.0654.
[0099] Finally, the dynamic threshold adjustment amplitude is added to the dynamic threshold of the previous detection cycle to obtain the dynamic threshold of the current detection cycle.
[0100] This step completes the real-time update of the dynamic threshold. For example, if the dynamic threshold of the previous period was 0.85, adding the dynamic threshold adjustment amplitude of 0.0654, we get the dynamic threshold of the current period as 0.9154, which is 0.92 after keeping two decimal places.
[0101] Example 2, as Figure 2 As shown, based on the same inventive concept as the punch quality detection method using joint image comparison similarity provided in Embodiment 1, this embodiment of the invention also provides a punch quality detection system using joint image comparison similarity, comprising: Wear data loading module 11 is used to load the current wear data of the target drilling tool; Wear confidence acquisition module 12 is used to match the corresponding wear stage template from a preset dynamic template library based on the current wear data, and at the same time generate wear confidence associated with the wear stage template. The dynamic template library includes standard template images, corresponding feature vector sets and wear confidence associated with several wear stages. The hole image extraction module 13 is used to acquire hole position images of the workpiece to be tested and extract the hole image. The dynamic compensation coefficient configuration module 14 is used to set the dynamic compensation coefficient for joint image comparison based on the wear confidence level, and to call the wear stage template. The comprehensive similarity score acquisition module 15 is used to perform joint image comparison between the image of the hole to be tested and the wear stage template, calculate the similarity, and weight and correct the similarity based on the dynamic compensation coefficient to obtain the corrected comprehensive similarity score. The quality inspection result acquisition module 16 is used to output the punching quality inspection result based on the corrected comprehensive similarity score and the preset dynamic threshold, and to reverse correct the wear confidence based on the punching quality inspection result and update the dynamic template library.
[0102] Furthermore, the wear data loading module 11 includes the following execution steps: Load the tool's own parameters for the target drilling tool, wherein the tool's own parameters include at least the tool material parameters; Load the historical machining condition parameters and historical workpiece parameters of the target drilling tool since it entered service. The historical machining condition parameters include at least cutting speed and feed rate, cooling and lubrication conditions, and machining frequency. The historical workpiece parameters include at least workpiece hardness and workpiece strength. The tool's own parameters, historical machining condition parameters, and historical machined workpiece parameters are stored as the current wear data.
[0103] Furthermore, the wear confidence acquisition module 12 includes the following execution steps: Collect a set of historical machining images of the target drilling tool model throughout its entire life cycle, wherein the set of historical machining images includes images of qualified workpieces corresponding to several machining sequences; Collect historical wear data corresponding to each machining sequence. The historical wear data includes tool parameters, historical machining condition parameters, and historical workpiece parameters. The entire life cycle is divided into several consecutive wear stages, and a corresponding wear data range is assigned to each wear stage. Extract the qualified workpiece image corresponding to each wear stage, perform feature extraction, and generate a stage standard template corresponding to each wear stage. The stage standard template includes contour feature vector, grayscale distribution features, and geometric parameter benchmark. The confidence level of each stage standard template is calibrated, and the degree of agreement between the features of the stage standard template and the features of the samples in the corresponding wear data interval is used as the wear confidence level. This is then associated with and stored in the corresponding wear data interval to construct the dynamic template library.
[0104] The confidence level of the standard template for each stage is calibrated, including: Obtain the individual feature dispersion of each historical processing image in the historical processing image set corresponding to each wear stage; Calculate the average similarity between the feature vector of the stage standard template and the feature vector of each historical processed image; The wear confidence score is generated by weighted calculation based on the individual feature dispersion and the average similarity, wherein the individual feature dispersion is negatively correlated with the wear confidence score, and the average similarity is positively correlated with the wear confidence score.
[0105] Furthermore, the dynamic compensation coefficient configuration module 14 includes the following execution steps: A first confidence threshold and a second confidence threshold are preset, wherein the first confidence threshold is greater than the second confidence threshold; When the wear confidence level is higher than the first confidence threshold, the dynamic compensation coefficient is set to a first coefficient range, in which the contour feature weight is higher than the geometric feature weight. When the wear confidence level is lower than the second confidence threshold, the dynamic compensation coefficient is set to the second coefficient interval, in which the weight of geometric features is higher than the weight of contour features. When the wear confidence level is greater than or equal to the second confidence threshold and less than or equal to the first confidence threshold, the dynamic compensation coefficient is set to an intermediate coefficient range that is linearly correlated with the wear confidence level.
[0106] Furthermore, the comprehensive similarity score acquisition module 15 includes the following execution steps: Extract the hole edge contour point set from the hole image to be tested, and calculate the Hausdorff distance with the contour feature vector of the wear stage template to obtain the initial contour similarity score; Within a preset region of interest, the structural similarity index between the image of the hole to be tested and the wear stage template is calculated and used as the initial structural similarity score. The geometric parameters of the image of the hole to be tested are measured, and the difference is calculated with the geometric parameter reference of the wear stage template to obtain the initial geometric deviation score; The dynamic compensation coefficient is multiplied by the initial contour similarity score, the initial structural similarity score, and the initial geometric deviation score to obtain the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score. The corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are weighted and fused to obtain the corrected comprehensive similarity score.
[0107] Furthermore, the quality inspection result acquisition module 16 includes the following execution steps: When the corrected overall similarity score is greater than or equal to the dynamic threshold, a qualified identifier is output, and a first adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is increased by the corresponding first adjustment step size. When the corrected overall similarity score is less than the dynamic threshold, the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are compared with their respective individual thresholds, the corresponding defect type is output, and a second adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is lowered by the corresponding second adjustment step size. The adjusted wear confidence is re-associated with the current wear data, and the wear confidence of the corresponding wear stage template in the dynamic template library is updated.
[0108] This also includes: Obtain the number of false alarms and missed alarms caused by normal tool wear during the historical detection cycle for the target drilling tool; Calculate the ratio of the number of false alarms to the number of missed alarms, and set it as the threshold adjustment coefficient; Obtain the hardness fluctuation range and working condition fluctuation range of the workpiece material in the current batch, and calculate the environmental disturbance coefficient based on the hardness fluctuation range and working condition fluctuation range. The dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level.
[0109] Specifically, the dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level, including: The product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient is calculated as the basic threshold adjustment amount; Obtain the current wear confidence level and normalize the wear confidence level to a preset confidence influence coefficient range to obtain the confidence influence coefficient; Multiply the basic threshold adjustment amount by the confidence level influence coefficient to obtain the dynamic threshold adjustment amplitude; The dynamic threshold adjustment amplitude is added to the dynamic threshold of the previous detection cycle to obtain the dynamic threshold of the current detection cycle.
Claims
1. A method for detecting punch quality based on joint image comparison similarity, characterized in that, include: Load the current wear data of the target drilling tool; Based on the current wear data, a corresponding wear stage template is matched from a preset dynamic template library, and a wear confidence score associated with the wear stage template is generated and stored. The dynamic template library contains standard template images associated with several wear stages, corresponding feature vector sets, and the wear confidence score. Acquire images of the hole positions on the workpiece to be tested, and extract images of the holes to be tested; Based on the wear confidence level, a dynamic compensation coefficient for joint image comparison is set, and the wear stage template is invoked; wherein, the dynamic compensation coefficient includes three values corresponding to contour features, structural similarity, and geometric deviation, respectively; The image of the hole to be tested is compared with the wear stage template to calculate the similarity. The similarity is then weighted and corrected based on the dynamic compensation coefficient to obtain the corrected comprehensive similarity score. Based on the corrected comprehensive similarity score and the preset dynamic threshold, the punching quality detection result is output, and the wear confidence is reversed according to the punching quality detection result, and the dynamic template library is updated.
2. The method for detecting punch quality based on joint image comparison similarity according to claim 1, characterized in that, Load the current wear data of the target drilling tool, including: Load the tool's own parameters for the target drilling tool, wherein the tool's own parameters include at least the tool material parameters; Load the historical machining condition parameters and historical workpiece parameters of the target drilling tool since it entered service. The historical machining condition parameters include at least cutting speed and feed rate, cooling and lubrication conditions, and machining frequency. The historical workpiece parameters include at least workpiece hardness and workpiece strength. The tool's own parameters, historical machining condition parameters, and historical machined workpiece parameters are stored as the current wear data.
3. The method for detecting punch hole quality based on joint image comparison similarity according to claim 1, characterized in that, Based on the current wear data, a corresponding wear stage template is matched from a preset dynamic template library, and a wear confidence score associated with and stored with the wear stage template is generated simultaneously, including the following: Collect a set of historical machining images of the target drilling tool model throughout its entire life cycle, wherein the set of historical machining images includes images of qualified workpieces corresponding to several machining sequences; Collect historical wear data corresponding to each machining sequence. The historical wear data includes tool parameters, historical machining condition parameters, and historical workpiece parameters. The entire life cycle is divided into several consecutive wear stages, and a corresponding wear data range is assigned to each wear stage. Extract the qualified workpiece image corresponding to each wear stage, perform feature extraction, and generate a stage standard template corresponding to each wear stage. The stage standard template includes contour feature vector, grayscale distribution features, and geometric parameter benchmark. The confidence level of each stage standard template is calibrated, and the degree of agreement between the features of the stage standard template and the features of the samples in the corresponding wear data interval is used as the wear confidence level. This is then associated with and stored in the corresponding wear data interval to construct the dynamic template library.
4. The method for detecting punch quality based on joint image comparison similarity according to claim 3, characterized in that, Confidence levels were calibrated for each stage of the standard template, including: Obtain the individual feature dispersion of each historical processing image in the historical processing image set corresponding to each wear stage; Calculate the average similarity between the feature vector of the stage standard template and the feature vector of each historical processed image; The wear confidence score is generated by weighted calculation based on the individual feature dispersion and the average similarity, wherein the individual feature dispersion is negatively correlated with the wear confidence score, and the average similarity is positively correlated with the wear confidence score.
5. The method for detecting punch quality based on joint image comparison similarity according to claim 1, characterized in that, Based on the wear confidence level, dynamic compensation coefficients for joint image comparison are set, including: A first confidence threshold and a second confidence threshold are preset, wherein the first confidence threshold is greater than the second confidence threshold; When the wear confidence level is higher than the first confidence threshold, the dynamic compensation coefficient is set to a first coefficient range, in which the contour feature weight is higher than the geometric feature weight. When the wear confidence level is lower than the second confidence threshold, the dynamic compensation coefficient is set to the second coefficient interval, in which the weight of geometric features is higher than the weight of contour features. When the wear confidence level is greater than or equal to the second confidence threshold and less than or equal to the first confidence threshold, the dynamic compensation coefficient is set to an intermediate coefficient range that is linearly correlated with the wear confidence level.
6. The method for detecting punch quality based on joint image comparison similarity according to claim 5, characterized in that, The image of the hole to be tested is compared with the wear stage template to calculate the similarity. The similarity is then weighted and corrected based on the dynamic compensation coefficient to obtain a corrected comprehensive similarity score, including: Extract the hole edge contour point set from the hole image to be tested, and calculate the Hausdorff distance with the contour feature vector of the wear stage template to obtain the initial contour similarity score; Within a preset region of interest, the structural similarity index between the image of the hole to be tested and the wear stage template is calculated and used as the initial structural similarity score. The geometric parameters of the image of the hole to be tested are measured, and the difference is calculated with the geometric parameter reference of the wear stage template to obtain the initial geometric deviation score; The dynamic compensation coefficient is multiplied by the initial contour similarity score, the initial structural similarity score, and the initial geometric deviation score to obtain the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score. The corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are weighted and fused to obtain the corrected comprehensive similarity score.
7. The method for detecting punch quality based on joint image comparison similarity according to claim 1, characterized in that, Based on the corrected comprehensive similarity score and a preset dynamic threshold, the punching quality detection result is output, and the wear confidence is reverse-corrected according to the punching quality detection result, and the dynamic template library is updated, including: When the corrected overall similarity score is greater than or equal to the dynamic threshold, a qualified identifier is output, and a first adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is increased by the corresponding first adjustment step size. When the corrected overall similarity score is less than the dynamic threshold, the corrected contour similarity score, the corrected structural similarity score, and the corrected geometric deviation score are compared with their respective individual thresholds, the corresponding defect type is output, and a second adjustment step size is configured according to the difference ratio between the corrected overall similarity score and the dynamic threshold, and the current wear confidence is lowered by the corresponding second adjustment step size. The adjusted wear confidence is re-associated with the current wear data, and the wear confidence of the corresponding wear stage template in the dynamic template library is updated.
8. The method for detecting punch quality based on joint image comparison similarity according to claim 1, characterized in that, Also includes: Obtain the number of false alarms and missed alarms caused by normal tool wear during the historical detection cycle for the target drilling tool; Calculate the ratio of the number of false alarms to the number of missed alarms, and set it as the threshold adjustment coefficient; Obtain the hardness fluctuation range and working condition fluctuation range of the workpiece material in the current batch, and calculate the environmental disturbance coefficient based on the hardness fluctuation range and working condition fluctuation range. The dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level.
9. The method for detecting punch quality based on joint image comparison similarity according to claim 8, characterized in that, The dynamic threshold is dynamically adjusted based on the product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient, combined with the current wear confidence level, including: The product of the threshold adjustment coefficient, the environmental disturbance coefficient, and the preset benchmark coefficient is calculated as the basic threshold adjustment amount; Obtain the current wear confidence level and normalize the wear confidence level to a preset confidence influence coefficient range to obtain the confidence influence coefficient; Multiply the basic threshold adjustment amount by the confidence level influence coefficient to obtain the dynamic threshold adjustment amplitude; The dynamic threshold adjustment amplitude is added to the dynamic threshold of the previous detection cycle to obtain the dynamic threshold of the current detection cycle.
10. A punching quality detection system based on joint image comparison similarity, characterized in that, The system is used to implement a punch quality detection method based on joint image comparison similarity as described in any one of claims 1-9, the system comprising: Wear data loading module, used to load the current wear data of the target drilling tool; The wear confidence acquisition module is used to match the corresponding wear stage template from a preset dynamic template library based on the current wear data, and at the same time generate a wear confidence associated with the wear stage template. The dynamic template library includes standard template images, corresponding feature vector sets, and the wear confidence associated with several wear stages. The hole image extraction module is used to acquire hole position images of the workpiece to be tested and extract the hole images. The dynamic compensation coefficient configuration module is used to set the dynamic compensation coefficient for joint image comparison based on the wear confidence level, and to call the wear stage template. The comprehensive similarity score acquisition module is used to perform joint image comparison between the image of the hole to be tested and the wear stage template, calculate the similarity, and weight and correct the similarity based on the dynamic compensation coefficient to obtain the corrected comprehensive similarity score. The quality inspection result acquisition module is used to output the punching quality inspection result based on the corrected comprehensive similarity score and the preset dynamic threshold, and to reverse correct the wear confidence based on the punching quality inspection result and update the dynamic template library.
Citation Information
Patent Citations
Method and system for detecting state of intersection hole boring cutter
CN119282817A
Full-layout defect rapid detection system based on pattern matching and classification
CN120634960A