Numerical control machining defect real-time detection method and system based on AI image recognition and medium

Through AI image recognition technology, dynamic threshold algorithms and multimodal features fusion and parallel computing architecture, efficient and accurate CNC processing defect detection is achieved, solving the problems of low efficiency and poor adaptability in traditional methods, and improving the intelligence level and product quality of CNC processing.

CN120279024AInactive Publication Date: 2025-07-08SHENZHEN HUAZHONG NUMERICAL CONTROL
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202510765868.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-07-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional CNC machining defect detection methods are inefficient and have poor accuracy, making them difficult to adapt to complex processing environments, resulting in a decline in product quality and an increase in production costs.

Method used

The real-time detection method of CNC machining defects based on AI image recognition is adopted, and the parts and backgrounds are separated by dynamic threshold algorithms, combined with multimodal feature fusion and parallel computing architecture, efficient and accurate defect detection is achieved, and real-time feedback is provided to the CNC machining control system.

Benefits of technology

It significantly improves the accuracy and efficiency of defect detection, supports real-time parameter adjustment, improves the intelligence level and product quality of CNC processing, and provides detailed result display and historical query functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279024A_ABST
    Figure CN120279024A_ABST
Patent Text Reader

Abstract

The invention provides a numerical control machining defect real-time detection method and system based on AI image recognition and a medium, and belongs to the technical field of intelligent manufacturing and machine vision crossing. The method comprises the following steps: collecting part surface image data according to a preset frequency, and separating a part from a background through noise reduction, contrast enhancement and a dynamic threshold algorithm of a data preprocessing module; inputting the processed image into a multi-modal feature fused AI detection model, and extracting and fusing multi-modal features to judge the type and position of a defect; and processing the image by using a parallel computing architecture, feeding back a detection result to a numerical control processing control system in real time, and visually displaying the detection result on a monitoring interface. According to the method, real-time and accurate detection and feedback control of numerical control machining defects are realized, and the machining quality and efficiency are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the cross - technical field of intelligent manufacturing and machine vision. Specifically, it relates to a real - time detection method, system, and medium for numerical control machining defects based on AI image recognition. Background Art

[0002] In the field of numerical control machining, the detection of part surface defects is crucial for ensuring product quality. Traditional numerical control machining defect detection methods mostly rely on manual visual inspection or image - processing algorithms based on fixed thresholds. Manual inspection has problems such as low efficiency, strong subjectivity, and being easily affected by the state of inspectors, making it difficult to meet the requirements of modern large - scale and high - precision numerical control machining; image - processing algorithms based on fixed thresholds cannot adapt to complex situations such as changes in part surface illumination and texture during the machining process, resulting in poor detection accuracy and real - time performance, and being prone to missed detections or false detections, which can lead to a decline in machining quality, an increase in production costs, and the defective rate of products. Therefore, there is an urgent need for a real - time detection method for numerical control machining defects that is efficient, accurate, and can adapt to complex machining environments. Summary of the Invention

[0003] The purpose of this application is to provide a real - time detection method, system, and medium for numerical control machining defects based on AI image recognition. In terms of data processing, the dynamic threshold algorithm analyzes the local features of the image by means of a sliding window, constructs a model based on gray - scale, texture, and brightness differences to dynamically adjust the threshold, and accurately separates the part from the background, being more adaptable to complex working conditions than traditional fixed - threshold methods. In terms of the detection model, the multi - modal feature fusion AI model extracts image color, texture, and shape features and fuses them with weights to generate a multi - dimensional feature vector, significantly improving the defect detection accuracy. The computing architecture adopts a parallel strategy, divides the image sub - regions, assigns independent threads for parallel processing, gives full play to the multi - core computing power, and realizes efficient and real - time detection. In addition, after the system detects a defect, it can generate a detailed result and transmit it to the control system to adjust the machining parameters; the monitoring interface visually marks the defects, statistically displays the data, and supports multi - condition historical queries, facilitating production management and quality traceability, effectively overcoming the limitations of traditional detection methods, and improving the intelligent level of numerical control machining and product quality.

[0004] This application provides a real - time detection method for numerical control machining defects based on AI image recognition, including the following steps: Collect the first image data of the surface of the machined part according to a preset shooting frequency, and transmit the first image data to the data pre - processing module in real time; Perform noise reduction and contrast enhancement processing on the first image data, and use the dynamic threshold algorithm to separate the part and background regions to obtain the second image data; Input the second image data into the multi - modal feature fusion AI detection model, extract features and fuse them to generate a feature vector, and analyze and judge the type and position of part surface defects through the model; The second image data is processed using a parallel computing architecture, and the detection results are fed back to the numerical control machining control system in real time and displayed on the monitoring interface.

[0005] Among them, in the real-time detection method of numerical control machining defects based on AI image recognition described in this application, the use of the dynamic threshold algorithm to separate the part and the background area is specifically as follows: Traverse the image through a sliding window and analyze the local features of the image within each window; According to the gray distribution, texture features, and brightness differences within the window area, establish a corresponding feature parameter model; Dynamically adjust the segmentation threshold according to this model to effectively separate the part area from the background area.

[0006] Among them, in the real-time detection method of numerical control machining defects based on AI image recognition described in this application, the multi-modal feature fusion AI detection model includes: Respectively use corresponding feature extraction algorithms to extract various modal features such as the color, texture, and shape of the image; According to the preset weight distribution strategy, weight and fuse the extracted color, texture, and shape features to generate a multi-dimensional feature vector containing multi-modal information.

[0007] Among them, in the real-time detection method of numerical control machining defects based on AI image recognition described in this application, the parallel computing architecture includes: Divide the image data into multiple sub-regions with appropriate sizes; Allocate independent computing threads for each of the sub-regions; Utilize the multi-core parallel computing ability to enable each thread to independently and parallelly process and analyze the corresponding sub-region, and merge the results of each sub-region after processing.

[0008] Among them, in the real-time detection method of numerical control machining defects based on AI image recognition described in this application, the real-time feedback of the detection results to the numerical control machining control system is specifically as follows: When the AI detection model determines that there are defects on the part surface; Based on the preset defect information generation rules, generate detection results including the defect type, precise position coordinates, and severity grading; Transmit the detection results to the numerical control machining control system according to the preset communication protocol; According to the preset parameter adjustment rules, the control system adjusts machining parameters such as the cutting speed and feed rate.

[0009] Among them, in the real-time detection method of numerical control machining defects based on AI image recognition described in this application, the display on the monitoring interface includes: Adopt preset visual encoding rules, mark the detected defect types with different colors and icons, and mark the accurate defect position coordinates on the part image; Collect and count data such as the number of defects and occurrence frequency in real time and display them according to the preset chart display format; At the same time, provide a historical result query and analysis function that combines multiple conditions such as time intervals and part batches.

[0010] In a second aspect, the present application provides a real-time detection system for NC machining defects based on AI image recognition. The system includes: a memory and a processor. The memory includes a program of the real-time detection method for NC machining defects based on AI image recognition. When the program of the real-time detection method for NC machining defects based on AI image recognition is executed by the processor, the following steps are implemented: Collect the first image data of the surface of the machined part according to the preset shooting frequency and transmit the first image data to the data preprocessing module in real time; Perform noise reduction and contrast enhancement processing on the first image data, and use the dynamic threshold algorithm to separate the part and background regions to obtain the second image data; Input the second image data into an AI detection model with multi-modal feature fusion, extract features and fuse them to generate a feature vector, and analyze and judge the defect type and position on the part surface through the model; Adopt a parallel computing architecture to process the second image data, and feedback the detection result to the NC machining control system in real time and display it on the monitoring interface.

