CN112308148A - Defect category identification and twin neural network training method, device and storage medium - Google Patents

Defect category identification and twin neural network training method, device and storage medium Download PDF

Info

Publication number
CN112308148A
CN112308148A CN202011201472.5A CN202011201472A CN112308148A CN 112308148 A CN112308148 A CN 112308148A CN 202011201472 A CN202011201472 A CN 202011201472A CN 112308148 A CN112308148 A CN 112308148A
Authority
CN
China
Prior art keywords
neural network
defect
training
sample
feature vector
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
CN202011201472.5A
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.)
Innovation Qizhi Qingdao Technology Co ltd
Original Assignee
Innovation Qizhi Qingdao Technology Co ltd
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 Innovation Qizhi Qingdao Technology Co ltd filed Critical Innovation Qizhi Qingdao Technology Co ltd
Priority to CN202011201472.5A priority Critical patent/CN112308148A/en
Publication of CN112308148A publication Critical patent/CN112308148A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Abstract

The application provides a defect type identification and twin neural network training method, a device and a storage medium, wherein the defect type identification method comprises inputting an image to be defect identified into a first neural network of the twin neural networks, so that the first neural network outputs a first feature vector which comprises first feature information for characterizing the similarity of defect categories of the image to be identified, inputs the test sample to a second neural network of the twin neural networks, and enabling the second neural network to output a second feature vector, wherein the second feature vector comprises second feature information used for representing the similarity of the defect categories of the test sample, calculating the vector distance between the vectors of the first feature vector and the second feature vector based on the first feature information and the second feature information, and determining the defect type of the image to be recognized according to the vector distance. The method and the device can realize rapid identification of the new defects of the product so as to shorten the defect identification period.

Description

