CN110969600A - Product defect detection method and device, electronic equipment and storage medium - Google Patents

Product defect detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110969600A
CN110969600A CN201911101102.1A CN201911101102A CN110969600A CN 110969600 A CN110969600 A CN 110969600A CN 201911101102 A CN201911101102 A CN 201911101102A CN 110969600 A CN110969600 A CN 110969600A
Authority
CN
China
Prior art keywords
image
model
defect detection
product
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911101102.1A
Other languages
Chinese (zh)
Inventor
刘鹏
薛春芳
李秋生
程长华
萧伟权
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changchun University of Science and Technology
Original Assignee
Yangzhong Intelligent Electrical Institute North China Electric Power University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yangzhong Intelligent Electrical Institute North China Electric Power University filed Critical Yangzhong Intelligent Electrical Institute North China Electric Power University
Priority to CN201911101102.1A priority Critical patent/CN110969600A/en
Publication of CN110969600A publication Critical patent/CN110969600A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/0008Industrial image inspection checking presence/absence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a product defect detection method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance; and determining whether the product to be detected has defects or not based on the defect detection model. In the embodiment of the invention, the electronic equipment trains the defect detection model in advance, inputs the first image containing the product into the defect detection model aiming at the product to be detected, detects whether the product has defects or not based on the defect detection model, and outputs a corresponding result. The scheme provided by the embodiment of the invention does not need manual intervention and is not influenced by light and product types, so that a large amount of human resources are saved, and the detection efficiency and the accuracy are higher.

Description