[0011] Among them, in the real-time detection system for NC machining defects based on AI image recognition described in the present application, the use of the dynamic threshold algorithm to separate the part and background regions is specifically: Traverse the image through a sliding window and analyze the local features of the image within each window; Establish a corresponding feature parameter model according to the gray distribution, texture features and brightness differences within the window area; Dynamically adjust the segmentation threshold according to this model to effectively separate the part region and the background region.

[0012] Among them, in the real-time detection system for NC machining defects based on AI image recognition described in the present application, the AI detection model with multi-modal feature fusion includes: Respectively adopt corresponding feature extraction algorithms to extract various modal features such as the color, texture and shape of the image; According to the preset weight distribution strategy, weight and fuse the extracted color, texture and shape features to generate a multi-dimensional feature vector containing multi-modal information.

[0013] In a third aspect, the present application also provides a computer-readable storage medium, which includes a program for the real-time detection method of numerical control machining defects based on AI image recognition. When the program for the real-time detection method of numerical control machining defects based on AI image recognition is executed by a processor, the steps of the real-time detection method of numerical control machining defects based on AI image recognition as described in any one of the above are implemented.

[0014] As can be seen from the above, the real-time detection method, system and medium of numerical control machining defects based on AI image recognition provided by the embodiments of the present application adopt a dynamic threshold algorithm, traverse the image through a sliding window, establish a feature parameter model based on the gray distribution, texture features and brightness differences within the window area, and dynamically adjust the segmentation threshold to effectively separate the part and background areas. Compared with the traditional fixed threshold method, it can better adapt to complex machining environments. Construct an AI detection model with multi-modal feature fusion, extract various modal features such as image color, texture and shape respectively, and perform weighted fusion according to the preset weight distribution strategy to generate a multi-dimensional feature vector containing rich information, improving the accuracy and reliability of defect detection. Use a parallel computing architecture, divide the image data into adaptive sub-regions, allocate independent computing threads, and utilize the multi-core parallel computing ability to achieve parallel processing, greatly improving the detection efficiency and meeting the requirements of real-time detection. When a defect is detected, the system can generate a detailed detection result based on preset rules and transmit it to the numerical control machining control system to adjust the machining parameters; at the same time, mark the defect using a visual coding rule on the monitoring interface, statistically display relevant data, and provide a multi-condition historical result query and analysis function for convenient production management and quality traceability. The present invention effectively solves the deficiencies of traditional detection methods and significantly improves the intelligent level and product quality of numerical control machining.

[0015] Other features and advantages of the present application will be described in the subsequent specification, and part of them will become obvious from the specification, or can be understood by implementing the embodiments of the present application. The objectives and other advantages of the present application can be achieved and obtained through the structures specifically pointed out in the written specification and the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0017] Figure 1 It is a flowchart of the real-time detection method of numerical control machining defects based on AI image recognition provided by the embodiments of the present application; Figure 2Flowchart of separating parts and background regions for the real-time detection method of numerical control machining defects based on AI image recognition provided by the embodiments of the present application; Figure 3 Flowchart of extracting features and fusing to generate feature vectors for the real-time detection method of numerical control machining defects based on AI image recognition provided by the embodiments of the present application; Figure 4 Flowchart of real-time feedback of detection results to the numerical control machining control system for the real-time detection method of numerical control machining defects based on AI image recognition provided by the embodiments of the present application. Specific embodiments

[0018] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Usually, the components of the embodiments of the present application described and shown in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application to be protected, but only represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0019] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present application, terms such as "first", "second", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0020] Please refer to Figure 1 , Figure 1 which is a flowchart of the real-time detection method of numerical control machining defects based on AI image recognition in some embodiments of the present application. The real-time detection method of numerical control machining defects based on AI image recognition is used in terminal devices, such as computers, mobile phone terminals, etc. The real-time detection method of numerical control machining defects based on AI image recognition includes the following steps: S101. Collect the first image data of the surface of the machined part according to a preset shooting frequency and transmit the first image data to the data preprocessing module in real time; S102. Perform noise reduction and contrast enhancement processing on the first image data, and use a dynamic threshold algorithm to separate the part and background regions to obtain second image data; S103. Input the second image data into an AI detection model with multi-modal feature fusion, extract features and fuse them to generate a feature vector, and analyze and judge the type and location of part surface defects through the model; S104. Process the second image data using a parallel computing architecture, and feedback the detection results to the numerical control processing control system in real time and display them on the monitoring interface.

[0021] Among them, first, according to the preset shooting frequency, the surface of the machined part is photographed by an image acquisition device to obtain the first image data, and these data are transmitted to the data preprocessing module in real time. In the data preprocessing module, the first image data is first denoised to eliminate the noise interference generated by factors such as the shooting environment and equipment in the image, and then the contrast is enhanced to make the part features in the image more obvious. Then, the dynamic threshold algorithm is used to traverse the image through a sliding window, analyze the local features of the image in each window, establish a corresponding feature parameter model according to the gray distribution, texture features and brightness differences in the window area, and dynamically adjust the segmentation threshold according to this model, so as to effectively separate the part area from the background area and obtain the second image data. Then, the second image data is input into the AI detection model of multi-modal feature fusion. This model uses the corresponding feature extraction algorithms to extract various modal features such as the color, texture and shape of the image, and then according to the preset weight allocation strategy, the extracted color, texture and shape features are weighted and fused to generate a multi-dimensional feature vector containing multi-modal information, and the model further analyzes and judges the type and position of the surface defects of the part. When processing the second image data, a parallel computing architecture is adopted. The image data is divided into multiple sub-regions with appropriate sizes, an independent computing thread is allocated to each sub-region, and the multi-core parallel computing ability is utilized to enable each thread to independently and parallelly process and analyze the corresponding sub-region. After the processing is completed, the results of each sub-region are merged to improve the processing efficiency. Finally, the detection results are fed back to the numerical control processing control system in real time. When the AI detection model determines that there are defects on the surface of the part, based on the preset defect information generation rules, a detection result including the defect type, accurate position coordinates and severity level is generated, and according to the preset communication protocol, the detection result is transmitted to the numerical control processing control system. According to the preset parameter adjustment rules, the control system adjusts the machining parameters such as the cutting speed and feed rate; at the same time, on the monitoring interface, the preset visual coding rules are adopted to mark the detected defect types with different colors and icons, and the accurate defect position coordinates are marked on the part image. The number of defects, occurrence frequency and other data are collected and statistically analyzed in real time and displayed according to the preset chart display format, and a historical result query and analysis function with multiple condition combinations such as time interval and part batch is also provided.

[0022] Please refer to Figure 2 , Figure 2 is the flowchart of separating the part and the background area of the real-time detection method for numerical control machining defects based on AI image recognition in some embodiments of the present application. According to the embodiments of the present invention, the use of the dynamic threshold algorithm to separate the part and the background area is specifically as follows: S201. Traverse the image through a sliding window and analyze the local features of the image in each window; S202. Establish a corresponding feature parameter model based on the gray-scale distribution, texture features, and brightness differences within the window area; S203. Dynamically adjust the segmentation threshold according to this model to effectively separate the part area from the background area.