Defect category identification and twin neural network training method, device and storage medium
Technical Field
The application relates to the field of artificial intelligence, in particular to a defect class identification and twin neural network training method, a device and a storage medium.
Background
At present, a product defect identification method based on a neural network is widely used, but the existing product defect identification method has the defects of low new defect identification speed, long identification period, high requirements on training samples and the like, and further the requirements of actual industrial scenes are difficult to meet.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus and a storage medium for defect type recognition and twin neural network training, so as to realize fast recognition of emerging defects of a product, so as to shorten a defect recognition period.
To this end, a first aspect of the present application discloses a defect class identification method, the method comprising the steps of:
acquiring an image to be detected and a test sample;
inputting the image to be detected into a first neural network in twin neural networks, so that the first neural network outputs a first feature vector which comprises first feature information used for representing defect category similarity of the image to be detected;
inputting the test sample into a second neural network in the twin neural network, so that the second neural network outputs a second feature vector which comprises second feature information for characterizing defect class similarity of the test sample;
calculating a vector distance between the first feature vector and the second feature vector based on the first feature information and the second feature information;
and determining the defect type of the image to be recognized according to the vector distance.
In the first aspect of the application, the image to be defect identified and the test sample are respectively input into the first neural network and the second neural network of the twin neural network, and then the first neural network and the second neural network respectively output the first feature vector corresponding to the image to be defect identified and the second feature vector corresponding to the test sample, so that the distance between the first feature vector and the second feature vector can be calculated based on the first feature information in the first feature vector and the second feature information in the second feature vector, and finally the defect type of the image to be defect identified can be determined according to the vector distance.
In the first aspect of the present application, as an optional implementation manner, the determining a defect type of the image to be identified as a defect according to the vector distance includes the sub-steps of:
taking the test sample with the minimum vector distance with the image to be identified as the nearest sample;
and taking the defect category of the nearest sample as the defect type in the image to be identified with defects.
In this optional embodiment, by using the test sample with the smallest vector distance from the image to be defect-identified as the nearest neighbor sample, the defect type of the nearest neighbor sample can be used as the defect type in the image to be defect-identified.
In the first aspect of the present application, as an optional implementation manner, before the acquiring an image to be defect identified and a test sample, the method further includes the steps of:
and extracting a defect training sample containing a preset defect type from the training sample set and using the defect training sample as the test sample.
In this alternative embodiment, a defect training sample containing a predetermined defect type may be extracted from the training sample set and used as a test sample.
A second aspect of the present application discloses a twin neural network training method, wherein the trained twin neural network is applied to the defect class identification method of the first aspect of the present application, and the twin neural network training method includes the steps of:
obtaining a plurality of defect training samples;
forming the defect training samples into a plurality of pairs of sample pairs, wherein each sample pair comprises a first training sample and a second training sample;
training the first neural network of the twin neural network according to the first training sample so that the first neural network outputs a feature vector of the first training sample meeting a preset condition, wherein the feature vector of the first training sample comprises feature information for representing defect class similarity of the first training sample;
training the second neural network of the twin neural network according to the second training sample so that the second neural network outputs a feature vector of the second training sample meeting the preset condition, wherein the feature vector of the second training sample comprises feature information used for representing defect class similarity of the second training sample.
In the second aspect of the present application, a plurality of pairs of sample pairs are formed by a plurality of defect training samples, and then the sample pairs train a first neural network and a second neural network of a twin neural network to train the first neural network and the second neural network to map inputs into an output mapping structure, that is, the first neural network and the second neural network are trained to map inputs into feature vectors containing feature information of defect class similarity until the feature vectors containing feature information of defect class similarity output by the first neural network and the second neural network satisfy a preset condition. According to the method, the twin neural network can compare the new defect with the identified defect type through training the twin neural network, so that a large number of training samples including the new defect do not need to be collected and the identification model does not need to be retrained, and therefore compared with the prior art, the method can finish training to obtain the twin neural network capable of identifying the new defect without a large number of training samples including the new defect, and has the advantages of being capable of rapidly identifying the new defect and short in defect identification period.
In the second aspect of the present application, as an optional implementation, the training the first neural network of the twin neural network according to the first training sample so that the first neural network outputs a feature vector of the first training sample that satisfies a preset condition includes:
calculating a loss result between the feature vector and a true value of the first training sample according to a preset loss function;
and when the loss result does not meet the preset matching degree weight, adjusting the parameters of the first neural network until the characteristic vector output by the first neural network meets the preset condition.
In this optional embodiment, a loss result between the feature vector and the true value of the first training sample may be calculated according to a preset loss function, and then when the loss result does not satisfy a preset matching degree weight, a parameter of the first neural network may be adjusted until the feature vector of the first training sample satisfies the preset condition.
In the second aspect of the present application, as an optional implementation, the matching degree weights of the first neural network and the second neural network are the same. In this alternative embodiment, the matching degree weights of the first and second neural networks are the same.
In the second aspect of the present application, as an optional implementation manner, the first neural network and the second neural network each include a feature extractor, and the feature extractor is a ResNet network.
In this alternative embodiment, the ResNet network of the first neural network and the ResNet network of the second neural network may be used.
A third aspect of the present application discloses a defect classification identifying apparatus, the apparatus comprising:
the first acquisition module is used for acquiring an image to be subjected to defect identification and a test sample;
a first input module, configured to input the image to be identified as a defect into a first neural network in a twin neural network, so that the first neural network outputs a first feature vector, where the first feature vector includes first feature information used for characterizing similarity of defect categories of the image to be identified as a defect;
a second input module, configured to input the test sample to a second neural network in the twin neural network, so that the second neural network outputs a second feature vector, where the second feature vector includes second feature information for characterizing defect class similarity of the test sample;
a first calculation module, configured to calculate a vector distance between the first feature vector and the second feature vector based on the first feature information and the second feature information;
and the determining module is used for determining the defect type of the image to be recognized according to the vector distance.
By executing the defect type identification method, the device of the third aspect of the application can respectively input the image to be recognized with the defect and the test sample into the first neural network and the second neural network of the twin neural network, and then the first neural network and the second neural network respectively output the first feature vector corresponding to the image to be recognized with the defect and the second feature vector corresponding to the test sample, and further can calculate the distance between the first feature vector and the second feature vector based on the first feature information in the first feature vector and the second feature information in the second feature vector, and finally can determine the defect type of the image to be recognized with the defect according to the vector distance.
A fourth aspect of the present application discloses a twin neural network training device, the device comprising:
the second acquisition module is used for acquiring a plurality of defect training samples;
the sample construction module is used for forming the defect training samples into a plurality of pairs of sample pairs, and each sample pair comprises a first training sample and a second training sample;
a first training module, configured to train the first neural network of the twin neural network according to the first training sample, so that the first neural network outputs a feature vector of the first training sample that meets a preset condition, where the feature vector of the first training sample includes feature information used for characterizing similarity of defect classes of the first training sample;
and the second training module is used for training the second neural network of the twin neural network according to the second training sample so that the second neural network outputs a feature vector of the second training sample meeting the preset condition, wherein the feature vector of the second training sample comprises feature information used for representing the defect class similarity of the second training sample.
The device of the fourth aspect of the present application, by executing the twin neural network training method, can form a plurality of pairs of sample pairs by a plurality of defect training samples, and then the sample trains the first neural network and the second neural network of the twin neural network to train the first neural network and the second neural network to map the input into the output mapping structure, that is, train the first neural network and the second neural network to map the input into the feature vector containing the feature information of the defect class similarity until the feature vector containing the feature information of the defect class similarity output by the first neural network and the second neural network meets the preset condition. The device can compare the new defect with the identified defect type by training the twin neural network, so that a large number of training samples comprising the new defect do not need to be collected and the identification model does not need to be retrained.
A fifth aspect of the present application discloses a storage medium storing a computer program which, when running, executes the defect class identification method of the first aspect of the present application and the twin neural network training method of the second aspect of the present application.
The storage medium of the fifth aspect of the present application can realize rapid identification of a new defect by executing the defect classification identification method and the twin neural network training method, so as to shorten the new defect identification period.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart illustrating a defect classification identifying method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating a twin neural network training method according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram illustrating a defect type identification apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a twin neural network training device disclosed in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Example one
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a defect type identification method according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
101. acquiring an image to be detected and a test sample;
102. inputting the image to be subjected to defect identification into a first neural network in the twin neural network, so that the first neural network outputs a first feature vector, wherein the first feature vector comprises first feature information used for representing the similarity of defect categories of the image to be subjected to defect identification;
103. inputting the test sample into a second neural network in the twin neural network, so that the second neural network outputs a second feature vector, wherein the second feature vector comprises second feature information used for representing the defect class similarity of the test sample;
104. calculating a vector distance between the first feature vector and the second feature vector based on the first feature information and the second feature information;
105. and determining the defect type of the image to be recognized according to the vector distance.
In the embodiment of the present application, the first feature vector is an embedding vector.
In the embodiment of the application, the image to be identified with the defect and the test sample are respectively input into the first neural network and the second neural network of the twin neural network, the first neural network and the second neural network respectively output the first feature vector corresponding to the image to be identified with the defect and the second feature vector corresponding to the test sample, the distance between the first feature vector and the second feature vector can be calculated based on the first feature information in the first feature vector and the second feature information in the second feature vector, and finally the defect type of the image to be identified with the defect can be determined according to the vector distance.
It should be noted that the method of the embodiment of the present application can be applied to defect detection of products. For example for defect detection of egg cones.
Compared with the prior art, the method and the device have the advantages that the new defect type can be identified by utilizing the identified defect type without acquiring a large number of samples for training and identifying the new defect, so that the training period can be shortened, and the samples can be identified rapidly. Especially, on the premise that a large amount of samples are difficult to collect due to the fact that new defects occur randomly, the effect of the embodiment of the application is better.
In the embodiment of the present application, as an optional implementation manner, step 105: determining the defect type of the image to be recognized according to the vector distance, comprising the following substeps:
taking the test sample with the minimum vector distance with the image to be identified as the nearest sample;
and taking the defect category of the nearest sample as the defect type in the image to be subjected to defect identification.
In this optional embodiment, by using the test sample with the smallest vector distance from the image to be defect-identified as the nearest neighbor sample, the defect type of the nearest neighbor sample can be used as the defect type in the image to be defect-identified.
In the embodiment of the present application, as an optional implementation manner, in step 101: before acquiring the image to be defect identified and the test sample, the method of the embodiment of the application further comprises the following steps:
and extracting a defect training sample containing a preset defect type from the training sample set and using the defect training sample as a test sample.
In this alternative embodiment, a defect training sample containing a predetermined defect type may be extracted from the training sample set and used as a test sample.
Example two
Referring to fig. 2, fig. 2 is a schematic flowchart of a twin neural network training method disclosed in an embodiment of the present application, wherein the trained twin neural network is applied to the defect class identification method in the first embodiment of the present application. As shown in fig. 2, the twin neural network training method includes the steps of:
201. obtaining a plurality of defect training samples;
202. forming a plurality of defect training samples into a plurality of pairs of sample pairs, wherein each pair of sample comprises a first training sample and a second training sample;
203. training a first neural network of the twin neural network according to the first training sample so that the first neural network outputs a feature vector of the first training sample meeting a preset condition, wherein the feature vector of the first training sample comprises feature information used for representing the defect class similarity of the first training sample;
204. and training a second neural network of the twin neural network according to the second training sample so that the second neural network outputs a feature vector of the second training sample meeting a preset condition, wherein the feature vector of the second training sample comprises feature information used for representing the defect class similarity of the second training sample.
In the embodiment of the application, a plurality of pairs of sample pairs are formed by a plurality of defect training samples, and then the sample pairs train a first neural network and a second neural network of a twin neural network to train the first neural network and the second neural network to map inputs into output mapping structures, that is, the first neural network and the second neural network are trained to map the inputs into feature vectors containing feature information of defect class similarity until the feature vectors containing the feature information of defect class similarity output by the first neural network and the second neural network meet a preset condition. According to the method, the twin neural network can compare the new defect with the identified defect type through training the twin neural network, so that a large number of training samples including the new defect do not need to be collected and the identification model does not need to be retrained, and therefore compared with the prior art, the method can finish training to obtain the twin neural network capable of identifying the new defect without a large number of training samples including the new defect, and has the advantages of being capable of rapidly identifying the new defect and short in defect identification period.
In the embodiment of the present application, as an optional implementation manner, step 203: training a first neural network of the twin neural network according to the first training sample so that the first neural network outputs a feature vector of the first training sample satisfying a preset condition, comprising the substeps of:
calculating a loss result between the feature vector and the true value of the first training sample according to a preset loss function;
and when the loss result does not meet the preset matching degree weight, adjusting the parameters of the first neural network until the characteristic vector output by the first neural network meets the preset condition.
In this optional embodiment, a loss result between the feature vector of the first training sample and the true value may be calculated according to a preset loss function, and then when the loss result does not satisfy the preset matching degree weight, the parameter of the first neural network may be adjusted until the feature vector of the first training sample satisfies the preset condition.
In the embodiment of the present application, as an optional implementation manner, the matching degree weights of the first neural network and the second neural network are the same. In this alternative embodiment, the matching degree weights of the first and second neural networks are the same.
In the embodiment of the present application, as an optional implementation manner, the first neural network and the second neural network each include a feature extractor, and the feature extractor is a ResNet network.
In this alternative embodiment, the ResNet networks of the first and second neural networks may be reversed.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic structural diagram of a defect type identification apparatus according to an embodiment of the present application. As shown in fig. 3, the defect type identifying apparatus includes:
a first obtaining module 301, configured to obtain an image to be defect identified and a test sample;
a first input module 302, configured to input the image to be identified as a defect into a first neural network in the twin neural networks, so that the first neural network outputs a first feature vector, where the first feature vector includes first feature information used for characterizing similarity of defect categories of the image to be identified as a defect;
a second input module 303, configured to input the test sample to a second neural network in the twin neural network, so that the second neural network outputs a second feature vector, where the second feature vector includes second feature information for characterizing similarity of defect classes of the test sample;
a first calculating module 304, configured to calculate a vector distance between the first feature vector and the second feature vector based on the first feature information and the second feature information;
and the determining module 305 is configured to determine the defect type of the image to be defect-identified according to the vector distance.
By executing the defect type identification method, the device provided by the embodiment of the application can respectively input the image to be recognized with the defect and the test sample into the first neural network and the second neural network of the twin neural network, further respectively output the first feature vector corresponding to the image to be recognized with the defect and the second feature vector corresponding to the test sample by the first neural network and the second neural network, further calculate the distance between the first feature vector and the second feature vector based on the first feature information in the first feature vector and the second feature information in the second feature vector, and finally determine the defect type of the image to be recognized with the defect according to the vector distance.
In the embodiment of the present application, as an optional implementation manner, the specific way for the determining module 305 to determine the defect type of the image to be defect-identified according to the vector distance is as follows:
taking the test sample with the minimum vector distance with the image to be identified as the nearest sample;
and taking the defect category of the nearest sample as the defect type in the image to be subjected to defect identification.
In this optional embodiment, by using the test sample with the smallest vector distance from the image to be defect-identified as the nearest neighbor sample, the defect type of the nearest neighbor sample can be used as the defect type in the image to be defect-identified.
In this embodiment of the present application, as an optional implementation manner, the apparatus of this embodiment of the present application further includes:
and the sample construction module is used for extracting a defect training sample containing a preset defect type from the training sample set and using the defect training sample as a test sample.
In this alternative embodiment, a defect training sample containing a predetermined defect type may be extracted from the training sample set and used as a test sample.
Example four
Referring to fig. 4, fig. 4 is a schematic structural diagram of a twin neural network training device disclosed in the embodiment of the present application. As shown in fig. 4, the twin neural network training device includes:
a second obtaining module 401, configured to obtain a plurality of defect training samples;
a sample construction module 402, configured to form a plurality of defect training samples into a plurality of pairs of sample pairs, where each pair of sample comprises a first training sample and a second training sample;
a first training module 403, configured to train a first neural network of a twin neural network according to a first training sample, so that the first neural network outputs a feature vector of the first training sample that meets a preset condition, where the feature vector of the first training sample includes feature information used for characterizing similarity of defect classes of the first training sample;
and a second training module 404, configured to train a second neural network of the twin neural network according to a second training sample, so that the second neural network outputs a feature vector of the second training sample that meets a preset condition, where the feature vector of the second training sample includes feature information used for characterizing similarity of defect classes of the second training sample.
The device of the embodiment of the application can form a plurality of pairs of sample pairs through a plurality of defect training samples by executing the twin neural network training method, and then the samples train the first neural network and the second neural network of the twin neural network to train the first neural network and the second neural network to map the input into the output mapping structure, namely, the first neural network and the second neural network are trained to map the input into the feature vector containing the feature information of the defect class similarity until the feature vector containing the feature information of the defect class similarity output by the first neural network and the second neural network meets the preset condition. The device can compare the new defect with the identified defect type by training the twin neural network, so that a large number of training samples comprising the new defect do not need to be collected and the identification model does not need to be retrained.
In this embodiment, as an optional implementation manner, the first training module 403 executes training of the first neural network of the twin neural network according to the first training sample, so that a specific manner of the first neural network outputting the feature vector of the first training sample meeting the preset condition is as follows:
calculating a loss result between the feature vector and the true value of the first training sample according to a preset loss function;
and when the loss result does not meet the preset matching degree weight, adjusting the parameters of the first neural network until the characteristic vector output by the first neural network meets the preset condition.
In this optional embodiment, a loss result between the feature vector of the first training sample and the true value may be calculated according to a preset loss function, and then when the loss result does not satisfy the preset matching degree weight, the parameter of the first neural network may be adjusted until the feature vector of the first training sample satisfies the preset condition.
In the embodiment of the present application, as an optional implementation manner, the matching degree weights of the first neural network and the second neural network are the same. In this alternative embodiment, the matching degree weights of the first and second neural networks are the same.
In the embodiment of the present application, as an optional implementation manner, the first neural network and the second neural network each include a feature extractor, and the feature extractor is a ResNet network.
In this alternative embodiment, the ResNet networks of the first and second neural networks may be reversed.
EXAMPLE five
The embodiment of the application discloses a storage medium, wherein a computer program is stored in the storage medium, and the computer program executes a defect type identification method in the first embodiment of the application and a twin neural network training method in the second embodiment of the application when running.
The storage medium of the embodiment of the application can realize the rapid identification of the new defect by executing the defect type identification method and the twin neural network training method, so as to shorten the new defect identification period.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
It should be noted that the functions, if implemented in the form of software functional modules and sold or used as independent products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A defect class identification method, the method comprising:
acquiring an image to be detected and a test sample;
inputting the image to be detected into a first neural network in twin neural networks, so that the first neural network outputs a first feature vector which comprises first feature information used for representing defect category similarity of the image to be detected;
inputting the test sample into a second neural network in the twin neural network, so that the second neural network outputs a second feature vector which comprises second feature information for characterizing defect class similarity of the test sample;
calculating a vector distance between the first feature vector and the second feature vector based on the first feature information and the second feature information;
and determining the defect type of the image to be recognized according to the vector distance.
2. The method for identifying defect types according to claim 1, wherein the determining the defect type of the image to be identified according to the vector distance comprises:
taking the test sample with the minimum vector distance with the image to be identified as the nearest sample;
and taking the defect category of the nearest sample as the defect type in the image to be identified with defects.
3. The defect classification identifying method according to claim 1, wherein before said acquiring the image to be defect identified and the test sample, the method further comprises:
and extracting a defect training sample containing a preset defect type from the training sample set and using the defect training sample as the test sample.
4. A twin neural network training method, wherein the trained twin neural network is applied to the defect class identification method according to any one of claims 1 to 3, and the method comprises:
obtaining a plurality of defect training samples;
forming the defect training samples into a plurality of pairs of sample pairs, wherein each sample pair comprises a first training sample and a second training sample;
training the first neural network of the twin neural network according to the first training sample so that the first neural network outputs a feature vector of the first training sample meeting a preset condition, wherein the feature vector of the first training sample comprises feature information for representing defect class similarity of the first training sample;
training the second neural network of the twin neural network according to the second training sample so that the second neural network outputs a feature vector of the second training sample meeting the preset condition, wherein the feature vector of the second training sample comprises feature information used for representing defect class similarity of the second training sample.
5. The twin neural network training method of claim 4, wherein the training the first neural network of the twin neural network according to the first training sample so that the first neural network outputs a feature vector of the first training sample that satisfies a preset condition, comprises:
calculating a loss result between the feature vector and a true value of the first training sample according to a preset loss function;
and when the loss result does not meet the preset matching degree weight, adjusting the parameters of the first neural network until the characteristic vector output by the first neural network meets the preset condition.
6. The twin neural network training method of claim 5, wherein the first neural network and the second neural network have the same degree of match weight.
7. The twin neural network training method of claim 5, wherein the first neural network and the second neural network each include a feature extractor, the feature extractor being a ResNet network.
8. A defect classification apparatus, characterized in that the apparatus comprises:
the first acquisition module is used for acquiring an image to be subjected to defect identification and a test sample;
a first input module, configured to input the image to be identified as a defect into a first neural network in a twin neural network, so that the first neural network outputs a first feature vector, where the first feature vector includes first feature information used for characterizing similarity of defect categories of the image to be identified as a defect;
a second input module, configured to input the test sample to a second neural network in the twin neural network, so that the second neural network outputs a second feature vector, where the second feature vector includes second feature information for characterizing defect class similarity of the test sample;
a first calculation module, configured to calculate a vector distance between the first feature vector and the second feature vector based on the first feature information and the second feature information;
and the determining module is used for determining the defect type of the image to be recognized according to the vector distance.
9. A twin neural network training apparatus, the apparatus comprising:
the second acquisition module is used for acquiring a plurality of defect training samples;
the sample construction module is used for forming the defect training samples into a plurality of pairs of sample pairs, and each sample pair comprises a first training sample and a second training sample;
a first training module, configured to train a first neural network of the twin neural network according to the first training sample, so that the first neural network outputs a feature vector of the first training sample that meets a preset condition, where the feature vector of the first training sample includes feature information used for characterizing similarity of defect classes of the first training sample;
and the second training module is used for training a second neural network of the twin neural network according to the second training sample so that the second neural network outputs a feature vector of the second training sample meeting the preset condition, wherein the feature vector of the second training sample comprises feature information used for representing the defect class similarity of the second training sample.
10. A storage medium storing a computer program, wherein the computer program executes the defect class identification method according to any one of claims 1 to 3 and the twin neural network training method according to any one of claims 4 to 7.
CN202011201472.5A 2020-11-02 2020-11-02 Defect category identification and twin neural network training method, device and storage medium Pending CN112308148A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011201472.5A CN112308148A (en) 2020-11-02 2020-11-02 Defect category identification and twin neural network training method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011201472.5A CN112308148A (en) 2020-11-02 2020-11-02 Defect category identification and twin neural network training method, device and storage medium

