Defect detection method, device and equipment for numerical control machining product and storage medium
By using effective channel adaptive attention model and single-step multi-frame object detection model in CNC processing products, the problem of low detection accuracy and efficiency caused by manual visual inspection is solved, and the more High detection accuracy and efficiency.
Patent Information
- Application Number
- CN202411189505.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
AI Technical Summary
The defect detection of existing CNC processing products relies on manual visual inspection, resulting in low detection accuracy and efficiency, which is greatly affected by the subjective experience of the inspector.
Using the target defect detection method based on the effective channel adaptive attention model and the single-step multi-frame object detection model, the X-ray image of the CNC processing product and input it into the target defect detection model is fused to improve detection accuracy and efficiency.
It improves the accuracy and efficiency of defect detection of CNC processing products, enhances the feature extraction ability of small target defects, makes small target defects easier to be detected, and improves the credibility and user experience of detection.
Smart Images

Figure CN119090840A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to a defect detection method, device, equipment and storage medium for CNC machined products. Background Art
[0002] CNC machining products use computerized numerical control (CNC) technology to control machine tools (such as milling machines, lathes, grinders, etc.) through specific program instructions to perform cutting, forming and other processing processes, thereby manufacturing parts or products with complex shapes and high precision. In the production process of CNC machining products, there are often defects in the CNC machining products produced due to certain reasons (for example, machine tool failure or severe wear of machining tools, etc.), so it is particularly important to detect defects in CNC machining products.
[0003] At present, defect detection of CNC machined products mainly relies on manual visual inspection of CNC machined products by inspectors. The detection results are easily affected by the subjective experience of inspectors, resulting in low detection accuracy of defect detection of CNC machined products. In addition, manual visual inspection leads to low detection efficiency of defect detection of CNC machined products. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a defect detection method, device, equipment and storage medium for CNC machined products to overcome or at least partially solve the above problems of the prior art.
[0005] In a first aspect, an embodiment of the present application provides a defect detection method for a CNC machined product, comprising: obtaining a current X-ray image of the current CNC machined product; inputting the current X-ray image into a target defect detection model to obtain a corresponding defect detection result, wherein the target defect detection model is obtained based on an effective channel adaptive attention model and a single-step multi-frame target detection model, wherein the effective channel adaptive attention model is used to fuse different channel features of the current X-ray image, and the defect detection result includes a first detection result for characterizing that the current X-ray image does not contain the current defect information, and a second detection result for characterizing that the current X-ray image contains the current defect information.
[0006] In the second aspect, the embodiment of the present application provides a defect detection device for a CNC machined product, including an image acquisition module and an image input module. The image acquisition module is used to acquire a current X-ray image of the current CNC machined product; the image input module is used to input the current X-ray image into a target defect detection model to obtain a corresponding defect detection result, the target defect detection model is obtained based on an effective channel adaptive attention model and a single-step multi-frame target detection model, the effective channel adaptive attention model is used to fuse different channel features of the current X-ray image, and the defect detection result includes a first detection result for characterizing that the current X-ray image does not contain the current defect information, and a second detection result for characterizing that the current X-ray image contains the current defect information.
[0007] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory; one or more processors coupled to the memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the defect detection method for CNC machining products provided in the first aspect above.
[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute a defect detection method for CNC machined products as provided in the first aspect above.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer device, the computer device executes the defect detection method for CNC machined products provided in the first aspect above.
[0010] The solution provided in the present application obtains a current X-ray image of a current CNC machined product and inputs the current X-ray image into a target defect detection model to obtain a corresponding defect detection result. The target defect detection model is obtained based on an effective channel adaptive attention model and a single-step multi-frame target detection model. The effective channel adaptive attention model is used to fuse different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information. This realizes defect detection of the current CNC machined product using the target defect detection model constructed according to the effective channel adaptive attention model and the single-step multi-frame target detection model, thereby improving the detection accuracy and efficiency of defect detection of CNC machined products.
[0011] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the single-step multi-frame target detection model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A schematic diagram of a scenario of a defect detection system for CNC machined products provided in an embodiment of the present application is shown.
[0014] Figure 2 A flow chart of a defect detection method for CNC machined products provided in an embodiment of the present application is shown.
[0015] Figure 3 A structural schematic diagram of an effective channel adaptive attention model in a defect detection method for CNC machined products provided in an embodiment of the present application is shown.
[0016] Figure 4 A structural schematic diagram of a target defect detection model in a defect detection method for a CNC machined product provided in an embodiment of the present application is shown.
[0017] Figure 5 Another flow chart of the defect detection method for CNC machined products provided in an embodiment of the present application is shown.
[0018] Figure 6 A structural block diagram of a defect detection device for CNC machined products provided in an embodiment of the present application is shown.
[0019] Figure 7 A functional block diagram of an electronic device provided in an embodiment of the present application is shown.
[0020] Figure 8 A computer-readable storage medium provided in an embodiment of the present application for storing or carrying program codes for implementing a defect detection method for a CNC machined product provided in an embodiment of the present application is shown.
[0021] Fig. 9A computer program product provided in an embodiment of the present application and used for storing or carrying program codes for implementing a defect detection method for a CNC machined product provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0022] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0024] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0025] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0026] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0027] CNC machining products use computerized numerical control (CNC) technology to control machine tools (such as milling machines, lathes, grinders, etc.) through specific program instructions to perform cutting, forming and other processing processes, thereby manufacturing parts or products with complex shapes and high precision. In the production process of CNC machining products, there are often defects in the CNC machining products produced due to certain reasons (for example, machine tool failure or severe wear of machining tools, etc.), so it is particularly important to detect defects in CNC machining products.
[0028] At present, defect detection of CNC machined products mainly relies on manual visual inspection of CNC machined products by inspectors. The detection results are easily affected by the subjective experience of inspectors, resulting in low detection accuracy of defect detection of CNC machined products. In addition, manual visual inspection leads to low detection efficiency of defect detection of CNC machined products.
[0029] In response to the above problems, the defect detection method, device, equipment and storage medium for CNC machining products provided in the embodiments of the present application obtain the current X-ray image of the current CNC machining product and input the current X-ray image into the target defect detection model to obtain the corresponding defect detection result. The target defect detection model is obtained based on the effective channel adaptive attention model and the single-step multi-frame target detection model. The effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information. The target defect detection model constructed according to the effective channel adaptive attention model and the single-step multi-frame target detection model is used to perform defect detection on the current CNC machining product, thereby improving the detection accuracy and efficiency of defect detection on CNC machining products.
[0030] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the single-step multi-frame target detection model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products.
[0031] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0032] See also Figure 1 , which shows a schematic diagram of an application scenario of the defect detection system for CNC machining products provided in an embodiment of the present application. The defect detection system for CNC machining products may include a CNC machining product 100, an X-ray machine 200 and a processing device 300. The X-ray machine 200 is connected to the processing device 300 via a network and exchanges data with the processing device 300 via the network.
[0033] Among them, the CNC machining product 100 can be any one of CNC machining components for oil and gas services, CNC machining components for semiconductor applications, CNC machining components for medical equipment applications, or CNC machining components for aerospace applications. The type of CNC machining product 100 is not limited here and can be set according to actual needs.
[0034] The X-ray machine 200 can be used to emit X-rays, and collect images of the CNC machined product 100 through X-rays to obtain X-ray images, and then send the X-ray images to the processing device 300 through the network.
[0035] The processing device 300 can be used to receive the X-ray image sent by the X-ray machine 200, and perform defect detection on the CNC machined product 100 according to the X-ray image. The processing device 300 can be a server or a terminal device, etc., which is not limited here and can be specifically configured according to actual needs.
[0036] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), big data, and artificial intelligence platforms.
[0037] The terminal device may be a mobile terminal device (for example, a vehicle-mounted terminal, a PDA (Personal Digital Assistant), a tablet computer (Tablet Personal Computer, Tablet PC), a laptop computer, etc.), or a fixed terminal device (desktop computer, smart panel, etc.), etc.
[0038] The network may be any one of a ZigBee network, a Bluetooth (BT) network, a Wireless Fidelity (Wi-Fi) network, a Thread network, a Long Range Radio (LoRa) network, a Low-Power Wide-Area Network (LPWAN), an infrared network, a Narrow Band Internet of Things (NB-IoT), a Controller Area Network (CAN), a Digital Living Network Alliance (DLNA) network, a Wide Area Network (WAN), a Local Area Network (LAN), a Metropolitan Area Network (MAN), or a Wireless Personal Area Network (WPAN), etc., without limitation here.
[0039] See also Figure 2 , which shows a flow chart of a defect detection method for a CNC machined product provided by an embodiment of the present application. In a specific embodiment, the defect detection method for a CNC machined product can be applied to Figure 1 The processing device 300 in the defect detection system of the numerical control processed product shown in FIG. Figure 2 The process shown is described in detail, and the hydraulic oil contamination detection method may include the following steps S110 to S130.
[0040] Step S110: Acquire the current X-ray image of the current CNC machined product.
[0041] In an embodiment of the present application, when an inspector needs to perform defect detection on a CNC machined product, he or she may send a detection instruction to a processing device, and the processing device receives and responds to the detection instruction to obtain a current X-ray image of the current CNC machined product.
[0042] Specifically, when the inspection personnel need to perform defect inspection on the CNC machined products, they can send the inspection instructions to the processing equipment. The processing equipment receives and responds to the inspection instructions and sends the image acquisition instructions to the X-ray machine through the network. The X-ray machine receives and responds to the image acquisition instructions, performs an X-ray scan on the current CNC machined product, obtains the current X-ray image, and sends the X-ray image to the processing equipment through the network. The processing equipment receives the current X-ray image returned by the X-ray machine.
[0043] In some embodiments, the processing device can detect the operation of the inspector. When it is determined based on the detected operation of the inspector that the inspector has input a detection instruction for performing defect detection on the current CNC machined product, the detection instruction for performing defect detection on the current CNC machined product is received.
[0044] For example, when the inspector needs to perform defect detection on the current CNC machining product, he can perform touch operations on the operation panel of the processing device. The processing device responds to the inspector's touch operation, generates a corresponding touch signal, and analyzes the touch signal. When it is determined that the touch signal is a preset detection signal for characterizing defect detection on the current CNC machining product, it is determined that a detection instruction for defect detection on the current CNC machining product has been received.
[0045] In some embodiments, the processing device may be provided with a voice recognition module. When the inspector needs to perform defect detection on the current CNC machining product, the inspector may send voice information within the voice collection range of the voice recognition module. The voice recognition module collects the voice information sent by the inspector, and performs voice recognition on the collected voice information. Based on the recognition result of the voice recognition, it is determined that the recognition result contains keywords for indicating defect detection on the current CNC machining product, such as "defect detection of CNC machining products", and for example, "CNC machining products" and "defect detection", etc., and it is determined that a detection instruction for defect detection on the current CNC machining product has been received.
[0046] As an example, the voice message sent by the inspector is: perform defect detection on the current CNC machining product, and the recognition result of the voice recognition contains the keywords "CNC machining product" and "defect detection", then it is determined that the detection instruction for performing defect detection on the current CNC machining product has been received.
[0047] In some embodiments, the defect detection system for CNC machined products may further include a client, which is connected to the processing device via a network and exchanges data with the processing device via the network.
[0048] When the inspector needs to perform defect detection on the current CNC machined product, he can send a detection instruction to the client. The client receives and responds to the detection instruction and forwards the detection instruction to the processing device through the network. The processing device receives the detection instruction forwarded by the client.
[0049] Among them, the client can be any one of a mobile client (for example, a mobile phone client, a personal digital assistant (PDA) client, a tablet computer (Tablet Personal Computer, Tablet PC) client, a laptop computer client, a smart watch client, a smart bracelet client or a wearable client, etc.) or a fixed client (for example, a desktop computer client, a smart panel client, etc.). The type of client is not limited here and can be set according to actual needs.
[0050] Step S130: input the current X-ray image into the target defect detection model to obtain the corresponding defect detection result.
[0051] In an embodiment of the present application, after obtaining the current X-ray image of the current CNC machining product, the processing device can input the current X-ray image into the target defect detection model. The target defect detection model receives and responds to the current X-ray image, performs defect detection on the current CNC machining product according to the current X-ray image, obtains the corresponding defect detection result, and outputs the defect detection result to the processing device. The processing device receives the defect detection result output by the target defect detection model. The target defect detection model can be obtained based on the effective channel adaptive attention model and the single-step multi-box target detection (Single Shot MultiBoxDetector, SSD) model. The effective channel adaptive attention model can be used to fuse different channel features of the current X-ray image, thereby realizing defect detection of the current CNC machining product according to the target defect detection model constructed according to the effective channel adaptive attention model and the SSD model, thereby improving the detection accuracy and efficiency of defect detection on CNC machining products.
[0052] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the SSD model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products.
[0053] The defect detection result may include a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information.
[0054] The current defect information may include defect type (eg, crack defect, sand hole defect or damage defect, etc.), defect location and defect size, etc., which are not limited here and can be set according to actual needs.
[0055] The effective channel adaptive attention model may include a sequentially connected convolution module, a channel shuffle module, an effective attention (ECA) module, a normalization module, and a rectified linear unit (ReLU) activation function module, such as Figure 3 shown.
[0056] The convolution module can be used to extract features from the current X-ray image to obtain an initial feature map, which may include multiple channel features, each of which may correspond to one channel. The channel shuffling module can be used to shuffle multiple channel features to obtain multiple shuffled features, each of which may correspond to one channel. The ECA module can be used to calculate the attention weight of each shuffled feature to obtain multiple attention weights. The normalization module can be used to normalize each attention weight to obtain multiple normalized weights, and calculate a normalized feature based on a shuffled feature and a normalized weight corresponding to each channel to obtain multiple normalized features, and fuse multiple normalized features to obtain a normalized feature map. The ReLU activation function module can be used to perform a rectified linear unit activation function on the normalized feature map.
[0057] The effective channel adaptive attention model can be connected between the Visual Geometry Group (VGG) module and the fully connected layer FC6 of the SSD model, such as Figure 4 shown.
[0058] In some embodiments, when the processing device obtains a second detection result, the second detection result can be input into a defect mechanism analysis model. The defect mechanism analysis model receives and responds to the second detection result, performs defect mechanism analysis on the current CNC machining product according to the second detection result, obtains the defect generation mechanism of the current CNC machining product, and outputs the defect generation mechanism to the processing device. The processing device receives the defect generation mechanism output by the defect mechanism analysis model, so that the inspection personnel can process the CNC machine tool according to the defect generation mechanism, thereby improving the user experience in the process of defect detection of CNC machining products.
[0059] Among them, the defect mechanism analysis model can be obtained by training the deep learning neural network model based on the historical X-ray images of the historical CNC machined products, and the historical X-ray images are annotated with historical defect information. The historical defect information may include defect type (for example, crack defect, sand hole defect or damage defect, etc.), defect location and defect size, etc., which are not limited here and can be set according to actual needs.
[0060] The deep learning neural network model can be a Convolutional Neural Networks (CNN) model, a Deep Belief Networks (DBN) model, a Stacked Auto Encoder Networks (SAE) model, a Recurrent Neural Networks (RNN) model, a Deep Neural Networks (DNN) model, a Long Short-Term Memory (LSTM) network model or a Gated Recurring Units (GRU) model, etc. The type of deep learning neural network model is not limited here and can be set according to actual needs.
[0061] The solution provided in this embodiment obtains the current X-ray image of the current CNC machined product and inputs the current X-ray image into the target defect detection model to obtain the corresponding defect detection result. The target defect detection model is obtained based on the effective channel adaptive attention model and the SSD model. The effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information. The target defect detection model constructed according to the effective channel adaptive attention model and the SSD model is used to perform defect detection on the current CNC machined product, thereby improving the detection accuracy and efficiency of defect detection on CNC machined products.
[0062] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the SSD model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products.
[0063] See also Figure 5 , which shows a flow chart of a defect detection method for a CNC machined product provided by another embodiment of the present application. In a specific embodiment, the defect detection method for a CNC machined product can be applied to Figure 1 The processing device 300 in the defect detection system of the numerical control processed product shown in FIG. Figure 5 The process shown is described in detail, and the defect detection method of CNC machined products may include the following steps S210 to S290.
[0064] Step S210: Construct an effective channel adaptive attention model.
[0065] In this embodiment, the processing device can fuse the convolution module, the channel shuffle module, the ECA module, the normalization module and the ReLU activation function module, so that the convolution module, the channel shuffle module, the ECA module, the normalization module and the ReLU activation function module are connected in sequence to obtain an effective channel adaptive attention model.
[0066] Step S230: Fuse the effective channel adaptive attention model, the visual geometry group module of the single-step multi-frame target detection model, and the fully connected layer FC6 to obtain an initial defect detection model.
[0067] In this embodiment, after the processing device constructs the effective channel adaptive attention model, it can fuse the effective channel adaptive attention model, the VGG module of the SSD model, and the fully connected layer FC6, so that the effective channel adaptive attention model is connected between the VGG module and the fully connected layer FC6 to obtain the initial defect detection model.
[0068] Step S250: training the initial defect detection model to obtain a target defect detection model.
[0069] In this embodiment, after the processing device fuses the effective channel adaptive attention model, the VGG module of the SSD model, and the fully connected layer FC6 to obtain the initial defect detection model, the initial defect detection model can be trained to obtain the target defect detection model.
[0070] In some embodiments, the processing device can obtain historical X-ray images of historical CNC machined products, and based on the historical X-ray images, obtain a sample set, which may include an initial training set and an initial test set, and input the initial training set into the initial defect detection model for training. The initial defect detection model receives and responds to the initial training set, and is trained based on the initial training set to obtain a target defect detection model.
[0071] Among them, the processing equipment can annotate historical defect information on historical X-ray images, obtain corresponding annotated images, and divide the annotated images according to preset division rules to obtain corresponding initial training sets and initial test sets.
[0072] When the processing device annotates the historical X-ray images, it mainly annotates the defect type, defect location, defect size, etc. in the historical X-ray images. For example, the processing device annotates the defect type in the historical X-ray images with an annotation box, annotates the corner point coordinates of the annotation box, and annotates the size of the annotation box.
[0073] The preset division rule is an artificial division rule. For example, the preset division rule may be an artificial division rule of initial training set: initial test set = 9:1. When the number of historical X-ray images is 20,000, the initial training set is 18,000 and the initial test set is 2,000. The preset division rule may be an artificial division rule of initial training set: initial test set = 8:1. When the number of historical X-ray images is 27,000, the initial training set is 24,000 and the initial test set is 3,000. The division method of the preset division rule is not limited here and can be set according to actual needs.
[0074] In some embodiments, a processing device can obtain historical X-ray images of historical CNC machined products, and based on the historical X-ray images, obtain a sample set, where the sample set may include an initial training set and an initial test set, and perform data enhancement processing on the initial training set to obtain an enhanced training set, and input the enhanced training set into an initial defect detection model for training. The initial defect detection model receives and responds to the enhanced training set, and is trained based on the enhanced training set to obtain a target defect detection model, thereby realizing the training of the initial defect detection model based on the enhanced training set, avoiding the low robustness of the target defect detection model obtained by training the initial defect detection model with a smaller initial training set due to less historical X-ray image data, and increasing the robustness of the target defect detection model.
[0075] Among them, data enhancement processing may include at least any one of brightness enhancement processing, grayscale enhancement processing, contrast enhancement processing, and transparency enhancement processing. The type of data enhancement processing is not limited here and can be set according to actual needs.
[0076] In some embodiments, the processing device inputs an initial training set into an initial defect detection model for training. After obtaining a target defect detection model, it can determine whether the target defect detection model converges based on an initial test set.
[0077] Among them, the processing device can input the initial test set into the target defect detection model, the target defect detection model receives and responds to the initial test set, performs testing according to the initial test set, obtains corresponding test results, and determines the test accuracy corresponding to the test results based on the test results and the initial test set, and determines whether the target defect detection model converges based on the test accuracy.
[0078] When the test accuracy is greater than or equal to the preset accuracy threshold, it is determined that the target defect detection model has converged; when the test accuracy is less than the preset accuracy threshold, it is determined that the target defect detection model has not converged.
[0079] The preset accuracy threshold can be used to characterize the minimum accuracy corresponding to the convergence of the target defect detection model. The preset accuracy threshold can be the accuracy pre-set by the inspection personnel, or it can be the accuracy automatically generated by the processing equipment according to the inspection process of multiple defect detections on CNC machined products. The setting method of the preset accuracy threshold is not limited here, and it can be set according to actual needs.
[0080] Step S270: Acquire the current X-ray image of the current CNC machined product.
[0081] In this embodiment, step S270 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be described in detail here.
[0082] In some embodiments, when the processing device determines that the target defect detection model converges based on the initial test set, the current X-ray image of the current CNC machined product can be obtained. When the target defect detection model converges, the stability of the target defect detection model is relatively high, which is beneficial to improving the detection reliability of defect detection of CNC machined products based on the target defect detection model.
[0083] Step S290: input the current X-ray image into the target defect detection model to obtain the corresponding defect detection result.
[0084] In this embodiment, step S290 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be described in detail here.
[0085] The solution provided in this embodiment constructs an effective channel adaptive attention model, and integrates the effective channel adaptive attention model, the VGG module of the SSD model and the fully connected layer FC6 to obtain an initial defect detection model, and trains the initial defect detection model to obtain a target defect detection model, and obtains the current X-ray image of the current CNC machining product, and inputs the current X-ray image to the target defect detection model to obtain the corresponding defect detection result, thereby realizing defect detection of the current CNC machining product according to the target defect detection model constructed by the effective channel adaptive attention model and the SSD model, thereby improving the detection accuracy and efficiency of defect detection of CNC machining products.
[0086] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the SSD model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products.
[0087] See also Figure 6 , which shows a defect detection device 500 for a CNC machined product provided by an embodiment of the present application. The defect detection device 500 for a CNC machined product can be applied to Figure 1 The processing device 300 in the defect detection system of the numerical control processed product shown in FIG. Figure 6 The defect detection device 500 for CNC machined products shown in the figure is described in detail. The defect detection device 500 for CNC machined products may include an image acquisition module 510 and an image input module 530 .
[0088] The image acquisition module 510 can be used to acquire the current X-ray image of the current CNC machined product; the image input module 530 can be used to input the current X-ray image into the target defect detection model to obtain the corresponding defect detection result. The target defect detection model can be obtained based on the effective channel adaptive attention model and the single-step multi-frame target detection model. The effective channel adaptive attention model can be used to fuse the different channel features of the current X-ray image. The defect detection result may include a first detection result for characterizing that the current X-ray image does not contain the current defect information, and a second detection result for characterizing that the current X-ray image contains the current defect information.
[0089] In some embodiments, the defect detection device 500 for CNC machined products may further include a construction module, a fusion module, and a training module.
[0090] The construction module can be used to construct an effective channel adaptive attention model before the image acquisition module 510 acquires the current X-ray image of the current CNC machined product; the fusion module can be used to fuse the effective channel adaptive attention model, the visual geometry group module of the single-step multi-frame target detection model and the fully connected layer FC6 to obtain an initial defect detection model; the training module can be used to train the initial defect detection model to obtain a target defect detection model.
[0091] In some embodiments, a building block can include a fusion unit.
[0092] The fusion unit can be used to fuse the convolution module, channel shuffle module, effective attention module, normalization module and rectified linear unit activation function module to obtain an effective channel adaptive attention model.
[0093] The convolution module can be used to extract features from the current X-ray image to obtain an initial feature map, which may include multiple channel features, each of which may correspond to one channel. The channel shuffling module can be used to shuffle multiple channel features to obtain multiple shuffled features, each of which may correspond to one channel. The effective attention module can be used to calculate the attention weight of each shuffled feature to obtain multiple attention weights. The normalization module can be used to normalize each attention weight to obtain multiple normalized weights, and calculate a normalized feature based on a shuffled feature and a normalized weight corresponding to each channel to obtain multiple normalized features, and fuse multiple normalized features to obtain a normalized feature map. The rectified linear unit activation function module can be used to perform rectified linear unit activation function processing on the normalized feature map.
[0094] In some implementations, the training module may include a first acquisition unit, a second acquisition unit, and an input unit.
[0095] The first acquisition unit can be used to acquire historical X-ray images of historical CNC machined products, and the historical X-ray images can contain historical defect information; the second acquisition unit can be used to acquire a sample set based on the historical X-ray images, and the sample set can include at least an initial training set; the input unit can be used to input the initial training set into the initial defect detection model for training to obtain a target defect detection model.
[0096] In some embodiments, the defect detection device 500 for CNC machined products may further include a processing module.
[0097] The processing module can be used for the input unit to input the initial training set to the initial defect detection model for training, and before obtaining the target defect detection model, the initial training set is subjected to data enhancement processing to obtain an enhanced training set.
[0098] In some embodiments, the input unit may include an input sub-unit.
[0099] The input subunit can be used to input the enhanced training set into the initial defect detection model for training to obtain the target defect detection model.
[0100] In some implementations, the sample set may further include an initial test set, and the defect detection device 500 for CNC machined products may further include a determination module.
[0101] The determination module can be used to determine whether the target defect detection model converges according to the initial test set before the image acquisition module 510 acquires the current X-ray image of the current CNC machined product.
[0102] In some implementations, the image acquisition module 510 may include a third acquisition unit.
[0103] The third acquisition unit can be used to acquire the current X-ray image of the current CNC machined product when it is determined that the target defect detection model converges according to the initial test set.
[0104] In some embodiments, the defect detection device 500 for CNC machined products may further include a result input module.
[0105] The result input module can be used to input the second detection result into the defect mechanism analysis model when the second detection result is obtained, so as to obtain the defect generation mechanism of the current CNC machining product. The defect mechanism analysis model can be obtained by training a deep learning neural network model based on historical X-ray images of historical CNC machining products. The historical X-ray images can be annotated with historical defect information.
[0106] The solution provided in this embodiment obtains the current X-ray image of the current CNC machined product and inputs the current X-ray image into the target defect detection model to obtain the corresponding defect detection result. The target defect detection model is obtained based on the effective channel adaptive attention model and the single-step multi-frame target detection model. The effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information. The target defect detection model constructed according to the effective channel adaptive attention model and the single-step multi-frame target detection model is used to perform defect detection on the current CNC machined product, thereby improving the detection accuracy and efficiency of defect detection on CNC machined products.
[0107] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the single-step multi-frame target detection model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products.
[0108] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Any processing method described in the method embodiment can be implemented by the corresponding processing module in the device embodiment, and will not be repeated one by one in the device embodiment.
[0109] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0110] See also Figure 7 , which shows a functional block diagram of an electronic device 600 provided by an embodiment of the present application, and the electronic device 600 may include one or more of the following components: a memory 610, a processor 620, and one or more applications, wherein the one or more applications may be stored in the memory 610 and configured to be executed by the one or more processors 620, and the one or more applications are configured to execute the method described in the aforementioned method embodiment.
[0111] The memory 610 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). The memory 610 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 610 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system and instructions for implementing at least one function (such as obtaining a current X-ray image, inputting a current X-ray image, obtaining defect detection results, obtaining a target defect detection model, fusing channel features, constructing an effective channel adaptive attention model, fusing an effective channel adaptive attention model and a single-step multi-frame target detection model, obtaining an initial defect detection model, training an initial defect detection model, fusing a convolution module, a channel shuffling module, an effective attention module, a normalization module and a rectified linear unit activation function module, obtaining an effective channel adaptive attention model, extracting features, obtaining an initial feature map, shuffling operations, obtaining to multiple shuffled features, calculate attention weights, obtain multiple attention weights, normalize, obtain multiple normalized weights, calculate normalized features, obtain multiple normalized features, fuse multiple normalized features, normalize feature maps, correct linear unit activation function processing, obtain historical X-ray images, obtain sample sets, input initial training sets, data enhancement processing, obtain enhanced training sets, input enhanced training sets, determine whether the target defect detection model converges, determine whether the target defect detection model converges, obtain a second detection result, input a second detection result, obtain a defect generation mechanism, train a deep learning neural network model, obtain a defect mechanism analysis model and annotate historical defect information, etc.), instructions for implementing the following various method embodiments, etc. The storage data area can also store data created by the electronic device 600 during use (such as current CNC machining products, current X-ray images, target defect detection models, defect detection results, effective channel adaptive attention models, single-step multi-frame target detection models, current defect information, first detection results, second detection results, visual geometry group modules, fully connected layer FC6, initial defect detection models, convolution modules, channel shuffling modules, effective attention modules, normalization modules, rectified linear unit activation function modules, initial feature maps, multiple channel features, multiple shuffled features, multiple attention weights, multiple normalized weights, multiple normalized features, normalized feature maps, historical CNC machining products, historical X-ray images, historical defect information, sample sets, initial training sets, enhanced training sets, initial test sets, defect mechanism analysis models, defect generation mechanisms, and deep learning neural network models), etc.
[0112] The processor 620 may include one or more processing cores. The processor 620 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes various functions and processes data of the electronic device 600 by running or executing instructions, programs, code sets or instruction sets stored in the memory 610, and calling data stored in the memory 610. Optionally, the processor 620 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), programmable logic array (PLA), etc. The processor 620 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 620, but may be implemented separately through a communication chip.
[0113] Please refer to Figure 8 , which shows a block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable storage medium 700 stores a program code 710, which can be called by a processor to execute the method described in the above method embodiment.
[0114] The computer readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 710 that performs any method step in the above method. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.
[0115] Please refer to Fig. 9, which shows a structural block diagram of a computer program product 800 provided in an embodiment of the present application. The computer program product 800 includes a computer program / instruction 810, and the computer program / instruction 810 is stored in a computer-readable storage medium of a computer device. When the computer program product 800 is run on a computer device, a processor of the computer device reads the computer program / instruction 810 from the computer-readable storage medium, and the processor executes the computer program / instruction 810, so that the computer device performs the method described in the above method embodiment.
[0116] The solution provided in this embodiment obtains the current X-ray image of the current CNC machined product and inputs the current X-ray image into the target defect detection model to obtain the corresponding defect detection result. The target defect detection model is obtained based on the effective channel adaptive attention model and the single-step multi-frame target detection model. The effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information. The target defect detection model constructed according to the effective channel adaptive attention model and the single-step multi-frame target detection model is used to perform defect detection on the current CNC machined product, thereby improving the detection accuracy and efficiency of defect detection on CNC machined products.
[0117] Furthermore, the effective channel adaptive attention model is used to fuse the different channel features of the current X-ray image, and a target defect detection model is constructed based on the effective channel adaptive attention model and the single-step multi-frame target detection model, which improves the learning ability of the target defect detection model to learn features of different depths and the ability of the target defect detection model to extract features of small target defects, making small target defects easier to detect, which is beneficial to improving the detection accuracy of defect detection of CNC machining products.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A defect detection method for CNC machined products, It is characterized in that include: Get the current X-ray image of the current CNC machined product; The current X-ray image is input into a target defect detection model to obtain a corresponding defect detection result. The target defect detection model is obtained based on an effective channel adaptive attention model and a single-step multi-frame target detection model. The effective channel adaptive attention model is used to fuse different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information.
2. The defect detection method according to claim 1, It is characterized in that Before obtaining the current X-ray image of the current CNC machined product, the defect detection method further includes: Constructing the effective channel adaptive attention model; The effective channel adaptive attention model, the visual geometry group module of the single-step multi-box target detection model and the fully connected layer FC6 are integrated to obtain an initial defect detection model; The initial defect detection model is trained to obtain the target defect detection model.
3. The defect detection method according to claim 2, It is characterized in that The constructing of the effective channel adaptive attention model comprises: The effective channel adaptive attention model is obtained by fusing the convolution module, the channel shuffling module, the effective attention module, the normalization module and the rectified linear unit activation function module; The convolution module is used to extract features from the current X-ray image to obtain an initial feature map, which includes multiple channel features, each of which corresponds to a channel; the channel shuffling module is used to perform shuffling operations on the multiple channel features to obtain multiple shuffled features, each of which corresponds to the one channel; the effective attention module is used to calculate the attention weight of each shuffled feature to obtain multiple attention weights; the normalization module is used to normalize each attention weight to obtain multiple normalized weights, and calculate a normalized feature based on a shuffled feature and a normalized weight corresponding to each channel to obtain multiple normalized features, and fuse the multiple normalized features to obtain a normalized feature map; the corrected linear unit activation function module is used to perform corrected linear unit activation function processing on the normalized feature map.
4. The defect detection method according to claim 2, It is characterized in that The training of the initial defect detection model to obtain the target defect detection model includes: Acquire historical X-ray images of historical CNC machined products, wherein the historical X-ray images contain historical defect information; Acquire a sample set according to the historical X-ray images, wherein the sample set at least includes an initial training set; The initial training set is input into the initial defect detection model for training to obtain the target defect detection model.
5. The defect detection method according to claim 4, It is characterized in that Before inputting the initial training set into the initial defect detection model for training to obtain the target defect detection model, the defect detection method further includes: Performing data enhancement processing on the initial training set to obtain an enhanced training set; The inputting the initial training set into the initial defect detection model for training to obtain the target defect detection model includes: The enhanced training set is input into the initial defect detection model for training to obtain the target defect detection model.
6. The defect detection method according to claim 4, It is characterized in that The sample set also includes an initial test set. Before acquiring the current X-ray image of the current CNC machined product, the defect detection method further includes: Determining whether the target defect detection model converges according to the initial test set; The inputting the current X-ray image into the target defect detection model to obtain the corresponding defect detection result includes: When it is determined according to the initial test set that the target defect detection model converges, a current X-ray image of the current CNC machined product is acquired.
7. The defect detection method according to any one of claims 1 to 6, It is characterized in that Also includes: When the second detection result is obtained, the second detection result is input into the defect mechanism analysis model to obtain the defect generation mechanism of the current CNC machining product. The defect mechanism analysis model is obtained by training a deep learning neural network model based on historical X-ray images of historical CNC machining products, and the historical X-ray images are annotated with historical defect information.
8. A defect detection device for CNC machined products, It is characterized in that include: An image acquisition module is used to acquire the current X-ray image of the current CNC machined product; An image input module is used to input the current X-ray image into a target defect detection model to obtain a corresponding defect detection result. The target defect detection model is obtained based on an effective channel adaptive attention model and a single-step multi-frame target detection model. The effective channel adaptive attention model is used to fuse different channel features of the current X-ray image. The defect detection result includes a first detection result used to characterize that the current X-ray image does not contain the current defect information, and a second detection result used to characterize that the current X-ray image contains the current defect information.
9. An electronic device, It is characterized in that include: Memory; One or more processors, coupled to the memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by one or more processors, and the one or more application programs are configured to execute the defect detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the defect detection method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Sheep face detection and recognition method based on lightweight model
CN114550212A
Concrete apparent crack image identification method based on strairnet network
CN115908393A
Insulator defect identification method based on improved SSD algorithm
CN116188402A
Concrete crack lightweight detection model and detection method
CN117036291A
Road surface defect detection method and system based on deep learning
CN117274688A