[0023] Among them, the specific implementation process of using the dynamic threshold algorithm to separate the part and background areas is as follows: First, the sliding window technology is used to traverse and scan the image after noise reduction and contrast enhancement processing. The sliding window moves row by row and column by column on the image according to a preset step size to ensure that every local area of the image is covered. For the image data within each window, the system synchronously analyzes the local feature information it contains, which mainly includes gray-scale distribution characteristics, texture feature parameters, and brightness difference data. The gray-scale distribution characteristics are characterized by statistically analyzing the probability distribution of pixel gray-scale values within the window. The texture feature parameters are obtained by calculating texture statistics such as contrast, correlation, energy, and homogeneity. The brightness difference data is obtained by analyzing the change range and gradient information of pixel brightness values within the window. Based on the multi-dimensional feature information such as the gray-scale distribution, texture features, and brightness differences within the extracted window area, the system constructs a corresponding feature parameter model. This model is essentially a dynamic mathematical model, and its internal parameters will be adjusted in real time according to the feature data of the current window area to accurately reflect the image characteristics of this local area. During the model establishment process, the system will use statistical methods and machine learning algorithms to deeply mine and analyze the feature data within the window to determine the combination of feature parameters that can best reflect the difference between the part and the background. After the feature parameter model is constructed, the system dynamically calculates and adjusts the segmentation threshold applicable to the current window area according to this model. Specifically, the model will calculate an optimal segmentation threshold according to the matching degree between the feature data within the window and the preset part feature template or background feature template. This threshold can maximize the distinction between the part area and the background area. By repeating the above dynamic threshold calculation and segmentation process for all window areas of the entire image, the effective separation of the part area and the background area is finally achieved, and the second image data containing only part information is obtained, providing a high-quality data basis for subsequent defect detection and analysis. This dynamic threshold algorithm based on local feature analysis can better adapt to complex situations such as uneven surface illumination and texture changes of parts during the processing process compared with the traditional global fixed threshold algorithm, significantly improving the segmentation accuracy and robustness of the part and background areas.

[0024] Please refer to Figure 3 , Figure 3 is the flowchart of extracting features and fusing them to generate feature vectors of the real-time detection method for NC machining defects based on AI image recognition in some embodiments of this application. According to the embodiments of the present invention, the AI detection model for multi-modal feature fusion includes: S301. Extract various modal features such as the color, texture, and shape of the image using corresponding feature extraction algorithms respectively; S302. According to the preset weight assignment strategy, perform weighted fusion on the extracted color, texture, and shape features to generate a multi-dimensional feature vector containing multi-modal information.

[0025] Among them, first, for the preprocessed second image data, specially designed feature extraction algorithms are respectively used to extract multiple modal features such as color, texture, and shape in parallel. In terms of color feature extraction, the HSV color space conversion combined with the color histogram statistics method is adopted. After converting the RGB image to the HSV space, the histogram distributions of the hue, saturation, and brightness channels are respectively calculated to form a color feature vector, which can effectively characterize the color change and distribution law of the part surface. In terms of texture feature extraction, the method combining the Gabor filter bank and the local binary pattern (LBP) is used. The Gabor filter bank captures the local texture information of the image through filtering operations of different scales and directions, and the LBP operator statistically analyzes the gray difference pattern between the pixel point and its neighborhood. The two are combined to form a multi-scale and multi-directional texture feature descriptor. In terms of shape feature extraction, the edge detection operator combined with the contour analysis algorithm is adopted. First, the edge information in the image is extracted through the Canny operator, and then the edges are connected and fitted to calculate geometric parameters such as the perimeter, area, and circularity of the contour to form a shape feature vector. After the extraction of each modal feature is completed, the system performs weighted fusion on the extracted color, texture, and shape features according to the preset weight allocation strategy. This weight allocation strategy is dynamically adjusted based on the analysis results of the correlation between the defect type and the feature modality, and is specifically obtained through learning a large number of sample data in the training stage. For example, for surface scratch defects, the recognition contribution of the texture feature is relatively high, and the system will correspondingly increase the weight value of the texture feature; for hole defects, the discrimination ability of the shape feature is stronger, so the weight proportion of the shape feature is increased. During the fusion process, first, the feature vectors of each modality are normalized to have the same dimension and numerical range, and then the normalized feature vectors are linearly combined according to the weight coefficients to generate a multi-dimensional feature vector containing color, texture, and shape multi-modal information. This feature vector not only retains the unique information of each modality but also enhances the feature expression ability through weighted fusion, more comprehensively reflecting the microscopic and macroscopic features of the part surface. The finally generated multi-dimensional feature vector is input into the classification decision layer of the AI detection model. This layer adopts a deep learning network structure and establishes a mapping relationship between the feature vector and the defect type and location through multi-layer non-linear transformation and weight learning. In the training stage, the model uses a large number of labeled defect sample data for learning and continuously optimizes the network parameters; in the detection stage, the model outputs whether there are defects on the part surface and the specific type and location information of the defects according to the input multi-dimensional feature vector. This AI detection model with multi-modal feature fusion significantly improves the recognition accuracy and robustness for micro-defects, defects under complex texture backgrounds, and different types of defects by integrating complementary information of different modalities, effectively overcoming the limitations of single-modal feature detection.

[0026] According to an embodiment of the present invention, the parallel computing architecture includes: Dividing the image data into multiple sub-regions with adapted sizes; Allocating independent computing threads for each of the sub-regions; Utilizing the multi-core parallel computing capability to enable each thread to independently and parallelly process and analyze the corresponding sub-region, and after the processing is completed, combining the results of each sub-region.

[0027] Among them, first, the pre-processed second image data is divided into multiple sub-regions with adapted sizes according to a preset grid pattern. During the division process, the image feature distribution and computing resource balance are fully considered to ensure that each sub-region contains complete feature information and has similar computing complexity. For example, for regions with complex textures, a smaller sub-region size is adopted to ensure the accuracy of feature extraction, and for regions with uniform backgrounds, the sub-region size is appropriately increased to reduce the computing overhead. After the image division is completed, the system allocates independent computing threads for each sub-region, and these threads are scheduled to different cores of the multi-core processor for parallel execution. Each thread contains a complete image processing and analysis process, and independently completes the feature extraction of the sub-region to the defect recognition, avoiding data dependencies and synchronization overheads between threads. Specifically, each thread separately executes a multi-modal feature extraction algorithm for the allocated sub-region, parallelly extracts color, texture, and shape features, and then inputs the extracted feature vectors into the AI detection model for defect analysis and judgment, and outputs information such as the defect type, location, and severity within the sub-region. Utilizing the parallel computing capability of the multi-core processor, each thread simultaneously processes and analyzes the corresponding sub-region, significantly shortening the overall processing time. After all threads complete the sub-region processing, the system starts the result merging mechanism to integrate the detection results of each sub-region. During the merging process, first, the boundary detection results of adjacent sub-regions are subjected to consistency verification to eliminate boundary pseudo-defects caused by region division; then, according to the preset defect merging rules, the detection results belonging to the same defect in adjacent sub-regions are fused to generate a complete defect description; finally, the merged defect information is mapped back to the original image coordinate system to form the final detection result. This parallel computing architecture fully exploits the computing potential of the multi-core processor through three core steps of data division, thread allocation, and result merging, realizing the parallel processing of image data. Compared with the traditional serial processing method, the parallel computing architecture of the present invention improves the processing speed while maintaining the detection accuracy, and can meet the requirements of real-time detection during numerical control machining. In addition, this architecture also has good scalability, and can dynamically adjust the number of sub-regions and thread allocation strategies according to the computing resources and image data volume in actual applications, adapting to industrial detection scenarios of different scales.