Product defect detection method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of product defect detection technologies, and in particular, to a method and an apparatus for detecting product defects, an electronic device, and a storage medium.
Background
With the arrival of information and an intelligent society, the production of industrial products and precision parts gradually moves to intelligent production, the productivity is greatly improved, application scenes are increased, a plurality of related enterprises are promoted, the precision degree of the industrial products plays an important role in industrial production, and if unqualified products exist, the production can be influenced unpredictably. Therefore, defect detection of products becomes particularly important.
When the defects of products are detected in the prior art, the defects are generally observed by manpower and traditional tools, so that a lot of redundant workload is brought to workers, the precision is difficult to guarantee, the efficiency is low, and a large amount of manpower and material resources are wasted for large-batch products. In order to improve efficiency and save labor, the prior art also provides a structure for comparing a gray value in an analysis image with a threshold value to detect whether defects exist, and the method has the problems that only products with smooth surfaces can be detected whether defects exist, the limitation is large, and the detection is inaccurate due to light and other reasons.
Therefore, the product defect detection scheme in the prior art has the problems of low detection efficiency and accuracy.
Disclosure of Invention
The embodiment of the invention provides a product defect detection method and device, electronic equipment and a storage medium, which are used for solving the problems of low detection efficiency and accuracy of a product defect detection scheme in the prior art.
The embodiment of the invention provides a product defect detection method, which comprises the following steps:
acquiring a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance;
and determining whether the product to be detected has defects or not based on the defect detection model.
Further, the training process of the defect detection model comprises:
inputting each second image in the training set into the defect detection model to obtain each defect detection image; and determining a model training error according to the labeling image corresponding to each defect detection image and each second image, and taking the model with the minimum error as the trained defect detection model after a preset time or a preset iteration number.
Further, the inputting each second image in the training set into the defect detection model to obtain each defect detection image includes:
inputting each second image in the training set into at least two single detection models, and training the at least two single detection models;
removing the input layer and the full connection layer of the at least two single detection models which are trained;
and inputting each second image in the training set into at least two single detection models, merging the detection characteristic graphs generated by the at least two single detection models, and transmitting the detection characteristic graphs to a full-connection layer of the defect detection models to obtain each defect detection image.
Further, the at least two single detection models include at least two of an inclusion ResNet v2 model, a VGG16 model, a DenseNet model, and a ResNet model.
Further, the determining a model training error according to the labeling image corresponding to each defect detection image and each second image includes:
according to the formula:
Figure BDA0002269892130000021
Figure BDA0002269892130000022
determining the error of each pixel point; determining a model training error according to the error of each pixel point;
in the formula, ptAnd when y is equal to 1, the pixel point is indicated as a background pixel point, when y is equal to 0, the pixel point is indicated as a defective pixel point, and α is a weighting constant.
In another aspect, an embodiment of the present invention provides a product defect detection apparatus, where the apparatus includes:
the input module is used for acquiring a first image containing a product to be detected and inputting the first image into a defect detection model which is trained in advance;
and the determining module is used for determining whether the product to be detected has defects or not based on the defect detection model.
Further, the apparatus further comprises:
the training module is used for inputting each second image in the training set into the defect detection model to obtain each defect detection image; and determining a model training error according to the labeling image corresponding to each defect detection image and each second image, and taking the model with the minimum error as the trained defect detection model after a preset time or a preset iteration number.
Further, the training module is specifically configured to input each second image in the training set to at least two single detection models, and train the at least two single detection models; removing the input layer and the full connection layer of the at least two single detection models which are trained; and inputting each second image in the training set into at least two single detection models, merging the detection characteristic graphs generated by the at least two single detection models, and transmitting the detection characteristic graphs to a full-connection layer of the defect detection models to obtain each defect detection image.
Further, the at least two single detection models include at least two of an inclusion ResNet v2 model, a VGG16 model, a DenseNet model, and a ResNet model.
Further, the training module is specifically configured to:
Figure BDA0002269892130000031
Figure BDA0002269892130000032
determining the error of each pixel point; determining a model according to the error of each pixel pointTraining errors; in the formula, ptAnd when y is equal to 1, the pixel point is indicated as a background pixel point, when y is equal to 0, the pixel point is indicated as a defective pixel point, and α is a weighting constant.
On the other hand, the embodiment of the invention provides electronic equipment, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing any of the above method steps when executing a program stored in the memory.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps of any one of the above.
The embodiment of the invention provides a product defect detection method, a product defect detection device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance; and determining whether the product to be detected has defects or not based on the defect detection model. In the embodiment of the invention, the electronic equipment trains the defect detection model in advance, inputs the first image containing the product into the defect detection model aiming at the product to be detected, detects whether the product has defects or not based on the defect detection model, and outputs a corresponding result. The scheme provided by the embodiment of the invention does not need manual intervention and is not influenced by light and product types, so that a large amount of human resources are saved, and the detection efficiency and the accuracy are higher.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of a product defect detection process provided by an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an inclusion resnetv2 model according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a partial network structure of stem in the inclusion resnetv2 model according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a VGG16 model according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a DenseNet model provided in an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a ResNet model according to an embodiment of the present invention;
fig. 7 is a schematic diagram of residual error units in the ResNet model according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of a defect detection model according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of a product defect detecting apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the attached drawings, and it should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1:
fig. 1 is a schematic diagram of a product defect detection process provided in an embodiment of the present invention, where the process includes the following steps:
s101: the method comprises the steps of obtaining a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance.
S102: and determining whether the product to be detected has defects or not based on the defect detection model.
The product defect detection method provided by the embodiment of the invention is applied to electronic equipment, and the electronic equipment can be equipment such as a PC (personal computer) and a tablet personal computer with model training and image processing capabilities. The method comprises the steps that a defect detection model which is trained in advance is stored in the electronic equipment, wherein different defect data are selected in the process of training the defect detection model, and the data are not completely the same as far as possible, so that the richness of the defect detection model can be increased, the extraction of relevant features is facilitated, and the accuracy of the defect detection model is improved.
For a product to be detected, an image acquisition device acquires an image of the product to be detected, and in the embodiment of the invention, the image containing the product to be detected is used as a first image. The image acquisition equipment sends the first image to the electronic equipment, after the electronic equipment acquires the first image containing the product to be detected, the first image is input into a defect detection model which is trained in advance, the defect detection model outputs a detection result corresponding to the first image, and the detection result comprises the defect of the product to be detected in the first image and the defect of the product to be detected in the first image.
In the embodiment of the invention, the electronic equipment trains the defect detection model in advance, inputs the first image containing the product into the defect detection model aiming at the product to be detected, detects whether the product has defects or not based on the defect detection model, and outputs a corresponding result. The scheme provided by the embodiment of the invention does not need manual intervention and is not influenced by light and product types, so that a large amount of human resources are saved, and the detection efficiency and the accuracy are higher.
Example 2:
on the basis of the above embodiment, in the embodiment of the present invention, the training process of the defect detection model includes:
inputting each second image in the training set into the defect detection model to obtain each defect detection image; and determining a model training error according to the labeling image corresponding to each defect detection image and each second image, and taking the model with the minimum error as the trained defect detection model after a preset time or a preset iteration number.
In the embodiment of the present invention, a training set for training a defect detection model is stored in advance in the electronic device, and an image in the training set is referred to as a second image. And moreover, for each second image, a corresponding annotation image is stored, and defective pixel points are marked in the annotation image. And the electronic equipment inputs each second image and the corresponding marked image into the defect detection model and trains the defect detection model.
Specifically, the electronic device inputs each second image into the defect detection model to obtain each defect detection image, and then determines a current model training error according to the defect detection image and the annotation image corresponding to the second image. Specifically, for each group of corresponding labeled image and defect detection image, the number of pixel points with different pixel types in the two images of the group is identified, and the pixel types include defect pixels and background pixels. And taking the ratio of the number of the pixel points with different pixel types to the total number of the pixel points of the labeled image as a training error of the group of images, and then determining the average value of the training errors of each group of images as a model training error. And after the electronic equipment passes through preset time or preset iteration times, taking the model with the minimum error as the trained defect detection model.
The electronic device may further store a test set for verifying the accuracy of the model obtained by training and for model screening.
Example 3:
on the basis of the foregoing embodiments, in order to make the accuracy of the trained defect detection model higher, in an embodiment of the present invention, the inputting each second image in the training set into the defect detection model to obtain each defect detection image includes:
inputting each second image in the training set into at least two single detection models, and training the at least two single detection models;
removing the input layer and the full connection layer of the at least two single detection models which are trained;
and inputting each second image in the training set into at least two single detection models, merging the detection characteristic graphs generated by the at least two single detection models, and transmitting the detection characteristic graphs to a full-connection layer of the defect detection models to obtain each defect detection image.
The at least two single detection models include at least two of an IncepotionResNet V2 model, a VGG16 model, a DenseNet model, and a ResNet model.
In the embodiment of the invention, at least two single detection models are trained according to each second image and the corresponding annotation image in the training set, specifically, the electronic device inputs each second image into at least two single detection models to obtain each defect detection image output by at least two single detection models, and then the current model training error is determined according to the defect detection image and the annotation image corresponding to the second image. And after the electronic equipment passes through preset time or preset iteration times, taking the model with the minimum error as at least two single detection models after training.
In the embodiment of the present invention, the at least two single detection models may be at least two of the inclpetionresnet v2 model, the VGG16 model, the densneet model, and the ResNet model, and preferably, may include four models of the inclpetionresnet v2 model, the VGG16 model, the densneet model, and the ResNet model at the same time.
Fig. 2 is a schematic structural diagram of an inclusion resnetv2 model according to an embodiment of the present invention, and a stem partial network structure in the inclusion resnetv2 model is shown in fig. 3. Fig. 4 is a schematic structural diagram of a VGG16 model according to an embodiment of the present invention, in the VGG16 model, 3x3 convolution kernels are used to replace 7x7 convolution kernels, and 2 x3 convolution kernels are used to replace 5 x 5 convolution kernels, so that the main purpose of this is to improve the depth of the network and improve the effect of the neural network to a certain extent under the condition of ensuring the same perceptual view. The VGG16 has six stages of training processes, namely A, A-LRN, B, C, D and E stages, and during training, layer-by-layer recursive training is carried out. Fig. 5 is a schematic structural diagram of a DenseNet model according to an embodiment of the present invention. Fig. 6 is a schematic structural diagram of a ResNet model provided in an embodiment of the present invention, and a residual error unit in the ResNet model is shown in fig. 7.
In the embodiment of the invention, after the training of the four models, namely the InceptionResNet V2 model, the VGG16 model, the DenseNet model and the ResNet model, the input layer and the full connection layer of the four single detection models are removed. Fig. 8 is a schematic structural diagram of a defect detection model provided in an embodiment of the present invention, and as shown in fig. 8, a data layer and a distribution layer are added before the four models, i.e., an inclpetionresnetv 2 model, a VGG16 model, a DenseNet model, and a ResNet model, where the data layer is used to process a second image in a training set according to respective needs of the inclpetionresnetv 2 model, the VGG16 model, the DenseNet model, and the ResNet model for an input image, so as to generate images respectively satisfying the input requirements of the inclpetionresnetv 2 model, the VGG16 model, the denset model, and the ResNet model, and the distribution layer is used to respectively send the generated images to the inclpetionresnetv 2 model, the VGG16 model, the DenseNet model, and the ResNet model.
A size unification layer, a blank layer, a feature addition layer and a full connection layer are added after the four models of the IncepistionResNet V2 model, the VGG16 model, the DenseNet model and the ResNet model. The function of the dimension unification layer is to modify the feature map output by each single model, mainly to modify the dimension to obtain the feature map with the same dimension. The purpose of the blank layer is to further card the profile, and further processing may be to add a suitable scale-up profile or the like. The feature adding layer is used for merging feature maps with the same size output by the blank layer, and it should be noted that, when merging, it is necessary to ensure that the feature maps are kept the same in the channel direction, that is, the feature maps have to have the same length and width. Specifically, pixel values of pixel points corresponding to feature maps with the same size are added, so that the representation form of the feature maps is enhanced, the combined feature maps are input into a full-connection layer, and a defect detection image is output from the full-connection layer.
In the embodiment of the invention, the model training error is determined according to each defect detection image and the corresponding label image of each second image, and after the preset time or the preset iteration times, the model with the minimum error is used as the defect detection model after training. After the InceptionResNet V2 model, the VGG16 model, the DenseNet model and the ResNet model are trained, parameters of each single model are fixed and unchanged, and only parameters of a full connection layer in the defect detection model are trained in each iteration process.
In the embodiment of the invention, a plurality of single models are adopted for fusion, so that the advantages of each single model are extracted, and the detection precision of the defect detection model is improved. The influence of the outside is small, and the detection precision of the micro defects is higher.
Example 4:
in the prior art, most of training sets are simple and easily separable background samples, and the calculation of errors is mainly contributed by the excessive number of the simple and easily separable background samples, so that the updating direction of gradients is dominant, and important information is covered. In order to enlarge the influence of the hard pixels on the Loss function and enlarge the influence of the defect area on the Loss function, the problem of sample imbalance is solved. In an embodiment of the present invention, the determining a model training error according to the labeling image corresponding to each defect detection image and each second image includes:
according to the formula:
Figure BDA0002269892130000091
Figure BDA0002269892130000092
determining the error of each pixel point; determining a model training error according to the error of each pixel point;
in the formula, ptAnd when y is equal to 1, the pixel point is indicated as a background pixel point, when y is equal to 0, the pixel point is indicated as a defective pixel point, and α is a weighting constant.
After the error of each pixel point is determined according to the above formula, the average value of the errors of each pixel point can be used as a model training error.
In the embodiment of the present invention, α may be 0.25. from the above formula analysis, the contribution of the defective pixel to the Loss function can be enlarged by applying the control weights α and (1- α) before the formula, so as to solve the problem of sample imbalancetThe larger the size of the pixel, the more easily the pixel is divided, and the larger the size of the pixel is, the more easily the pixel is divided by adding
Figure BDA0002269892130000093
Then p istThe larger the contribution to Loss is, the smaller the contribution to Loss is; when y is 0, it indicates that the pixel label is defective, then ptThe smaller the size of the pixel, the easier the pixel is to be separated, and the smaller the size of the pixel is, the more easily the pixel is separated by adding
Figure BDA0002269892130000101
Then p istThe smaller the contribution to Loss. By means of the arrangement, the influence of the difficultly-divided pixels on the Loss function can be enlarged, meanwhile, the influence of the defect area on the Loss function is enlarged, and the problem of sample imbalance is solved.
Example 5:
fig. 9 is a schematic structural diagram of a product defect detecting apparatus according to an embodiment of the present invention, where the apparatus includes:
the input module 91 is used for acquiring a first image containing a product to be detected and inputting the first image into a defect detection model which is trained in advance;
a determining module 92, configured to determine whether the product to be detected has a defect based on the defect detection model.
The device further comprises:
a training module 93, configured to input each second image in the training set into the defect detection model to obtain each defect detection image; and determining a model training error according to the labeling image corresponding to each defect detection image and each second image, and taking the model with the minimum error as the trained defect detection model after a preset time or a preset iteration number.
The training module 93 is specifically configured to input each second image in the training set to at least two single detection models, and train the at least two single detection models; removing the input layer and the full connection layer of the at least two single detection models which are trained; and inputting each second image in the training set into at least two single detection models, merging the detection characteristic graphs generated by the at least two single detection models, and transmitting the detection characteristic graphs to a full-connection layer of the defect detection models to obtain each defect detection image.
The at least two single detection models include at least two of an IncepotionResNet V2 model, a VGG16 model, a DenseNet model, and a ResNet model.
The training module 93 is specifically configured to:
Figure BDA0002269892130000102
determining the error of each pixel point; determining a model training error according to the error of each pixel point; in the formula, ptAnd when y is equal to 1, the pixel point is indicated as a background pixel point, when y is equal to 0, the pixel point is indicated as a defective pixel point, and α is a weighting constant.
Example 6:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides an electronic device, as shown in fig. 10, including: the system comprises a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302 and the memory 303 complete mutual communication through the communication bus 304;
the memory 303 has stored therein a computer program which, when executed by the processor 301, causes the processor 301 to perform the steps of:
acquiring a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance;
and determining whether the product to be detected has defects or not based on the defect detection model.
Based on the same inventive concept, the embodiment of the present invention further provides an electronic device, and as the principle of solving the problem of the electronic device is similar to the product defect detection method, the implementation of the electronic device may refer to the implementation of the method, and repeated details are not repeated.
The electronic device provided by the embodiment of the invention can be a desktop computer, a portable computer, a smart phone, a tablet computer, a Personal Digital Assistant (PDA), a network side device and the like.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 302 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The processor may be a general-purpose processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
When the processor executes the program stored in the memory in the embodiment of the invention, the first image containing the product to be detected is obtained, and the first image is input into a defect detection model which is trained in advance; and determining whether the product to be detected has defects or not based on the defect detection model. In the embodiment of the invention, the electronic equipment trains the defect detection model in advance, inputs the first image containing the product into the defect detection model aiming at the product to be detected, detects whether the product has defects or not based on the defect detection model, and outputs a corresponding result. The scheme provided by the embodiment of the invention does not need manual intervention and is not influenced by light and product types, so that a large amount of human resources are saved, and the detection efficiency and the accuracy are higher.
Example 7:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides a computer storage readable storage medium, in which a computer program executable by an electronic device is stored, and when the program is run on the electronic device, the electronic device is caused to execute the following steps:
acquiring a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance;
and determining whether the product to be detected has defects or not based on the defect detection model.
Based on the same inventive concept, embodiments of the present invention further provide a computer-readable storage medium, and since a principle of solving a problem when a processor executes a computer program stored in the computer-readable storage medium is similar to a product defect detection method, implementation of the computer program stored in the computer-readable storage medium by the processor may refer to implementation of the method, and repeated details are not repeated.
The computer readable storage medium may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MO), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, nonvolatile memories (NANDFLASH), Solid State Disks (SSDs), etc.
The computer program is stored in a computer readable storage medium provided in the embodiment of the invention, and when being executed by a processor, the computer program realizes the acquisition of a first image containing a product to be detected, and inputs the first image into a defect detection model which is trained in advance; and determining whether the product to be detected has defects or not based on the defect detection model. In the embodiment of the invention, the electronic equipment trains the defect detection model in advance, inputs the first image containing the product into the defect detection model aiming at the product to be detected, detects whether the product has defects or not based on the defect detection model, and outputs a corresponding result. The scheme provided by the embodiment of the invention does not need manual intervention and is not influenced by light and product types, so that a large amount of human resources are saved, and the detection efficiency and the accuracy are higher.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A method of product defect detection, the method comprising:
acquiring a first image containing a product to be detected, and inputting the first image into a defect detection model which is trained in advance;
and determining whether the product to be detected has defects or not based on the defect detection model.
2. The method of claim 1, wherein the training process of the defect detection model comprises:
inputting each second image in the training set into the defect detection model to obtain each defect detection image; and determining a model training error according to the labeling image corresponding to each defect detection image and each second image, and taking the model with the minimum error as the trained defect detection model after a preset time or a preset iteration number.
3. The method of claim 2, wherein inputting each second image in the training set into a defect detection model, resulting in each defect detection image comprises:
inputting each second image in the training set into at least two single detection models, and training the at least two single detection models;
removing the input layer and the full connection layer of the at least two single detection models which are trained;
and inputting each second image in the training set into at least two single detection models, merging the detection characteristic graphs generated by the at least two single detection models, and transmitting the detection characteristic graphs to a full-connection layer of the defect detection models to obtain each defect detection image.
4. The method of claim 3, wherein the at least two single detection models comprise at least two of an IncepotionResNetV 2 model, a VGG16 model, a DenseNet model, a ResNet model.
5. The method of claim 2 or 3, wherein determining a model training error based on the annotated image corresponding to each defect detection image and each second image comprises:
according to the formula: loss (p)t)=-α*y*(e-pt)log(pt)-(1-α)*(1-y)*(ept)log(1-pt) Determining the error of each pixel point; determining a model training error according to the error of each pixel point;
in the formula, ptAnd when y is equal to 1, the pixel point is indicated as a background pixel point, when y is equal to 0, the pixel point is indicated as a defective pixel point, and α is a weighting constant.
6. A product defect detection apparatus, the apparatus comprising:
the input module is used for acquiring a first image containing a product to be detected and inputting the first image into a defect detection model which is trained in advance;
and the determining module is used for determining whether the product to be detected has defects or not based on the defect detection model.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the training module is used for inputting each second image in the training set into the defect detection model to obtain each defect detection image; and determining a model training error according to the labeling image corresponding to each defect detection image and each second image, and taking the model with the minimum error as the trained defect detection model after a preset time or a preset iteration number.
8. The apparatus of claim 7, wherein the training module is specifically configured to input each second image in the training set to at least two single detection models, the at least two single detection models being trained; removing the input layer and the full connection layer of the at least two single detection models which are trained; and inputting each second image in the training set into at least two single detection models, merging the detection characteristic graphs generated by the at least two single detection models, and transmitting the detection characteristic graphs to a full-connection layer of the defect detection models to obtain each defect detection image.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-5.
CN201911101102.1A 2019-11-12 2019-11-12 Product defect detection method and device, electronic equipment and storage medium Pending CN110969600A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911101102.1A CN110969600A (en) 2019-11-12 2019-11-12 Product defect detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911101102.1A CN110969600A (en) 2019-11-12 2019-11-12 Product defect detection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110969600A true CN110969600A (en) 2020-04-07