Publications (1)

Publication Number Publication Date
CN112308148A true CN112308148A (en) 2021-02-02

Family

ID=74334208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011201472.5A Pending CN112308148A (en) 2020-11-02 2020-11-02 Defect category identification and twin neural network training method, device and storage medium

Country Status (1)

Country Link
CN (1) CN112308148A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113112483A (en) * 2021-04-16 2021-07-13 合肥科大智能机器人技术有限公司 Rigid contact net defect detection method and system based on similarity measurement
CN114049507A (en) * 2021-11-19 2022-02-15 国网湖南省电力有限公司 Distribution network line insulator defect identification method, equipment and medium based on twin network
CN116091874A (en) * 2023-04-10 2023-05-09 成都数之联科技股份有限公司 Image verification method, training method, device, medium, equipment and program product

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376990A (en) * 2018-09-14 2019-02-22 中国电力科学研究院有限公司 A kind of method and system for the critical clearing time determining electric system based on Siamese network model
US20190080225A1 (en) * 2017-09-11 2019-03-14 Tata Consultancy Services Limited Bilstm-siamese network based classifier for identifying target class of queries and providing responses thereof
CN109508655A (en) * 2018-10-28 2019-03-22 北京化工大学 The SAR target identification method of incomplete training set based on twin network
CN110222792A (en) * 2019-06-20 2019-09-10 杭州电子科技大学 A kind of label defects detection algorithm based on twin network
CN110533654A (en) * 2019-08-30 2019-12-03 北京明略软件系统有限公司 The method for detecting abnormality and device of components
CN111179251A (en) * 2019-12-30 2020-05-19 上海交通大学 Defect detection system and method based on twin neural network and by utilizing template comparison
CN111768387A (en) * 2020-06-30 2020-10-13 创新奇智(青岛)科技有限公司 Flaw detection method, twin neural network training method and device and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190080225A1 (en) * 2017-09-11 2019-03-14 Tata Consultancy Services Limited Bilstm-siamese network based classifier for identifying target class of queries and providing responses thereof
CN109376990A (en) * 2018-09-14 2019-02-22 中国电力科学研究院有限公司 A kind of method and system for the critical clearing time determining electric system based on Siamese network model
CN109508655A (en) * 2018-10-28 2019-03-22 北京化工大学 The SAR target identification method of incomplete training set based on twin network
CN110222792A (en) * 2019-06-20 2019-09-10 杭州电子科技大学 A kind of label defects detection algorithm based on twin network
CN110533654A (en) * 2019-08-30 2019-12-03 北京明略软件系统有限公司 The method for detecting abnormality and device of components
CN111179251A (en) * 2019-12-30 2020-05-19 上海交通大学 Defect detection system and method based on twin neural network and by utilizing template comparison
CN111768387A (en) * 2020-06-30 2020-10-13 创新奇智(青岛)科技有限公司 Flaw detection method, twin neural network training method and device and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113112483A (en) * 2021-04-16 2021-07-13 合肥科大智能机器人技术有限公司 Rigid contact net defect detection method and system based on similarity measurement
CN114049507A (en) * 2021-11-19 2022-02-15 国网湖南省电力有限公司 Distribution network line insulator defect identification method, equipment and medium based on twin network
CN116091874A (en) * 2023-04-10 2023-05-09 成都数之联科技股份有限公司 Image verification method, training method, device, medium, equipment and program product