[0028] Please refer to Figure 4 , Figure 4It is a flowchart of real-time feedback of detection results to the numerical control processing control system in some embodiments of the present application for the real-time detection of numerical control processing defects based on AI image recognition. According to the embodiments of the present invention, the real-time feedback of the detection results to the numerical control processing control system is specifically as follows: S401. When the AI detection model determines that there are defects on the surface of the part; S402. Generate a detection result including the defect type, precise position coordinates, and severity level classification based on a preset defect information generation rule; S403. Transmit the detection result to the numerical control processing control system according to a preset communication protocol; S404. The control system adjusts processing parameters such as cutting speed and feed rate according to a preset parameter adjustment rule.

[0029] Among them, when the multi-modal feature fusion AI detection model determines that there are defects on the part surface, the system immediately triggers a preset defect information generation rule. This rule automatically generates a structured detection result containing the defect type, precise position coordinates, and severity level based on the feature vector and classification result of the defect. The defect type is determined by comparing with the standard defect templates in the pre-trained model, covering common CNC machining defects such as cracks, sand holes, scratches, and deformations; the precise position coordinates are calculated based on the mapping relationship between the image coordinate system and the machine tool coordinate system to ensure that the control system can accurately locate the defect position; the severity level is divided into three levels: minor, medium, and severe for the defects according to parameters such as the size, depth, and quantity of the defects through a fuzzy evaluation algorithm, providing a quantitative basis for subsequent machining parameter adjustment. After generating the detection result, the system transmits the data packet containing the defect information to the CNC machining control system in real time according to the preset industrial communication protocol. The present invention adopts a communication protocol based on the OPC UA standard, which supports cross-platform data exchange and real-time communication, and can ensure the reliability and stability of data transmission. During the transmission process, the detection result is encapsulated as an object conforming to the OPC UA information model, including attributes such as defect type, position coordinates, and severity level, and is transmitted through an encrypted channel to prevent the data from being tampered with or lost during transmission. After receiving the detection result, the CNC machining control system automatically adjusts the machining parameters according to the preset parameter adjustment rules. These rules are based on a knowledge base combined with machine learning algorithms to establish a mapping relationship between defect features and machining parameters. For example, when a minor scratch is detected on the part surface, the system will appropriately reduce the cutting speed and increase the cutting fluid flow rate to reduce the friction between the tool and the part surface; when a medium-sized sand hole defect is detected, the system will adjust the feed rate and cutting depth to avoid further damage to the defect area by the tool; for severe defects, the system will automatically pause the machining process and issue an alarm to notify the operator to intervene. During the parameter adjustment process, the control system will monitor the machining status in real time and dynamically optimize the adjustment strategy according to the feedback information to form a closed-loop control loop. Through this real-time feedback mechanism, the present invention realizes the intelligent quality control of the CNC machining process, can timely detect and correct the defects in the machining process, and improve the product qualification rate and production efficiency. In addition, this feedback mechanism also has good adaptability and can quickly adapt to the detection requirements of new products and new processes by updating the defect information generation rules and parameter adjustment rules, providing strong support for intelligent manufacturing.

[0030] According to an embodiment of the present invention, the display on the monitoring interface includes: Adopting a preset visual encoding rule, marking the detected defect types with different colors and icons, and marking the precise defect position coordinates on the part image; Real-time collecting and statistically analyzing data such as the number of defects and occurrence frequency and displaying them according to the preset chart display format; Meanwhile, it provides the function of querying and analyzing historical results by combining multiple conditions such as time intervals and part batches.

[0031] Among them, first, the detected defects are graphically marked using preset visual encoding rules. The system assigns unique colors and icon identifiers to different types of defects. For example, cracks are represented by red wavy lines, sand holes are marked with blue dots, scratches are indicated by yellow arrows, etc. At the same time, the position coordinates of the defects are accurately marked on the part image. These coordinate information directly comes from the output results of the AI detection model, and through the mapping conversion between the image coordinate system and the actual physical coordinate system, the accuracy of the marked positions is ensured. The marking process uses a semi-transparent overlay technology, which not only clearly shows the defect positions but also does not block the original image information of the part, facilitating the operator to intuitively judge the distribution of the defects. In terms of real-time data statistics, the system continuously collects and analyzes key indicators such as the number of defects, occurrence frequency, and severity distribution, and presents them visually according to the preset chart display format. Specifically, a line chart is used to show the change trend of the number of defects over time, a bar chart is used to compare the occurrence frequencies of different types of defects, and a pie chart is used to analyze the proportion of defects in each severity level. These charts adopt a dynamic refresh mechanism, and the refresh period can be adjusted according to actual production requirements to ensure that the operator can timely grasp the quality changes during the processing. In addition, the system also provides a data export function, supporting the export of statistical data in formats such as Excel and CSV for subsequent in-depth analysis and report generation. To meet the needs of production traceability and quality analysis, the monitoring interface provides a multi-dimensional historical result query and analysis function. The operator can query through a combination of multiple conditions such as time interval, part batch, defect type, and severity. The system quickly locates and displays the historical detection results that meet the conditions. The query results are displayed in a list form, including detailed information such as detection time, part number, defect type, position coordinates, and severity. Clicking on any record in the list can view the corresponding original image and defect marking situation. In addition, the system also supports the comparative analysis function of historical data, which can display the detection results of multiple time periods or batches at the same time, and intuitively present the quality change trend and potential problems through data visualization technology. In terms of interface design, the monitoring interface adopts a hierarchical layout and modular design. The main interface is divided into three main modules: the image display area, the data statistics area, and the query operation area. Smooth switching is achieved between the modules through an animation transition effect. The interface elements adopt a responsive design, which can automatically adjust the layout and size according to different display devices to ensure a good user experience on various terminals such as PC, tablet, and mobile phone. At the same time, the system supports multi-user permission management, and operators at different levels have different operation permissions to ensure data security and operation specifications. Through this comprehensive monitoring interface design, the present invention provides an intuitive and efficient quality monitoring means for the CNC machining process, helping the operator to timely discover quality problems, optimize processing parameters, and improve production efficiency and product quality.

[0032] According to an embodiment of the present invention, it further includes a blockchain module, and is characterized in that: Encrypt data such as detection results, processing parameters, and part batches through a hashing algorithm and write them into the blockchain; Support querying the full - life - cycle quality data of any part through a blockchain browser.

[0033] Among them, first, a distributed blockchain network is constructed. Key data such as detection results, processing parameters (such as cutting speed, feed rate, spindle speed, etc.), part batch numbers, and detection timestamps are structurally encapsulated. The data is encrypted through the SHA - 256 hashing algorithm to generate a unique hash value, and this hash value is written into the distributed ledger of the blockchain together with the original data meta - information (such as data type, generation time). The blockchain network adopts a consortium chain architecture, and participating nodes include production equipment, quality monitoring systems, supply chain management platforms, etc., ensuring that data is shared in real - time within the authorized scope and cannot be tampered with. The system supports providing a full - life - cycle quality data query function through a blockchain browser. Operators or managers can retrieve the corresponding block information in the blockchain network by inputting query conditions such as part batch numbers and detection time intervals. After being verified by a smart contract, the query result decrypts and displays the complete quality data chain of the part, including detection results (such as defect types, locations, severity) at each processing stage, corresponding processing parameter settings, operator information, etc. Due to the distributed storage characteristics of the blockchain, once the data is uploaded to the chain, an irreversible timestamp record is formed. Any act of tampering with the data will cause the hash value verification to fail, thus ensuring the authenticity and integrity of the quality data. By integrating the blockchain module, the present invention constructs a trusted data closed - loop from part processing to quality inspection, solving problems such as easy data tampering and incomplete traceability chains existing in traditional quality traceability systems. It can help enterprises quickly locate the source of defective parts, abnormal links in the processing process, and responsible entities, greatly shortening the time for troubleshooting quality problems and reducing recall costs.

