A method for detecting defects of indexable inserts, electronic equipment, and medium
Through an unsupervised method, only the normal samples of indexable blades are trained, combined with the teacher encoder and student decoder, an indexable blade defect detection model is built, which solves the problems of low efficiency and low generalization in the existing technology, and achieves efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510128358.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-02-05
AI Technical Summary
The prior art is inefficient, has low generalization in the detection of indexable blade defects, and requires a large amount of sample annotation and resource consumption.
An unsupervised method is adopted, and only the normal samples of indexable blades are used for training. Through the combination of teacher encoder and student decoder, the feature compression module and feature reconstruction module are used to build an indexable blade defect detection model.
It reduces the work of sample collection and labeling, reduces labor costs and data processing difficulty, can detect known and unknown defects, improves the accuracy and generalization ability of detection, and improves the efficiency of blade defect detection.
Smart Images

Figure CN119559182B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine vision, and in particular relates to a method, electronic equipment and medium for detecting defects of indexable inserts. Background Art
[0002] As the core component of industrial machine tools, CNC tools play a key role in processing quality. Therefore, it is of great significance to test tools. As an essential component of large tools, the health test of indexable inserts has also become an important part of the safe and smooth progress of the entire production process.
[0003] During the production of indexable inserts, due to process conditions and improper transportation during the production process, various defects may occur on the inserts, such as burrs, cracks, notches, coating peeling, etc. These defects will greatly damage the appearance integrity of the inserts and reduce the service life of the inserts. For example, the edge notch defect of the insert may cause unevenness on the surface to be processed, thereby affecting the surface roughness and consistency of the product; another example is the coating peeling defect, which may seriously affect the mechanical properties of the insert and cause "cutting collapse" during the processing process.
[0004] The development process of defect detection of indexable inserts can be divided into three stages: manual detection, machine vision, and artificial intelligence, which is currently the focus of research. In the manual detection stage, the surface defect detection of the insert is mainly completed by the naked eye. This detection method is inefficient, low in accuracy, and labor-intensive, and cannot meet the needs of modern large-scale, high-quality production. At the same time, since the surface defects of the insert must be found quickly and accurately under the irradiation of a strong light source, it will cause eye fatigue and even eye diseases for workers. The blade detection method based on machine vision takes the blade as the direct detection object and judges the state of the blade by analyzing the image of the blade. This detection method can not only unify the standards, but also reduce the requirements for the operator's processing experience, greatly improving the processing efficiency. However, since it requires professional engineers to give parameters, different types of blades and different environments will affect its detection effect, and the overall generalization is not high. Detection based on artificial intelligence methods is currently a key research area. The key lies in using a deep neural network structure to automatically learn and extract the features of the input data, solving the complexity and uncertainty of manual feature extraction in traditional machine vision, thereby improving the automation process and effectively improving the detection efficiency. However, blade defect detection based on artificial intelligence is still mainly based on supervised methods. Although it can effectively detect defects, the method of obtaining the model is relatively complicated. On the one hand, it is necessary to collect a large number of indexable blade images, including normal samples and defective samples; on the other hand, the collected samples need to be labeled. These two processes take a lot of time and cannot guarantee that the model can detect defects that have not appeared. Therefore, in practical applications, it consumes more resources and the detection effect is not ideal. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a method, electronic equipment and medium for detecting defects of indexable inserts.
[0006] In a first aspect, an embodiment of the present invention provides a method for detecting defects of an indexable insert, the method comprising:
[0007] Obtain normal samples of indexable inserts and defective samples of indexable inserts;
[0008] Construct an indexable insert defect detection model, and train the indexable insert defect detection model with normal samples of the indexable insert as a training set; in the process of the kth round of training of the indexable insert defect detection model, the following steps are included: inputting the normal samples of the indexable insert into the teacher encoder through the input layer for encoding, obtaining the first feature vector and the second feature vector through the feature compression module, inputting the first feature vector into the first student decoder, and inputting the second feature vector into the second student decoder; calculating the first similarity between the i-th teacher encoding vector and the i-th vector of the first student decoder, and calculating the second similarity between the i-th teacher encoding vector and the i-th vector of the second student decoder; constructing a loss function based on the first similarity and the second similarity, and training the indexable insert defect detection model through the loss function and the stochastic gradient descent method;
[0009] Input the indexable insert defect samples into the indexable insert defect detection model obtained in each round of training to select the optimal indexable insert defect detection model;
[0010] The image of the indexable insert to be inspected is obtained and input into the optimal indexable insert defect detection model to determine whether there is a defect.
[0011] In a second aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-mentioned indexable insert defect detection method.
[0012] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-mentioned indexable insert defect detection method.
[0013] In a fourth aspect, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which implements the above-mentioned indexable insert defect detection method when executed by a processor.
[0014] Compared with the prior art, the present invention has the following beneficial effects:
[0015] The present invention provides an unsupervised indexable insert defect detection method, which only includes normal samples of indexable inserts in the training stage, reduces the collection and labeling of large-scale samples, reduces labor costs and data processing difficulty, and avoids the problem of difficulty in obtaining defective samples in traditional supervised methods. The method of the present invention can not only detect known defects, but also identify unknown defects, improves the accuracy and generalization ability of detection, thereby effectively improving the efficiency of blade defect detection.
[0016] At the same time, the method of the present invention processes the output of the teacher encoder through a feature compression module to obtain a first feature vector and a second feature vector, and inputs the first feature vector and the second feature vector to a first student decoder and a second student decoder respectively, so that the first student decoder focuses on the underlying texture information of the teacher encoder, especially for defects such as breakage and scratches of the indexable insert; the second student decoder focuses on the high-level semantic information of the teacher encoder, especially for defects such as high-temperature oxidation of the indexable insert, thereby improving the accuracy of the indexable insert defect detection model. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0018] Figure 1 A schematic diagram of a defect detection method for indexable inserts provided by an embodiment of the present invention;
[0019] Figure 2 A schematic diagram of an indexable insert defect detection model provided by an embodiment of the present invention;
[0020] Figure 3 An example diagram of defects of an indexable insert provided by an embodiment of the present invention;
[0021] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] It should be noted that, in the absence of conflict, the features in the following embodiments and implementations may be combined with each other.
[0024] like Figure 1 As shown, an embodiment of the present invention provides a method for detecting defects of indexable inserts, the method comprising the following steps:
[0025] Step S1, obtaining normal samples of indexable inserts and defective samples of indexable inserts.
[0026] Specifically, in this example, hundreds of normal samples of indexable inserts and dozens of defective samples of indexable inserts with different defect types are collected by an industrial camera.
[0027] Among them, the defect samples of indexable inserts with different defect types should include as many common defect types as possible, such as burrs, cracks, notches, stains, etc., to verify that the defect detection model of the indexable insert can also perform defect detection on unknown defects, thereby ensuring the robustness of the defect detection model of the indexable insert.
[0028] Furthermore, the normal samples of indexable inserts are converted into two-dimensional vectors with a length and width of m×m, and the number of normal samples of indexable inserts is n1. The defective samples of indexable inserts are labeled using the Labelme tool to label the actual defect size, type and location, and generate a label map of the same size as the defective sample image of the indexable insert. The generated label dimension is m×m, and the number of labels corresponds to the number of defective samples of the indexable insert, a total of n2.
[0029] Step S2, constructing an indexable blade defect detection model, and training the indexable blade defect detection model with normal samples of indexable blades as training sets; wherein, the k-th round training process of the indexable blade defect detection model includes: the normal samples of the indexable blades are input to the teacher encoder through the input layer for encoding, and the first feature vector and the second feature vector are obtained through the feature compression module, and the first feature vector is input to the first student decoder, and the second feature vector is input to the second student decoder; the first similarity between the i-th teacher encoding vector and the i-th vector of the first student decoder is calculated, and the second similarity between the i-th teacher encoding vector and the i-th vector of the second student decoder is calculated; the loss function is constructed based on the first similarity and the second similarity, and the indexable blade defect detection model is trained by the loss function and the stochastic gradient descent method. Set the total training rounds to K, k∈K, and the training is completed when the total training rounds are reached or the loss function converges.
[0030] Furthermore, if Figure 2 As shown, the defect detection model of the indexable insert provided by the present invention includes: an input layer, a teacher encoder, a feature compression module, a first student decoder, a second student decoder and an output layer. Specifically, it includes:
[0031] n1 normal samples of indexable inserts are input to the input layer;
[0032] In this example, the ResNet model is selected as the teacher encoder, and the teacher encoder includes 3 submodules, each of which consists of a convolutional layer and a residual structure. The input of the first submodule in the teacher encoder is a normal sample of the indexable blade, and the output is the first teacher encoding vector t1; the input of the second submodule is the output result of the first submodule, that is, the first teacher encoding vector t1, and the output is the second teacher encoding vector t2; the input of the third submodule is the output result of the second submodule, that is, the second teacher encoding vector t2, and the output is the third teacher encoding vector t3.
[0033] The encoding vector output by the teacher encoder is processed by the feature compression module to obtain the first feature vector t l , the second eigenvector t h ; Including: convolving the first teacher coding vector t1 and the second teacher coding vector t2, so that the feature dimensions of the first teacher coding vector t1 and the second teacher coding vector t2 are the same as the third teacher coding vector t3; splicing the first teacher coding vector t1 and the second teacher coding vector t2 to obtain the intermediate coding vector t 12 ; Through the convolutional layer and residual structure, the intermediate encoding vector t 12 , and the third teacher coding vector t3 are compressed by dimensionality reduction to obtain the first eigenvector t l , the second eigenvector t h .
[0034] In this example, the ResNet model is selected as the first student decoder. The first student decoder includes three submodules, each of which includes a convolutional layer, a residual structure, and a feature reconstruction module. The input of the first submodule in the first student decoder is the first feature vector t l , output the third vector s of the first student decoder l3 ; The input of the second submodule is the output of the first submodule, that is, the third vector s of the first student decoder l3 , the output is the second vector s of the first student decoder l2 ; The input of the third submodule is the output of the second submodule, i.e., the second vector s of the first student decoder l2 , the output is the first vector s of the first student decoder l1 .
[0035] It should be noted that the first student decoder uses reverse input to make the input sources of the student and teacher models different, reducing the student model's ability to learn and generalize the defect information of the indexable insert. At the same time, in the feature reconstruction module, the feature vector is used as input, and a new feature vector is obtained through random masking, and the feature is restored through the convolution layer to achieve the purpose of feature reconstruction. Adding a feature reconstruction module further expands the difference between the student decoder and the teacher encoder, reducing the information flow similarity problem of the symmetric model. Mask recovery improves the robustness and anti-interference ability of the student decoder during the training process.
[0036] In this example, the ResNet model is selected as the second student decoder. The second student decoder includes three submodules, each of which includes a convolutional layer, a residual structure, and a feature reconstruction module. The input of the first submodule in the second student decoder is the second feature vector t h , output the third vector s of the second student decoder h3 ; The input of the second submodule is the output of the first submodule, that is, the third vector s of the second student decoder h3 , the output is the second vector s of the second student decoder h2 ; The input of the third submodule is the output of the second submodule, i.e., the second vector s of the second student decoder h2 , the output is the first vector s of the second student decoder h1 .
[0037] The output layer calculates the first similarity between the i-th teacher encoding vector and the i-th vector of the first student decoder, and calculates the second similarity between the i-th teacher encoding vector and the i-th vector of the second student decoder; concatenates all the first similarities to obtain the first feature anomaly map, and concatenates all the second similarities to obtain the second feature anomaly map; based on the first feature anomaly map and the second feature anomaly map, the anomaly map output by the indexable insert defect detection model is obtained; the expression is as follows:
[0038]
[0039]
[0040] Where, t i is the i-th teacher encoding vector output by the i-th submodule in the teacher encoder, s li is the i-th vector of the first student decoder output by the i-th submodule in the first student decoder, s hi is the second student decoder i-th vector output by the i-th submodule in the second student decoder, t ij is the jth feature of the i-th teacher encoding vector output by the i-th submodule of the teacher encoder, s lijis the jth feature of the i-th vector of the first student decoder output by the i-th submodule in the first student decoder, s hij is the j-th feature of the i-th vector of the second student decoder output by the i-th submodule in the second student decoder, where n is the vector dimension, j∈n.
[0041] Concatenate all the first similarities to obtain the first characteristic anomaly map M l ; Splice all the second similarities to obtain the second feature anomaly map M h Based on the first characteristic anomaly map M l 、The second characteristic abnormal map M h The abnormal graph output by the indexable insert defect detection model is obtained, and the expression is as follows:
[0042]
[0043] It should be noted that the larger the first similarity, the more similar the i-th teacher encoding vector is to the i-th student decoder vector, and the smaller the first similarity, the less similar the i-th teacher encoding vector is to the i-th student decoder vector, and the same is true for the second similarity. The abnormal map output by the indexable insert defect detection model is calculated by the above formula, so that the dissimilar area value is higher, and the higher the value, the more obvious the abnormal area.
[0044] Furthermore, a loss function is constructed based on the first similarity and the second similarity. The expression of the loss function is as follows:
[0045]
[0046] In the formula, is the first similarity between the i-th teacher encoding vector and the i-th student decoder vector, is the second similarity between the i-th teacher encoding vector and the i-th student decoder vector.
[0047] It should be noted that the calculation result of the first similarity indicates that the first student decoder learns the underlying texture information of the teacher encoder, especially for defects such as breakage and scratches of indexable inserts. The calculation result of the second similarity indicates that the second student decoder learns the high-level semantic information of the teacher encoder, especially for defects such as high-temperature oxidation of indexable inserts. The indexable insert defect detection model is trained by minimizing the loss function to encourage the student decoder to learn the teacher encoder as much as possible.
[0048] Furthermore, the defect detection model of the indexable insert is updated by the stochastic gradient descent method, and the expression is as follows:
[0049]
[0050]
[0051] Where z is any parameter in the defect detection model of indexable inserts, α represents the learning rate; g z Represents the gradient of the current parameter z.
[0052] Step S3, inputting the indexable insert defect samples into the indexable insert defect detection model obtained in each round of training, and screening out the optimal indexable insert defect detection model.
[0053] Specifically, for each indexable insert defect sample in the test set, the indexable insert defect detection model should be able to accurately detect and locate its defects. The AUROC (Area Under the ROC Curve) corresponding to the indexable insert defect detection model obtained in each round of training is calculated, AUROC∈[0,1]. By evaluating the performance of the indexable insert defect detection model on unseen defect samples, the indexable insert defect detection model with the largest AUROC value is selected as the optimal indexable insert defect detection model.
[0054] Step S4, obtaining an image of the indexable insert to be inspected and inputting it into an optimal indexable insert defect detection model to determine whether there is a defect.
[0055] Specifically, the indexable insert is inspected using the optimal indexable insert defect detection model, and the abnormal image output by the optimal indexable insert defect detection model is used for judgment. If there is no abnormal area in the abnormal image, it means that the indexable insert is normal. If there is an abnormal area in the abnormal image, the abnormal pixel area is an abnormality of the indexable insert, and the abnormal insert needs to be removed from the production line. Figure 3 As shown, Figure 3 (A) is an actual image of an indexable insert with a notch. Figure 3 (B) is a heat map output by model prediction, where the redder the area, the greater the probability of defects. Figure 3 (C) is a binary image of the actual defect area of the indexable insert with a notch.
[0056] In summary, the present invention provides an unsupervised indexable blade defect detection method, which only includes normal samples of indexable blades in the training stage, reduces the collection and labeling of large-scale samples, reduces labor costs and data processing difficulties, and avoids the problem of difficulty in obtaining defect samples in traditional supervised methods. The method of the present invention can not only detect known defects, but also identify unknown defects, improve the accuracy and generalization ability of detection, thereby effectively improving the efficiency of blade defect detection. At the same time, the method of the present invention processes the output of the teacher encoder through a feature compression module to obtain a first feature vector and a second feature vector, and inputs the first feature vector and the second feature vector to the first student decoder and the second student decoder respectively, so that the first student decoder pays attention to the underlying texture information of the teacher encoder, especially for defects such as breakage and scratches of the indexable blade; the second student decoder pays attention to the high-level semantic information of the teacher encoder, especially for defects such as high-temperature oxidation of the indexable blade, thereby improving the accuracy of the indexable blade defect detection model.
[0057] According to an embodiment of the present invention, the present invention also provides an electronic device and a readable storage medium.
[0058] Figure 4 A schematic block diagram of an electronic device that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0059] The electronic device includes a computing unit 101, which can perform various appropriate actions and processes according to a computer program stored in a ROM 102 or a computer program loaded from a storage unit 108 into a RAM 103. In the RAM 103, various programs and data required for the operation of the electronic device can also be stored. The computing unit 101, the ROM 102, and the RAM 103 are connected to each other via a bus 104. An I / O interface 105 is also connected to the bus 104.
[0060] A number of components in the electronic device are connected to the I / O interface 105, including: an input unit 106, such as a keyboard, a mouse, etc.; an output unit 107, such as various types of displays, speakers, etc.; a storage unit 108, such as a disk, an optical disk, etc.; and a communication unit 109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 109 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0061] The computing unit 101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 101 performs the various methods and processes described above. For example, in some embodiments, the method in the multidimensional early warning system for pressure injuries may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 108. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via ROM 102 and / or a communication unit 109. When the computer program is loaded into RAM 103 and executed by the computing unit 101, one or more steps of the method in the multidimensional early warning system for pressure injuries described above may be executed. Alternatively, in other embodiments, the computing unit 101 may be configured to execute the method in the multidimensional early warning system for pressure injuries in any other appropriate manner (e.g., by means of firmware).
[0062] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0063] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0064] In the context of the present invention, a readable storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A readable storage medium may be a machine-readable signal medium or a machine-readable storage medium. A readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0065] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0066] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0067] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0068] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
[0069] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for detecting defects of indexable inserts, characterized in that: The method comprises: Obtain normal samples of indexable inserts and defective samples of indexable inserts; Construct an indexable insert defect detection model, and train the indexable insert defect detection model with normal samples of the indexable insert as a training set; in the process of the kth round of training of the indexable insert defect detection model, the following steps are included: inputting the normal samples of the indexable insert into the teacher encoder through the input layer for encoding, obtaining the first feature vector and the second feature vector through the feature compression module, inputting the first feature vector into the first student decoder, and inputting the second feature vector into the second student decoder; calculating the first similarity between the i-th teacher encoding vector and the i-th vector of the first student decoder, and calculating the second similarity between the i-th teacher encoding vector and the i-th vector of the second student decoder; constructing a loss function based on the first similarity and the second similarity, and training the indexable insert defect detection model through the loss function and the stochastic gradient descent method; Input the indexable insert defect samples into the indexable insert defect detection model obtained in each round of training to select the optimal indexable insert defect detection model; Obtaining an image of an indexable insert to be inspected and inputting it into an optimal indexable insert defect detection model to determine whether there is a defect; The process of obtaining the first feature vector and the second feature vector through the feature compression module includes: Convolve the first teacher coding vector t1 and the second teacher coding vector t2 so that the feature dimensions of the first teacher coding vector t1 and the second teacher coding vector t2 are the same as the third teacher coding vector t3; The first teacher coding vector t1 and the second teacher coding vector t2 are concatenated to obtain the intermediate coding vector t 12 ; The intermediate encoding vector t is encoded through the convolutional layer and residual structure. 12 , and the third teacher coding vector t3 are compressed by dimensionality reduction to obtain the first eigenvector t l , the second eigenvector t h; Among them, the third teacher coding vector t3 is obtained by inputting the normal sample of the indexable blade into the teacher encoder through the input layer; the input of the first submodule in the teacher encoder is the normal sample of the indexable blade, and the output is the first teacher coding vector t1; the input of the second submodule is the first teacher coding vector t1, and the output is the second teacher coding vector t2; the input of the third submodule is the second teacher coding vector t2, and the output is the third teacher coding vector t3; the teacher encoder includes 3 submodules, each of which is composed of a convolutional layer and a residual structure.
2. The defect detection method for indexable inserts according to claim 1, characterized in that: The indexable insert defect detection model comprises: an input layer, a teacher encoder, a feature compression module, a first student decoder, a second student decoder and an output layer; The normal sample of the indexable blade is input to the teacher encoder through the input layer; the input of the first submodule in the teacher encoder is the normal sample of the indexable blade, and the output is the first teacher encoding vector t1; the input of the second submodule is the first teacher encoding vector t1, and the output is the second teacher encoding vector t2; the input of the third submodule is the second teacher encoding vector t2, and the output is the third teacher encoding vector t3; The encoding vector output by the teacher encoder is processed by the feature compression module to obtain the first feature vector t l , the second eigenvector t h ; The first eigenvector t l Input to the first student decoder, the input of the first submodule in the first student decoder is the first feature vector t l , output the third vector s of the first student decoder l3 ; The input of the second submodule is the third vector s of the first student decoder l3 , the output is the second vector s of the first student decoder l2 ; The input of the third submodule is the second vector s of the first student decoder l2 , the output is the first vector s of the first student decoder l1 ; The second eigenvector t h Input to the second student decoder, the input of the first submodule in the second student decoder is the second feature vector t h , output the third vector s of the second student decoder h3 ; The input of the second submodule is the third vector s of the second student decoder h3 , the output is the second vector s of the second student decoder h2 ; The input of the third submodule is the second vector s of the second student decoder h2 , the output is the first vector s of the second student decoder h1 ; The output layer calculates the first similarity between the i-th teacher encoding vector and the i-th vector of the first student decoder, and calculates the second similarity between the i-th teacher encoding vector and the i-th vector of the second student decoder; concatenates all the first similarities to obtain a first feature anomaly map, and concatenates all the second similarities to obtain a second feature anomaly map; based on the first feature anomaly map and the second feature anomaly map, an anomaly map output by the indexable insert defect detection model is obtained.
3. A defect detection method for indexable inserts according to claim 1 or 2, characterized in that: The teacher encoder, the first student decoder and the second student decoder use the ResNet model.
4. A defect detection method for indexable inserts according to claim 1 or 2, characterized in that: The expressions for calculating the first similarity between the i-th teacher encoding vector and the i-th vector of the first student decoder, and calculating the second similarity between the i-th teacher encoding vector and the i-th vector of the second student decoder are as follows: ; ; Where, t i is the i-th teacher encoding vector output by the i-th submodule in the teacher encoder, s li is the i-th vector of the first student decoder output by the i-th submodule in the first student decoder, s hi is the i-th vector of the second student decoder output by the i-th submodule in the second student decoder, t ij is the jth feature of the i-th teacher encoding vector output by the i-th submodule of the teacher encoder, s lij is the jth feature of the i-th vector of the first student decoder output by the i-th submodule in the first student decoder, s hij is the j-th feature of the i-th vector of the second student decoder output by the i-th submodule in the second student decoder, where n is the vector dimension, j∈n.
5. The defect detection method for indexable inserts according to claim 2, characterized in that: The expression of the abnormal graph output by the indexable insert defect detection model based on the first characteristic abnormal graph and the second characteristic abnormal graph is as follows: ; Where M l Represents the first characteristic anomaly map, M h Represents the second characteristic anomaly map.
6. The defect detection method for indexable inserts according to claim 1, characterized in that: The loss function is constructed based on the first similarity and the second similarity. The expression of the loss function is as follows: ; In the formula, is the first similarity between the i-th teacher encoding vector and the i-th student decoder vector, is the second similarity between the i-th teacher encoding vector and the i-th student decoder vector.
7. An electronic device comprising a memory and a processor, characterized in that: The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the indexable insert defect detection method described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the indexable insert defect detection method as described in any one of claims 1 to 6 is implemented.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the indexable insert defect detection method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Abnormality detection method for SMT defect detection
CN117173095A