Family

ID=70030466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911101102.1A Pending CN110969600A (en) 2019-11-12 2019-11-12 Product defect detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110969600A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914656A (en) * 2020-07-06 2020-11-10 浙江大华技术股份有限公司 Personnel behavior detection method and device, electronic equipment and storage medium
CN112330594A (en) * 2020-10-13 2021-02-05 浙江华睿科技有限公司 Paper tube defect detection method and device, electronic equipment and storage medium
CN112528979A (en) * 2021-02-10 2021-03-19 成都信息工程大学 Transformer substation inspection robot obstacle distinguishing method and system
CN113469944A (en) * 2021-06-03 2021-10-01 厦门宏泰智能制造有限公司 Product quality inspection method and device and electronic equipment
WO2024020994A1 (en) * 2022-07-29 2024-02-01 宁德时代新能源科技股份有限公司 Training method and training device for defect detection model of battery cell

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107679525A (en) * 2017-11-01 2018-02-09 腾讯科技(深圳)有限公司 Image classification method, device and computer-readable recording medium
CN109426858A (en) * 2017-08-29 2019-03-05 京东方科技集团股份有限公司 Neural network, training method, image processing method and image processing apparatus
CN109754392A (en) * 2018-12-20 2019-05-14 上海集成电路研发中心有限公司 A kind of device and method that defect image automatically analyzes
CN110009614A (en) * 2019-03-29 2019-07-12 北京百度网讯科技有限公司 Method and apparatus for output information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109426858A (en) * 2017-08-29 2019-03-05 京东方科技集团股份有限公司 Neural network, training method, image processing method and image processing apparatus
CN107679525A (en) * 2017-11-01 2018-02-09 腾讯科技(深圳)有限公司 Image classification method, device and computer-readable recording medium
CN109754392A (en) * 2018-12-20 2019-05-14 上海集成电路研发中心有限公司 A kind of device and method that defect image automatically analyzes
CN110009614A (en) * 2019-03-29 2019-07-12 北京百度网讯科技有限公司 Method and apparatus for output information

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914656A (en) * 2020-07-06 2020-11-10 浙江大华技术股份有限公司 Personnel behavior detection method and device, electronic equipment and storage medium
CN112330594A (en) * 2020-10-13 2021-02-05 浙江华睿科技有限公司 Paper tube defect detection method and device, electronic equipment and storage medium
CN112330594B (en) * 2020-10-13 2024-01-30 浙江华睿科技股份有限公司 Paper tube defect detection method and device, electronic equipment and storage medium
CN112528979A (en) * 2021-02-10 2021-03-19 成都信息工程大学 Transformer substation inspection robot obstacle distinguishing method and system
CN113469944A (en) * 2021-06-03 2021-10-01 厦门宏泰智能制造有限公司 Product quality inspection method and device and electronic equipment
WO2024020994A1 (en) * 2022-07-29 2024-02-01 宁德时代新能源科技股份有限公司 Training method and training device for defect detection model of battery cell