[0034] According to an embodiment of the present invention, further dock with a manufacturing execution system, including: Real - time synchronize the defect type, part batch, and processing parameter adjustment records in the detection results to the manufacturing execution system; Trigger production scheduling adjustments according to preset rules, including part rework path planning, equipment maintenance warnings, or raw material batch traceability.

[0035] Among them, after the AI detection model completes defect recognition and generates detection results including defect types, part batches, and machining parameter adjustment records, the system immediately synchronizes these key data to the production database of the MES system in real time through the OPC UA industrial communication protocol. The synchronized data not only includes defect types (such as cracks, sand holes, etc.) and part batch information, but also covers machining parameter adjustment records (such as adjusted cutting speed, feed rate, etc.) for defect correction, ensuring that the MES system obtains a complete quality event context. After receiving the detection data, the MES system automatically triggers the corresponding production scheduling adjustment process according to preset business rules. If it is detected that the part has minor defects and can be repaired by rework, the MES system will call the rework strategy in the process knowledge base to dynamically generate the optimal rework path, including specifying rework equipment, required tooling, and machining processes, and send the path information to the shop floor operation terminal. For equipment with frequent occurrence of the same type of defects, the system will automatically trigger an equipment maintenance warning, generate a maintenance work order including maintenance types (such as tool replacement, accuracy calibration) and time windows, and push it to the equipment management module. If the defect is traced back to the raw material batch problem, the MES system will immediately start the batch traceability function, associate data such as raw material incoming inspection records and supplier information through the material code, quickly locate the problem batch, and generate instructions for raw material deactivation or reinspection to prevent defective raw materials from continuing to be put into production. This real-time data synchronization and intelligent scheduling mechanism upgrades the detection system of the present invention from a simple quality inspection tool to an intelligent decision-making assistance system for the production process. Through collaborative work with the MES system, it realizes full-process automation from defect detection to production scheduling optimization, significantly shortens the quality problem handling cycle, reduces the cost of manual intervention, and provides strong support for enterprise quality control.

[0036] The present invention also discloses a real-time detection system for CNC machining defects based on AI image recognition, including a memory and a processor. The memory includes a program for the real-time detection method of CNC machining defects based on AI image recognition. When the program for the real-time detection method of CNC machining defects based on AI image recognition is executed by the processor, the following steps are implemented: Collect the first image data of the surface of the machined part according to a preset shooting frequency, and transmit the first image data to the data preprocessing module in real time; Perform noise reduction and contrast enhancement processing on the first image data, and use the dynamic threshold algorithm to separate the part and the background area to obtain the second image data; Input the second image data into the AI detection model with multi-modal feature fusion, extract features and fuse them to generate a feature vector, and analyze and judge the defect type and position on the part surface through the model; The second image data is processed using a parallel computing architecture, and the detection results are fed back to the numerical control machining control system in real time and displayed on the monitoring interface.

[0037] Among them, first, according to a preset shooting frequency, the surface of the machined part is photographed by an image acquisition device to obtain the first image data, and these data are transmitted to the data preprocessing module in real time. In the data preprocessing module, the first image data is first denoised to eliminate noise interference in the image caused by factors such as the shooting environment and equipment, and then the contrast is enhanced to make the part features in the image more obvious. Then, the dynamic threshold algorithm is used to traverse the image through a sliding window, analyze the local features of the image in each window, establish a corresponding feature parameter model according to the gray distribution, texture features, and brightness differences in the window area, and dynamically adjust the segmentation threshold based on this model to effectively separate the part area from the background area and obtain the second image data. Then, the second image data is input into an AI detection model with multi-modal feature fusion. This model uses corresponding feature extraction algorithms to extract various modal features such as the color, texture, and shape of the image, and then, according to a preset weight distribution strategy, the extracted color, texture, and shape features are weighted and fused to generate a multi-dimensional feature vector containing multi-modal information. The model further analyzes and determines the type and location of surface defects of the part. When processing the second image data, a parallel computing architecture is adopted. The image data is divided into multiple sub-regions with appropriate sizes, independent computing threads are assigned to each sub-region, and the multi-core parallel computing ability is utilized to enable each thread to independently and parallelly process and analyze the corresponding sub-region. After the processing is completed, the results of each sub-region are combined to improve the processing efficiency. Finally, the detection results are fed back to the numerical control machining control system in real time. When the AI detection model determines that there are defects on the surface of the part, based on a preset defect information generation rule, a detection result containing the defect type, accurate position coordinates, and severity level classification is generated. According to a preset communication protocol, the detection results are transmitted to the numerical control machining control system. According to a preset parameter adjustment rule, the control system adjusts machining parameters such as cutting speed and feed rate. At the same time, on the monitoring interface, using a preset visual encoding rule, different colors and icons are used to mark the detected defect types, and the accurate defect position coordinates are marked on the part image. The number of defects, occurrence frequency, and other data are collected and statistically analyzed in real time and displayed according to a preset chart display format. A historical result query and analysis function with multiple condition combinations such as time intervals and part batches is also provided.

[0038] According to an embodiment of the present invention, the use of the dynamic threshold algorithm to separate the part from the background area is specifically as follows: Traverse the image through a sliding window and analyze the local features of the image in each window; Establish a corresponding feature parameter model based on the gray-scale distribution, texture features, and brightness differences within the window area; Dynamically adjust the segmentation threshold according to this model to effectively separate the part area from the background area.

[0039] Among them, the specific implementation process of using the dynamic threshold algorithm to separate the part and the background area is as follows: First, use the sliding window technique to traverse and scan the image after noise reduction and contrast enhancement processing. The sliding window moves row by row and column by column on the image according to a preset step size to ensure that every local area of the image is covered. For the image data within each window, the system synchronously analyzes the local feature information it contains, which mainly includes gray-scale distribution characteristics, texture feature parameters, and brightness difference data. The gray-scale distribution characteristics are characterized by statistically analyzing the probability distribution of pixel gray-scale values within the window, the texture feature parameters are obtained by calculating texture statistics such as contrast, correlation, energy, and homogeneity, and the brightness difference data is obtained by analyzing the change range and gradient information of pixel brightness values within the window. Based on the multi-dimensional feature information such as the gray-scale distribution, texture features, and brightness differences within the extracted window area, the system constructs a corresponding feature parameter model. This model is essentially a dynamic mathematical model, and its internal parameters will be adjusted in real time according to the feature data of the current window area to accurately reflect the image characteristics of this local area. During the model establishment process, the system will use statistical methods and machine learning algorithms to deeply mine and analyze the feature data within the window to determine the combination of feature parameters that can best reflect the difference between the part and the background. After the feature parameter model is constructed, the system dynamically calculates and adjusts the segmentation threshold applicable to the current window area according to this model. Specifically, the model will calculate an optimal segmentation threshold according to the matching degree between the feature data within the window and the preset part feature template or background feature template, and this threshold can maximize the distinction between the part area and the background area. By repeating the above dynamic threshold calculation and segmentation process for all window areas of the entire image, the effective separation of the part area from the background area is finally achieved, and the second image data containing only part information is obtained, providing a high-quality data basis for subsequent defect detection and analysis. This dynamic threshold algorithm based on local feature analysis can better adapt to complex situations such as uneven illumination and texture changes on the part surface during the processing compared to the traditional global fixed threshold algorithm, significantly improving the segmentation accuracy and robustness of the part and background areas.