Similar Documents

Publication Publication Date Title
CN107103171B (en) Modeling method and device of machine learning model
CN109816032B (en) Unbiased mapping zero sample classification method and device based on generative countermeasure network
CN112308148A (en) Defect category identification and twin neural network training method, device and storage medium
EP1388804A2 (en) Method and system for face detection using pattern classifier
CN105574550A (en) Vehicle identification method and device
CN110598019B (en) Repeated image identification method and device
CN108304567B (en) Method and system for identifying working condition mode and classifying data of high-voltage transformer
CN110490237B (en) Data processing method and device, storage medium and electronic equipment
CN103745454A (en) Method for evaluating image processing algorithms or systems based on rank learning
CN111931809A (en) Data processing method and device, storage medium and electronic equipment
CN113723330A (en) Method and system for understanding chart document information
CN110134777A (en) Problem De-weight method, device, electronic equipment and computer readable storage medium
CN104978569A (en) Sparse representation based incremental face recognition method
CN111310611B (en) Method for detecting cell view map and storage medium
CN110413997B (en) New word discovery method, system and readable storage medium for power industry
CN112685374A (en) Log classification method and device and electronic equipment
CN115620083A (en) Model training method, face image quality evaluation method, device and medium
CN113139932B (en) Deep learning defect image identification method and system based on ensemble learning
CN114742297A (en) Power battery treatment method
KR102282328B1 (en) System and Method for Predicting Preference National Using Long Term Short Term Memory
CN109446330B (en) Network service platform emotional tendency identification method, device, equipment and storage medium
CN114329050A (en) Visual media data deduplication processing method, device, equipment and storage medium
CN111598105A (en) Patent map construction method and device
CN112818125B (en) Network topic structure evolution discovery method
CN117058432B (en) Image duplicate checking method and device, electronic equipment and readable storage 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