Similar Documents

Publication Publication Date Title
CN110969600A (en) Product defect detection method and device, electronic equipment and storage medium
CN110111334B (en) Crack segmentation method and device, electronic equipment and storage medium
CN109697468B (en) Sample image labeling method and device and storage medium
CN114819186A (en) Method and device for constructing GBDT model, and prediction method and device
CN108805180B (en) Target object detection method and device
CN108897829A (en) Modification method, device and the storage medium of data label
CN110969200A (en) Image target detection model training method and device based on consistency negative sample
CN107895172A (en) Utilize the method, apparatus and computing device of image information detection anomalous video file
CN112669275A (en) PCB surface defect detection method and device based on YOLOv3 algorithm
CN112419268A (en) Method, device, equipment and medium for detecting image defects of power transmission line
CN116128839A (en) Wafer defect identification method, device, electronic equipment and storage medium
CN117372424B (en) Defect detection method, device, equipment and storage medium
CN117392042A (en) Defect detection method, defect detection apparatus, and storage medium
CN116777861B (en) Marking quality detection method and system for laser engraving machine
CN114943672A (en) Image defect detection method and device, electronic equipment and storage medium
CN116137061B (en) Training method and device for quantity statistical model, electronic equipment and storage medium
CN112861867A (en) Pointer type instrument panel identification method, system and storage medium
CN110705633B (en) Target object detection method and device and target object detection model establishing method and device
CN115205619A (en) Training method, detection method, device and storage medium for detection model
CN111400644B (en) Calculation processing method for laboratory analysis sample
CN113284141A (en) Model determination method, device and equipment for defect detection
CN112396083B (en) Image recognition, model training and construction and detection methods, systems and equipment
CN112527631A (en) bug positioning method, system, electronic equipment and storage medium
CN110705479A (en) Model training method, target recognition method, device, equipment and medium
CN116644805A (en) Model training method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20231124

Address after: No.7089 Weixing Road, Changchun City, Jilin Province 130000

Applicant after: CHANGCHUN University OF SCIENCE AND TECHNOLOGY

Address before: 212200 Daquan Road, Xinba Town, Yangzhong City, Zhenjiang City, Jiangsu Province

Applicant before: YANGZHONG INTELLIGENT ELECTRICAL INSTITUTE, NORTH CHINA ELECTRIC POWER University

TA01 Transfer of patent application right