[0040] According to an embodiment of the present invention, the AI detection model for multi-modal feature fusion includes: Respectively use corresponding feature extraction algorithms to extract various modal features such as the color, texture, and shape of the image; According to the preset weight distribution strategy, weight and fuse the extracted color, texture, and shape features to generate a multi-dimensional feature vector containing multi-modal information.

[0041] Among them, first, for the preprocessed second image data, specifically designed feature extraction algorithms are respectively used to extract multiple modal features such as color, texture, and shape in parallel. In terms of color feature extraction, the HSV color space conversion combined with the color histogram statistical method is adopted. After converting the RGB image to the HSV space, the histogram distributions of the hue, saturation, and brightness channels are respectively calculated to form a color feature vector, which can effectively represent the color change and distribution law of the part surface. In terms of texture feature extraction, the method combining the Gabor filter bank and the local binary pattern (LBP) is used. The Gabor filter bank captures the local texture information of the image through filtering operations of different scales and directions, and the LBP operator counts the gray difference patterns between the pixel point and its neighborhood. The two are combined to form a multi-scale and multi-directional texture feature descriptor. In terms of shape feature extraction, the edge detection operator combined with the contour analysis algorithm is adopted. First, the edge information in the image is extracted by the Canny operator, and then the edges are connected and fitted, and geometric parameters such as the perimeter, area, and circularity of the contour are calculated to form a shape feature vector. After the extraction of each modal feature is completed, the system performs weighted fusion on the extracted color, texture, and shape features according to the preset weight assignment strategy. This weight assignment strategy is dynamically adjusted based on the analysis result of the correlation between the defect type and the feature modality, and is specifically obtained through learning a large number of sample data in the training stage. For example, for surface scratch defects, the recognition contribution of the texture feature is relatively high, and the system will correspondingly increase the weight value of the texture feature; for hole defects, the discrimination ability of the shape feature is stronger, so the weight proportion of the shape feature is increased. During the fusion process, first, the feature vectors of each modality are normalized to have the same dimension and numerical range, and then the normalized feature vectors are linearly combined according to the weight coefficients to generate a multi-dimensional feature vector containing color, texture, and shape multi-modal information. This feature vector not only retains the unique information of each modality but also enhances the feature expression ability through weighted fusion, more comprehensively reflecting the microscopic and macroscopic features of the part surface. The finally generated multi-dimensional feature vector is input into the classification decision layer of the AI detection model. This layer adopts a deep learning network structure and establishes a mapping relationship between the feature vector and the defect type and location through multi-layer non-linear transformation and weight learning. In the training stage, the model uses a large number of labeled defect sample data for learning and continuously optimizes the network parameters; in the detection stage, the model outputs whether there are defects on the part surface and the specific type and location information of the defects according to the input multi-dimensional feature vector. This AI detection model with multi-modal feature fusion significantly improves the recognition accuracy and robustness for micro-defects, defects under complex texture backgrounds, and different types of defects by integrating complementary information of different modalities, effectively overcoming the limitations of single-modal feature detection.

[0042] According to an embodiment of the present invention, the parallel computing architecture includes: Dividing the image data into multiple sub-regions with adaptable sizes; Allocating independent computing threads to each of the sub-regions; Utilizing the multi-core parallel computing capability to enable each thread to independently and parallelly process and analyze the corresponding sub-region, and merging the results of each sub-region after the processing is completed.

[0043] Among them, first, the preprocessed second image data is divided into multiple sub-regions with adaptable sizes according to a preset grid pattern. During the division process, the image feature distribution and computing resource balance are fully considered to ensure that each sub-region contains complete feature information and has similar computing complexity. For example, for regions with complex textures, smaller sub-region sizes are used to ensure the accuracy of feature extraction, and for uniform background regions, the sub-region sizes are appropriately increased to reduce the computing overhead. After the image division is completed, the system allocates independent computing threads to each sub-region, and these threads are scheduled to different cores of the multi-core processor to execute in parallel. Each thread contains a complete image processing and analysis process, and independently completes the process from feature extraction of the sub-region to defect recognition, avoiding data dependencies and synchronization overheads between threads. Specifically, each thread respectively executes a multi-modal feature extraction algorithm for the allocated sub-region, parallelly extracts color, texture, and shape features, and then inputs the extracted feature vectors into the AI detection model for defect analysis and judgment, and outputs information such as the defect type, location, and severity within the sub-region. Utilizing the parallel computing capability of the multi-core processor, each thread simultaneously processes and analyzes the corresponding sub-region, significantly shortening the overall processing time. After all threads complete the sub-region processing, the system starts the result merging mechanism to integrate the detection results of each sub-region. During the merging process, first, the boundary detection results of adjacent sub-regions are subjected to consistency verification to eliminate boundary pseudo-defects caused by region division; then, according to the preset defect merging rules, the detection results belonging to the same defect in adjacent sub-regions are fused to generate a complete defect description; finally, the merged defect information is mapped back to the original image coordinate system to form the final detection result. This parallel computing architecture fully exploits the computing potential of the multi-core processor through three core steps of data division, thread allocation, and result merging, realizing the parallel processing of image data. Compared with the traditional serial processing method, the parallel computing architecture of the present invention improves the processing speed while maintaining the detection accuracy, and can meet the requirements of real-time detection in the numerical control machining process. In addition, this architecture also has good scalability and can dynamically adjust the number of sub-regions and thread allocation strategies according to the computing resources and image data volume in actual applications to adapt to different scales of industrial detection scenarios.

[0044] According to an embodiment of the present invention, the real-time feedback of the detection result to the numerical control machining control system is specifically as follows: When the AI detection model determines that there are defects on the part surface; Based on the preset defect information generation rules, generate a detection result including the defect type, precise position coordinates, and severity grading; According to the preset communication protocol, transmit the detection result to the numerical control machining control system; Based on the preset parameter adjustment rules, the control system adjusts machining parameters such as cutting speed and feed rate.

[0045] Among them, when the AI detection model for multi-modal feature fusion determines that there are defects on the part surface, the system immediately triggers a preset defect information generation rule. Based on the feature vector and classification result of the defect, this rule automatically generates a structured detection result including the defect type, precise position coordinates, and severity level classification. The defect type is determined by comparing with the standard defect templates in the pre-trained model, covering common CNC machining defects such as cracks, sand holes, scratches, and deformations; the precise position coordinates are calculated based on the mapping relationship between the image coordinate system and the machine tool coordinate system to ensure that the control system can accurately locate the defect position; the severity level classification divides the defect into three levels: minor, medium, and severe according to parameters such as the size, depth, and quantity of the defect through a fuzzy evaluation algorithm, providing a quantitative basis for subsequent machining parameter adjustment. After generating the detection result, the system transmits the data packet containing the defect information to the CNC machining control system in real time according to the preset industrial communication protocol. The present invention adopts a communication protocol based on the OPC UA standard, which supports cross-platform data exchange and real-time communication, and can ensure the reliability and stability of data transmission. During the transmission process, the detection result is encapsulated as an object conforming to the OPC UA information model, including attributes such as defect type, position coordinates, and severity level, and is transmitted through an encrypted channel to prevent data from being tampered with or lost during transmission. After receiving the detection result, the CNC machining control system automatically adjusts the machining parameters according to the preset parameter adjustment rules. These rules are based on a knowledge base combined with machine learning algorithms to establish a mapping relationship between defect features and machining parameters. For example, when a minor scratch is detected on the part surface, the system will appropriately reduce the cutting speed and increase the cutting fluid flow rate to reduce the friction between the tool and the part surface; when a medium-sized sand hole defect is detected, the system will adjust the feed rate and cutting depth to avoid further damage to the defect area by the tool; for severe defects, the system will automatically pause the machining process and issue an alarm to notify the operator to intervene. During the parameter adjustment process, the control system will monitor the machining status in real time and dynamically optimize the adjustment strategy according to the feedback information to form a closed-loop control loop. Through this real-time feedback mechanism, the present invention realizes the intelligent quality control of the CNC machining process, can timely detect and correct defects in the machining process, and improve the product qualification rate and production efficiency. In addition, this feedback mechanism also has good adaptability, and can quickly adapt to the detection requirements of new products and new processes by updating the defect information generation rule and parameter adjustment rule, providing strong support for intelligent manufacturing.

