12254612

Method for Constructing Defect Detection Model, Method for Detecting Defect and Related Apparatus

PublishedMarch 18, 2025
Assigneenot available in USPTO data we have
Technical Abstract

Patent Claims
10 claims

Legal claims defining the scope of protection, as filed with the USPTO.

1

1. A method for constructing a defect detection model, comprising: obtaining an initial training image, and adding a simulated anomaly to the initial training image to obtain a simulated anomaly training image; training a preset defect recognition model according to the initial training image and the simulated anomaly training image to obtain defect position information and mask prompt information; training a preset defect segmentation model according to the defect position information and the mask prompt information; and fusing the trained defect recognition model and defect segmentation model to obtain the defect detection model; wherein the defect recognition model comprises a teacher network branch, a student network branch and an autoencoder network branch; the teacher network branch adopts a fixed network weight, and the student network branch and the autoencoder network branch adopt a trainable network weight; and an output difference between the teacher network branch and the student network branch is the defect position information, and an output difference between the student network branch and the autoencoder network branch is the mask prompt information.

2

2. The method for constructing the defect detection model according to claim 1, wherein the teacher network branch and the student network branch adopt the same network structure which is of an encoder structure; and a network structure of the autoencoder network branch is an encoder-decoder structure.

3

3. The method for constructing the defect detection model according to claim 1, wherein adding the simulated anomaly to the initial training image to obtain the simulated anomaly training image comprises: adding the simulated anomaly to the initial training image by using an anomaly generator through the following formula to obtain the simulated anomaly training image: Ia=M⊙I+(1−α)(M⊙I)+α(M⊙A) wherein Ia is the simulated anomaly training image, I is the initial training image, M is a simulated anomaly mask, M is an inverse of M, ⊙ is pixel-wise multiplication, α is an opaqueness parameter in blend, and A is an additional texture image.

4

4. The method for constructing the defect detection model according to claim 1, wherein a training loss function of the teacher network branch-student network branch during training the preset defect recognition model according to the initial training image and the simulated anomaly training image is:, L S ⁢ T = L h ⁢ a ⁢ r ⁢ d + ( CWH ) - 1 ⁢ ∑ c  S ⁡ ( P ) c  F 2 L STAE = ( CWH ) - 1 ⁢ ∑ c  A ⁡ ( I ) c - S ′ ( I ) c  F 2 wherein LST represents a loss function between the student network branch and the teacher network branch; Lhard represents a hard sample loss function; H, W and C respectively represent a height, a width and the number of channels of an outputted feature map; S(P)c represents an output of the student network branch; c represents the number of channels; LSTAE represents a loss function between an autoencoder network branch and the student network branch; S′(I)c represents an additional output of the student network branch; A(I)c represents an output of the autoencoder network branch; and a training loss function of the teacher network branch-autoencoder network branch is:, L AE = ( CWH ) - 1 ⁢ ∑ c  T ⁡ ( I ) c - A ⁡ ( I ) c  F 2 wherein LAE represents a loss function between the autoencoder network branch and the teacher network branch; and T(I)c represents an output of the teacher network branch.

5

5. The method for constructing the defect detection model according to claim 1, wherein the defect segmentation model is obtained by introducing a trainable branch based on a pre-trained SAM model and modifying a self-attention mechanism in a Transformer module of the pre-trained SAM model; and parameters of the pre-trained SAM model are fixed during training the preset defect segmentation model according to the defect position information and the mask prompt information; wherein a process of generating a query Q, a key K and a value V in the modified self-attention mechanism is: Q=X·WQ1·WQ2+X·WQ K=X·WK V=X·WV1·WV2+X·WV wherein X represents an input feature; WQ1 represents a first part of an new added query matrix based on a trainable branch; WQ2 represents a second part of the new added query matrix based on the trainable branch; WQ represents an original query matrix of the SAM model; WK represents an original key matrix of the SAM model; WV1 represents a first part of a new added value matrix based on a trainable branch; WV2 represents a second part of the new added value matrix based on the trainable branch; and WV represents an original value matrix of the SAM model.

6

6. A method for detecting a defect, comprising: obtaining an image of a to-be-detected sample; and inputting the image of the to-be-detected sample into a preset defect detection model to obtain a defect detection result of the to-be-detected sample; wherein the preset defect detection model is constructed by using the method for constructing the defect detection model according to claim 1.

7

7. A system for detecting a defect, comprising: a sample image obtaining module, configured to obtain an image of a to-be-detected sample; and a defect detection module, configured to input the image of the to-be-detected sample into a preset defect detection model to obtain a defect detection result of the to-be-detected sample; wherein the preset defect detection model is constructed by using the method for constructing the defect detection model according to claim 1.

8

8. A computer device, comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor, when performing the computer program, implements steps of the method for constructing the defect detection model according to claim 1.

9

9. A computer-readable storage medium, storing a computer program, wherein the computer program, when performed by a processor, implements steps of the method for constructing the defect detection model according to claim 1.

10

10. A system for constructing a defect detection model, comprising: an image processing module, configured to obtain an initial training image, and add a simulated anomaly to the initial training image to obtain a simulated anomaly training image; a recognition model training module, configured to train a preset defect recognition model according to the initial training image and the simulated anomaly training image to obtain defect position information and mask prompt information; a segmentation model training module, configured to train a preset defect segmentation model according to the defect position information and the mask prompt information; and a model fusing module, configured to fuse the trained defect recognition model and defect segmentation model to obtain a defect detection model; wherein the defect recognition model comprises a teacher network branch, a student network branch and an autoencoder network branch; the teacher network branch adopts a fixed network weight, and the student network branch and the autoencoder network branch adopt a trainable network weight; and an output difference between the teacher network branch and the student network branch is the defect position information, and an output difference between the student network branch and the autoencoder network branch is the mask prompt information.

Patent Metadata

Filing Date

Unknown

Publication Date

March 18, 2025

Inventors

Xian TAO
Shichen QU
Zhen QU

Want to explore more patents?

Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.

Citation & reuse

Analysis on this page is generated by Patentable — an AI-powered patent intelligence platform. AI-generated summaries, explanations, and analysis may be reused with attribution and a visible link back to the canonical URL below. Patent abstracts and claims are USPTO public domain.

Cite as: Patentable. “METHOD FOR CONSTRUCTING DEFECT DETECTION MODEL, METHOD FOR DETECTING DEFECT AND RELATED APPARATUS” (12254612). https://patentable.app/patents/12254612

© 2026 Patentable. All rights reserved.

Patentable is a research and drafting-assistant tool, not a law firm, and does not provide legal advice. Documents we generate are drafts for review by a licensed patent attorney.