[0046] According to an embodiment of the present invention, the display on the monitoring interface includes: Adopting a preset visual encoding rule, marking the detected defect types with different colors and icons, and marking the precise defect position coordinates on the part image; Real-time collecting and statistically analyzing data such as the number of defects and occurrence frequency and displaying them according to the preset chart display format; At the same time, it provides the function of querying and analyzing historical results by combining various conditions such as time intervals and part batches.

[0047] Among them, first, the detected defects are graphically marked using preset visual encoding rules. The system assigns unique colors and icon identifiers to different types of defects. For example, cracks are represented by red wavy lines, sand holes are marked with blue dots, scratches are indicated by yellow arrows, etc. At the same time, the position coordinates of the defects are accurately marked on the part image. These coordinate information directly comes from the output results of the AI detection model, and through the mapping conversion between the image coordinate system and the actual physical coordinate system, the accuracy of the marked position is ensured. The marking process uses a semi-transparent overlay technology, which not only clearly shows the defect position but also does not block the original image information of the part, facilitating the operator to intuitively judge the distribution of defects. In terms of real-time data statistics, the system continuously collects and analyzes key indicators such as the number of defects, occurrence frequency, and severity distribution, and presents them visually according to the preset chart display format. Specifically, a line chart is used to show the change trend of the number of defects over time, a bar chart is used to compare the occurrence frequencies of different types of defects, and a pie chart is used to analyze the proportion of defects in each severity level. These charts adopt a dynamic refresh mechanism, and the refresh period can be adjusted according to actual production requirements to ensure that the operator can timely grasp the quality changes during the processing. In addition, the system also provides a data export function, supporting the export of statistical data in formats such as Excel and CSV for subsequent in-depth analysis and report generation. To meet the needs of production traceability and quality analysis, the monitoring interface provides a multi-dimensional historical result query and analysis function. The operator can query through a combination of multiple conditions such as time interval, part batch, defect type, and severity. The system quickly locates and displays the historical detection results that meet the conditions. The query results are displayed in a list form, including detailed information such as detection time, part number, defect type, position coordinates, and severity. Clicking on any record in the list can view the corresponding original image and defect marking situation. In addition, the system also supports the comparative analysis function of historical data, which can display the detection results of multiple time periods or batches at the same time, and intuitively present the quality change trend and potential problems through data visualization technology. In terms of interface design, the monitoring interface adopts a hierarchical layout and modular design. The main interface is divided into three main modules: an image display area, a data statistics area, and a query operation area. Smooth switching between modules is achieved through an animation transition effect. The interface elements adopt a responsive design, which can automatically adjust the layout and size according to different display devices to ensure a good user experience on various terminals such as PC, tablet, and mobile phone. At the same time, the system supports multi-user permission management, and operators at different levels have different operation permissions to ensure data security and operation specifications. Through this comprehensive monitoring interface design, the present invention provides an intuitive and efficient quality monitoring means for the numerical control processing process, helping operators to timely discover quality problems, optimize processing parameters, and improve production efficiency and product quality.

[0048] According to an embodiment of the present invention, it further includes a blockchain module, and is characterized in that: Encrypt data such as detection results, processing parameters, and part batches through a hashing algorithm and write them into the blockchain; Support querying the full - life - cycle quality data of any part through a blockchain browser.

[0049] Among them, first, a distributed blockchain network is constructed. Key data such as detection results, processing parameters (such as cutting speed, feed rate, spindle speed, etc.), part batch numbers, and detection timestamps are structurally encapsulated. The data is encrypted through the SHA - 256 hashing algorithm to generate a unique hash value, and this hash value is written into the distributed ledger of the blockchain together with the original data meta - information (such as data type, generation time). The blockchain network adopts a consortium chain architecture, and the participating nodes include production equipment, quality monitoring systems, supply chain management platforms, etc., to ensure that data is shared in real - time within the authorized scope and cannot be tampered with. The system supports providing a full - life - cycle quality data query function through a blockchain browser. Operators or managers can query corresponding block information in the blockchain network by inputting query conditions such as part batch numbers and detection time intervals. After being verified by a smart contract, the query result decrypts and displays the complete quality data chain of the part, including detection results (such as defect types, locations, severities) at each processing stage, corresponding processing parameter settings, operator information, etc. Due to the distributed storage characteristics of the blockchain, once the data is uploaded to the chain, an irreversible timestamp record is formed, and any tampering with the data will cause the hash value verification to fail, thus ensuring the authenticity and integrity of the quality data. By integrating the blockchain module, the present invention constructs a trusted data closed - loop from part processing to quality inspection, solving problems such as easy data tampering and incomplete traceability chains existing in traditional quality traceability systems. It can help enterprises quickly locate the sources of defective parts, abnormal links in the processing process, and responsible parties, greatly shortening the time for troubleshooting quality problems and reducing recall costs.

[0050] According to an embodiment of the present invention, further dock with a manufacturing execution system, including: Real - time synchronize defect types, part batches, and processing parameter adjustment records in the detection results to the manufacturing execution system; Trigger production scheduling adjustments according to preset rules, including part rework path planning, equipment maintenance warnings, or raw material batch traceability.

[0051] Among them, when the AI detection model completes defect recognition and generates a detection result including defect type, part batch, and machining parameter adjustment records, the system immediately synchronizes these key data to the production database of the MES system in real time through the OPC UA industrial communication protocol. The synchronized data not only includes the types of defects (such as cracks, sand holes, etc.) and part batch information, but also covers the machining parameter adjustment records for defect correction (such as adjusted cutting speed, feed rate, etc.), ensuring that the MES system obtains a complete quality event context. After receiving the detection data, the MES system automatically triggers the corresponding production scheduling adjustment process according to the preset business rules. If it is detected that the part has minor defects and can be repaired by rework, the MES system will call the rework strategy in the process knowledge base to dynamically generate the optimal rework path, including specifying rework equipment, required tooling, and machining processes, and send the path information to the shop floor operation terminal. For equipment with frequent occurrence of the same type of defects, the system will automatically trigger an equipment maintenance warning, generate a maintenance work order including maintenance type (such as tool replacement, accuracy calibration) and time window, and push it to the equipment management module. If the defect is traced back to the raw material batch problem, the MES system will immediately start the batch traceability function, associate data such as raw material incoming inspection records and supplier information through the material code, quickly locate the problem batch, and generate instructions for raw material deactivation or reinspection to prevent defective raw materials from continuing to be put into production. This real-time data synchronization and intelligent scheduling mechanism upgrades the detection system of the present invention from a simple quality detection tool to an intelligent decision-making assistance system for the production process. Through collaborative work with the MES system, it realizes the full-process automation from defect detection to production scheduling optimization, significantly shortens the quality problem handling cycle, reduces the manual intervention cost, and provides strong support for enterprise quality control.

[0052] The third aspect of the present invention provides a computer-readable storage medium, which includes a program for the real-time detection method of CNC machining defects based on AI image recognition. When the program for the real-time detection method of CNC machining defects based on AI image recognition is executed by a processor, it realizes the steps of the real-time detection method of CNC machining defects based on AI image recognition as described in any one of the above.

[0053] The real-time detection method, system and medium for numerical control machining defects based on AI image recognition disclosed by the present invention focus on achieving full-process intelligent control of machining quality through multi-technology integration. First, an image acquisition device is used to obtain the surface image of the part at a preset frequency. After noise reduction, contrast enhancement and dynamic threshold segmentation are completed by the data preprocessing module, a dynamic model is constructed by analyzing local gray level, texture and brightness features through a sliding window to achieve precise separation of the part from the background. Subsequently, an AI detection model with multi-modal feature fusion extracts color, texture and shape features in parallel, generates a multi-dimensional feature vector through weighted fusion, and analyzes the defect type and location through a deep learning network. During this process, the parallel computing architecture divides the image into adaptive sub-regions, and significantly improves the detection efficiency through multi-core thread parallel processing and result merging. When the detection result is fed back to the numerical control system in real time, the system generates structured data based on the defect type, location and severity, transmits it to the control system through an industrial communication protocol to adjust the machining parameters, and at the same time marks the defects, statistics data and provides a historical traceability function with visual encoding on the monitoring interface. Further, the system integrates a blockchain module, and stores data such as detection results and machining parameters on the chain through hash encryption to achieve non-tamperable traceability of quality data throughout the life cycle; after docking with the Manufacturing Execution System (MES), it synchronizes defect data in real time to trigger production scheduling adjustments, covering rework path planning, equipment maintenance warnings and raw material traceability, forming a "detection - analysis - scheduling" closed loop. The whole solution breaks through the limitations of low detection efficiency and poor adaptability of traditional detection through dynamic threshold segmentation, multi-modal feature fusion, parallel computing, blockchain traceability and system coordination, and significantly improves the intelligent level of numerical control machining and the product quality control ability.

[0054] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling or communication connection between the components shown or discussed with each other can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0055] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0056] In addition, each functional unit in the embodiments of the present invention may be entirely integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the above integrated unit may be implemented in the form of hardware, or in the form of a hardware plus a software functional unit.

[0057] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: removable storage devices, read-only memories, random access memories, magnetic disks, or optical disks and other various media that can store program codes.

[0058] Alternatively, if the above integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. And the foregoing storage medium includes: removable storage devices, ROM, RAM, magnetic disks, or optical disks and other various media that can store program codes.

Claims

1. A real-time detection method for numerical control machining defects based on AI image recognition, characterized in that, Including the following steps: Collect the first image data of the surface of the machined part according to a preset shooting frequency, and transmit the first image data to the data preprocessing module in real time; Perform noise reduction and contrast enhancement processing on the first image data, and use a dynamic threshold algorithm to separate the part and the background area to obtain the second image data; Input the second image data into an AI detection model with multi-modal feature fusion, extract features and fuse them to generate a feature vector, and analyze and judge the type and position of surface defects of the part through the model; Adopt a parallel computing architecture to process the second image data, and feedback the detection result to the numerical control machining control system in real time and display it on the monitoring interface.

2. The real-time detection method for numerical control machining defects based on AI image recognition according to claim 1, characterized in that The specific method of using the dynamic threshold algorithm to separate the part and the background area is as follows: Traverse the image through a sliding window, and analyze the local features of the image in each window; Establish a corresponding feature parameter model according to the gray distribution, texture features and brightness differences in the window area; Dynamically adjust the segmentation threshold according to this model to effectively separate the part area and the background area.

3. The real-time detection method for CNC machining defects based on AI image recognition according to claim 1, characterized in that The AI detection model with multi-modal feature fusion includes: Respectively use corresponding feature extraction algorithms to extract various modal features such as the color, texture and shape of the image; According to a preset weight distribution strategy, weight and fuse the extracted color, texture and shape features to generate a multi-dimensional feature vector containing multi-modal information.

4. The real-time detection method for numerical control machining defects based on AI image recognition according to claim 1, characterized in that, The parallel computing architecture includes: Divide the image data into multiple sub-regions with appropriate sizes; Allocate independent computing threads for each of the sub-regions; Utilize the multi-core parallel computing ability to enable each thread to independently and parallelly process and analyze the corresponding sub-region, and merge the results of each sub-region after processing.

5. The real-time detection method for numerical control machining defects based on AI image recognition according to claim 1, wherein, The specific method of feedbacking the detection result to the numerical control machining control system in real time is as follows: When the AI detection model determines that there are defects on the surface of the part; Generate a detection result including the defect type, accurate position coordinates and severity level based on a preset defect information generation rule; Transmit the detection result to the numerical control machining control system according to a preset communication protocol; According to a preset parameter adjustment rule, the control system adjusts machining parameters such as cutting speed and feed rate.

6. The real-time detection method for numerical control machining defects based on AI image recognition according to claim 1, characterized in that, The display on the monitoring interface includes: Adopt a preset visual coding rule, mark the detected defect types with different colors and icons, and mark the accurate defect position coordinates on the part image; Collect and count data such as the number of defects and occurrence frequency in real time and display them according to a preset chart display format; At the same time, provide a historical result query and analysis function with multiple condition combinations such as time interval and part batch.

7. A real-time detection system for numerical control machining defects based on AI image recognition, characterized in that, Including a memory and a processor, the memory includes a program for real-time detection of numerical control machining defects based on AI image recognition. When the program for real-time detection of numerical control machining defects based on AI image recognition is executed by the processor, the following steps are realized: Collect the first image data of the surface of the machined part according to a preset shooting frequency, and transmit the first image data to the data preprocessing module in real time; Perform noise reduction and contrast enhancement processing on the first image data, and use a dynamic threshold algorithm to separate the part and the background area to obtain the second image data; Input the second image data into the AI detection model for multi-modal feature fusion, extract features and fuse them to generate a feature vector, and analyze and judge the type and location of part surface defects through the model; Process the second image data using a parallel computing architecture, and feedback the detection results to the numerical control processing control system in real time and display them on the monitoring interface.

8. The real-time detection system for numerical control machining defects based on AI image recognition according to claim 7, wherein The dynamic threshold algorithm is used to separate the part and the background area, specifically: Traverse the image through a sliding window and analyze the local features of the image within each window; Establish a corresponding feature parameter model according to the gray distribution, texture features, and brightness differences within the window area; Dynamically adjust the segmentation threshold according to this model to effectively separate the part area from the background area.

9. The real-time detection system for numerical control machining defects based on AI image recognition according to claim 7, wherein, The AI detection model for multi-modal feature fusion includes: Respectively use corresponding feature extraction algorithms to extract various modal features such as color, texture, and shape of the image; According to the preset weight assignment strategy, weight and fuse the extracted color, texture, and shape features to generate a multi-dimensional feature vector containing multi-modal information.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a program for the real-time detection method of numerical control machining defects based on AI image recognition. When the program for the real-time detection method of numerical control machining defects based on AI image recognition is executed by a processor, the steps of the real-time detection method of numerical control machining defects based on AI image recognition as described in any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Material dynamic coding method, system and equipment

    CN120597838A

  • A method, system and equipment for dynamic coding of materials

    CN120597838B

  • AI appearance defect identification method for multiple acquisition terminals

    CN120894318A

  • Online visual detection method and system for die-cutting mylar product

    CN120948470A

  • A system and method for visual defect classification management based on scan results

    CN121300676A