CN117974664B - Image recognition-based bowl forging flaw detection method and system - Google Patents

Image recognition-based bowl forging flaw detection method and system Download PDF

Info

Publication number
CN117974664B
CN117974664B CN202410381654.7A CN202410381654A CN117974664B CN 117974664 B CN117974664 B CN 117974664B CN 202410381654 A CN202410381654 A CN 202410381654A CN 117974664 B CN117974664 B CN 117974664B
Authority
CN
China
Prior art keywords
low
dimensional
forging
bowl
pot
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.)
Active
Application number
CN202410381654.7A
Other languages
Chinese (zh)
Other versions
CN117974664A (en
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.)
Baoji Pengxin Metal Material Co ltd
Original Assignee
Baoji Pengxin Metal Material 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 Baoji Pengxin Metal Material Co ltd filed Critical Baoji Pengxin Metal Material Co ltd
Priority to CN202410381654.7A priority Critical patent/CN117974664B/en
Publication of CN117974664A publication Critical patent/CN117974664A/en
Application granted granted Critical
Publication of CN117974664B publication Critical patent/CN117974664B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • 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/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • 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/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • 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/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The application relates to the field of flaw detection of pot forgings, in particular to a method and a system for detecting flaw of a pot forgings based on image identification, wherein the method comprises the following steps: the method comprises the steps of obtaining a bowl forging image dataset, labeling the bowl forging image dataset, obtaining labeling data of the bowl forging image dataset, inputting the bowl forging image dataset and the labeling data into a trained preset first network, obtaining low-dimensional characterization of each bowl forging image data, determining new low-dimensional characterization based on the low-dimensional characterization and the labeling data of all bowl forging image data, inputting the new low-dimensional characterization into a decoder, obtaining a new bowl forging image, and completing flaw detection of real-time images of bowl forgings based on the bowl forging image data in the bowl forging image dataset and the new bowl forging image training classification network.

Description

Image recognition-based bowl forging flaw detection method and system
Technical Field
The application relates to the field of flaw detection of pot forgings, in particular to a method and a system for detecting flaw of pot forgings based on image recognition.
Background
Based on the bowl forging image dataset, the classification network can be utilized to finish the non-destructive inspection of the bowl forging, however, when the classification network is trained to perform the bowl forging inspection, the defective bowl forging is a small part of sample data, so that in the training process of the classification network, effective bowl forging defect characteristics are difficult to learn, and the inspection accuracy is insufficient.
In order to solve the problem that the existing pot forging defect data sample is too few, the data set sample can be expanded through smote algorithm in the prior art, and the specific process is as follows: extracting low-dimensional characterization of the bowl forging image dataset to form a feature space, and then generating new low-dimensional characterization in the feature space, so as to obtain a new bowl forging image, and finally expanding the bowl forging image dataset.
However, the bowl forging has a plurality of defect types, so that mixed distribution conditions exist in low-dimensional characterization of different defect types in a feature space, and a new bowl forging image can be a novel defect type, so that the false judgment probability of a flaw detection result is improved when the classification network training is performed by utilizing the new bowl forging image, and the new bowl forging image cannot effectively expand a bowl forging image data set.
Disclosure of Invention
In order to solve the technical problems, the application provides the image recognition-based bowl forging flaw detection method and system, and the low-dimensional characterization distribution limit among different defect types in the feature space is clear when the smote algorithm is used for newly increasing the low-dimensional characterization, so that the effectiveness of the newly increased bowl forging image is ensured, and the accuracy of the nondestructive flaw detection result of the bowl forging is improved.
According to a first aspect of the application, there is provided a method and a system for detecting flaw detection of a bowl forging based on image recognition, comprising: obtaining a bowl forging image dataset, labeling the bowl forging image dataset, obtaining labeling data of all bowl forging images in the bowl forging image dataset, inputting the bowl forging image dataset and the labeling data into a trained preset first network to obtain low-dimensional characterization of each bowl forging image data, wherein the preset first network comprises an encoder and a decoder, determining a new low-dimensional characterization based on the low-dimensional characterization and the labeling data of all bowl forging image data, inputting the new low-dimensional characterization into the decoder to output a new bowl forging image corresponding to the new low-dimensional characterization, and training a classification network based on the bowl forging image data in the bowl forging image dataset and the new bowl forging image to obtain a trained classification network, wherein the input of the trained classification network is a bowl forging real-time image, and outputting a flaw detection result which is a bowl forging real-time image.
In one embodiment, the training method of the preset first network includes: inputting bowl forging image data of a training batch into the encoder to obtain low-dimensional representation of each bowl forging image data in the training batch, inputting the low-dimensional representation of each bowl forging image data into the decoder to obtain a generated image corresponding to the low-dimensional representation, calculating a mean square error loss value of the training batch based on the generated image and the bowl forging image data, dividing all the low-dimensional representations in the training batch based on the marking data to obtain a low-dimensional representation set of each defect type, calculating effective weight of each low-dimensional representation in the low-dimensional representation set of any defect type, constructing a Gaussian model of each defect type according to the low-dimensional representation set of each defect type and the effective weight of each low-dimensional representation, constructing a loss function based on the mean square error loss value and the Gaussian model of all the defect types, reversely transmitting the first network training according to the loss function, updating the preset encoder and the decoder, completing one iteration, setting the new encoder and the decoder to be smaller than the preset value or the number of iteration times until the number of iteration is smaller than the set value or the number of iteration times is reached.
In one embodiment, the bowl forging image dataset acquisition method comprises: and collecting X-ray images of a plurality of pot forgings, carrying out gray-scale treatment on the X-ray images, and taking all the X-ray images subjected to the gray-scale treatment as a pot forgings image data set.
In one embodiment, the calculating the effective weight of each low-dimensional token in the low-dimensional token set for any one of the defect types includes: according to the low-dimensional feature set, calculating the effective weight of each low-dimensional feature, wherein the effective weight meets the relation:
; wherein/> For/>The training batch number/>Efficient weights for individual low-dimensional characterizations,/>For/>Mean square error loss value of each training batch,/>To at/>The number of the neighborhood represented by the low dimension is the number of the neighborhood and the number of the neighborhood is the number of the neighborhood and the number of the/>The number of the low-dimensional characterizations belonging to the same defect type,/>, is equal toAnd (3) setting the maximum value of the neighborhood number of any one low-dimensional token in all low-dimensional tokens.
In one embodiment, the constructing a gaussian model for each defect type from the low-dimensional feature set for each defect type and the effective weight for each low-dimensional feature comprises: according to the effective weight of each low-dimensional characterization in a low-dimensional characterization set of a defect type, calculating a Gaussian model mean value of the defect type, wherein the calculation of the Gaussian model mean value meets the relation:
; wherein/> For/>Gaussian model mean of seed defect types,/>For/>Low-dimensional characterization set of seed defect types/>Low-dimensional representation,/>For/>Low-dimensional characterization set of seed defect types/>Efficient weights for individual low-dimensional characterizations,/>For/>Traversal value of value,/>For/>The number of low-dimensional characterizations in the seed defect type low-dimensional characterization set; calculating the standard deviation of the Gaussian model of the defect type, wherein the calculation of the standard deviation of the Gaussian model meets the relation:
; wherein/> For/>Gaussian model standard deviation of seed defect type,/>For/>Gaussian model mean of seed defect types,/>For/>Low-dimensional characterization set of seed defect types/>Low-dimensional representation,/>For/>Low-dimensional characterization set of seed defect types/>Efficient weights for individual low-dimensional characterizations,/>For/>The value of the traversal of the value,For/>And calculating the mean value and standard deviation of the Gaussian model of the defect type according to the effective weight of each low-dimensional representation in the low-dimensional representation set of the defect type to obtain the Gaussian model of the defect type, and obtaining the Gaussian model of each defect type according to the same method.
In one embodiment, the loss function includes: constructing a loss function based on the mean square error loss value and a Gaussian model of all defect types, wherein the loss function satisfies a relation:
; wherein/> For presetting the first network at the/>Loss function value of bowl forging image data in each training batch,/>For/>Mean square error loss value of generated image and pot forging image data of all low-dimensional characterization in each training batch,/>For/>Between any two Gaussian models/>, in the training process of image data of batch pot forgingsMaximum value of divergence value,/>Is super-parameter,/>Indicating that the maximum value is taken and S is a step function of 0-1.
In one embodiment, the determining a new added low-dimensional characterization based on the low-dimensional characterization and annotation data of all pot forging image data comprises: and classifying the low-dimensional characterizations of all the pot forging image data to obtain effective low-dimensional characterizations, and generating new low-dimensional characterizations according to the effective low-dimensional characterizations and corresponding labeling data by utilizing a data enhancement algorithm.
In one embodiment, the data enhancement algorithm is smote algorithm.
The application also provides a pot forging flaw detection system based on image recognition, which comprises a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions realize the pot forging flaw detection based on the image recognition according to the first aspect of the application when the computer program instructions are executed by the processor.
The technical scheme of the application has the following beneficial technical effects:
According to the technical scheme provided by the application, the effective weight of each low-dimensional representation in each batch of training of a preset first network is obtained, the low-dimensional representation which can effectively represent the original pot forging image data and has clear distribution limit is screened out, a Gaussian model weighted by each defect type is calculated by using the effective weight, so that the Gaussian model distribution of each defect type is more attached to the low-dimensional representation distribution of the high-effective weight of each defect type, a loss function value of the preset first network is constructed based on the Gaussian model, the encoder parameter and the decoder parameter are iteratively updated through counter propagation to complete the preset first network training, the pot forging image dataset is input into the trained preset first network to obtain the low-dimensional representation with obvious distribution limit between each defect type, the expansion quality of the new pot forging image dataset is improved based on the new pot forging image dataset corresponding to the low-dimensional representation, the classification network training set is combined, and the classification network training set is used for training the classification network by using the classification network training set, so that the accuracy of the classification network flaw detection recognition is improved.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present application will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. In the drawings, embodiments of the application are illustrated by way of example and not by way of limitation, and like reference numerals refer to similar or corresponding parts and in which:
FIG. 1 is a flow chart of a method for inspecting a flaw of a pot forging based on image recognition according to an embodiment of the application.
Fig. 2 is a flowchart of a training method for presetting a first network according to an embodiment of the present application.
FIG. 3 is a block diagram of a system for inspecting a flaw of a pot forging based on image recognition according to an embodiment of the application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be understood that when the terms "first," "second," and the like are used in the claims, the specification and the drawings of the present application, they are used merely for distinguishing between different objects and not for describing a particular sequential order. The terms "comprises" and "comprising" when used in the specification and claims of the present application are taken to specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
According to a first aspect of the application, the application provides a method and a system for detecting flaw detection of a pot forging based on image recognition. FIG. 1 is a flow chart of a method for inspecting a flaw of a pot forging based on image recognition according to an embodiment of the application. As shown in fig. 1, the inspection method for the bowl forging includes steps S1 to S5, which are described in detail below.
Step S1, acquiring a pot forging image dataset, labeling the pot forging image dataset, and acquiring labeling data of each pot forging image in the pot forging image dataset.
The method comprises the steps of acquiring X-ray images of each pot forging passing through X-ray equipment in historical time, obtaining X-ray images of a plurality of pot forgings, and carrying out gray-scale treatment on the X-ray images; and taking all the X-ray images after the graying treatment as a pot forging image dataset, and carrying out dataset labeling on the pot forging image dataset.
The labeling of the data set is specifically implemented in such a way that when labeling the image data set of the bowl forging, labeling is carried out at the pixel point level, labeling the label value belonging to the background pixel point is 0, labeling the label value belonging to the non-defective pixel point on the bowl forging main body is 1 through personnel with relevant labeling working experience, and labeling the pixel points of each defect type on the bowl forging main body by adopting the label value which does not repeat with the labeled label value, wherein the label values of the pixel points belonging to the same defect type are consistent.
Therefore, after the bowl forging image dataset is marked, the bowl forging image dataset can be used for dividing the subsequent low-dimensional characterization, so that when the new low-dimensional characterization is ensured, the new low-dimensional characterization is the low-dimensional characterization with less bowl forging image data volume in all defect types.
And S2, inputting the bowl forging image dataset and the labeling data into a trained preset first network to obtain a low-dimensional representation of each bowl forging image data, wherein the preset first network comprises an encoder and a decoder.
Fig. 2 is a flowchart of a training method for presetting a first network according to an embodiment of the application. The first network is preset to be a self-coding network, including an encoder and a decoder. The training method of the preset first network includes steps S201 to S208, which are described in detail below.
S201, inputting bowl forging image data of one training batch into the encoder to obtain low-dimensional representation of each bowl forging image data in the training batch.
In the application, the self-coding network comprises two parts, namely an encoder and a decoder, the encoder and the decoder are both in a multi-layer convolutional neural network structure, the input of the encoder is a pot forging image, the output result of the last adjacent convolutional layer in the encoder is used as the output of the encoder, and the output of the encoder is one by taking the output result of the last convolutional layer in the encoder as the output of the encoderVector data of the dimension; taking the output of the encoder as the input of the decoder, carrying out up-sampling operation on the output of the encoder for a plurality of times to obtain the output of the decoder, wherein the output of the decoder is a bowl forging image which is the same as the input of the encoder, further presetting the encoder of a first network to adopt a self-coding network encoder part, presetting the decoder of the first network to adopt the self-coding network decoder part, adopting a batch training method to carry out preset first network training, and adopting/>, for each training batch, adoptingImage data of individual bowl forgings, will be/>Training batch/>Image data of the individual bowl forgings are input into an encoder, and the output of the encoder/>The low-dimensional representation data can be used for representing the bowl forging image data by further using the low-dimensional representation obtained by the bowl forging image data through the dimension reduction of the encoder, wherein each low-dimensional representation data is one/>Vector data of dimensions, wherein >Taking an experience value of 500, and presetting a first network learning rate/>Empirical value of 0.0001,/>The empirical value was taken to be 20.
Thus, the bowl forging image data of one training batch is input to the encoder to obtain the low-dimensional representation after the corresponding dimension reduction compression, the low-dimensional representation is input to the decoder to obtain the bowl forging image data of the original input encoder, the bowl forging image data of the original input encoder can be represented through the low-dimensional representation, the data processing dimension is reduced, and the efficiency of newly increasing the low-dimensional representation is improved.
S202, inputting low-dimensional representation of each pot forging image data to the decoder to obtain a generated image corresponding to the low-dimensional representation, and calculating a mean square error loss value of the training batch based on the generated image and the pot forging image data.
The method comprises the following steps that after a low-dimensional representation corresponding to each bowl forging image data is input into an encoder, a newly added bowl forging image is obtained, when iteration batches in preset first network training are fewer, larger errors exist between the generated bowl segment image and each bowl forging image data, when the low-dimensional representation with the smaller iteration batches is used for the newly added bowl forging image, bowl forging images with larger actual deviation appear, when the bowl forging images with larger actual deviation are used for classification network training, accuracy of detection of bowl forging flaw detection by the classification network is reduced, and therefore a mean square error loss function calculation formula is utilized to calculate the first bowl forging imageThe mean square error loss value of each training batch is obtained
Therefore, by calculating the mean square error loss value of each training batch, the error amount which can exist between the generated image and the image data of each pot forging can be obtained, valuable low-dimensional characterization screening is facilitated, and the phenomenon that the generated image corresponding to the newly added low-dimensional characterization has larger deviation from the actual pot forging image when the newly added low-dimensional characterization is generated by utilizing the low-value low-dimensional characterization is prevented.
And S203, dividing all low-dimensional characterizations in the training batch based on the labeling data to obtain a low-dimensional characterization set of each defect type.
The specific implementation is that through the step S201, the low-dimensional representation of the image data of each bowl forging in each training batch can be obtained, in step S1, the tag values of all the image data of the bowl forging can be obtained, the preset first network adopts a batch-based training method, the image data of each bowl forging in each training batch is sequentially input into the encoder to obtain the low-dimensional representation corresponding to the image data of each bowl forging, the image data of each bowl forging and the low-dimensional representation are in one-to-one correspondence, the tag values of the image data of each bowl forging are obtained, the low-dimensional representation is divided according to the tag values according to the one-to-one correspondence of the image data of each bowl forging and the low-dimensional representation, and the low-dimensional feature set of the same tag value is obtained, and the low-dimensional feature set of each defect type is obtained because the same defect type is represented by the same tag value.
Therefore, by utilizing the label value corresponding to each low-dimensional representation, each low-dimensional representation can be divided into a low-dimensional representation set corresponding to each defect type according to each defect type, so that the defect type to which the new low-dimensional representation belongs can be effectively adjusted when the new low-dimensional representation is acquired.
S204, for any defect type, calculating the effective weight of each low-dimensional characterization in the low-dimensional characterization set.
The method comprises the steps of enabling low-dimensional characterization sets of different defect types to have obvious boundaries, inputting low-dimensional characterization of mixed distribution into a decoder when low-dimensional characterization distribution in the low-dimensional characterization sets of different defect types is mixed, obtaining newly-added bowl forging image data, enabling the newly-added bowl forging image data to generate novel bowl forging defects which are bowl forging defect characteristics which are unrealistically existing, obtaining all low-dimensional characterization in trained batches for obtaining effective low-dimensional characterization, selecting the low-dimensional characterization close to the centers of the low-dimensional characterization sets for low-dimensional characterization expansion, further determining distribution difference between the low-dimensional characterization and the centers of the low-dimensional characterization sets according to different low-dimensional characterization distribution densities, and further enabling the number of the low-dimensional characterization in the low-dimensional characterization sets to be inconsistent in each batch of training batches according to the preset first network, wherein the maximum value of the distribution density of all low-dimensional characterization is used as a reference standard value of each training batch for evaluating the effectiveness of the low-dimensional characterization in each training batch.
Computing the first in all low-dimensional characterizationsTraining lot number/>The number of neighborhoods represented by the low dimension is the number of neighborhoods in the neighborhood region and the/>The number of the low-dimensional characterizations belonging to the same defect type is calculated by calculating the maximum value/>, of the neighborhood number of any one of the low-dimensional characterizations in all the low-dimensional characterizations set according to the methodWhen/>The larger the representation is, the closer to the center of the low-dimensional feature set to which the low-dimensional representation belongs, the neighborhood region is represented by the/>The lower dimension is characterized as a central circular region, the radius of which takes an empirical value of 2.
For any defect type, calculating the effective weight of each low-dimensional representation according to the low-dimensional representation set of the defect type, wherein the effective weight meets the relation:
; wherein/> For/>The training batch number/>Efficient weights for individual low-dimensional characterizations,/>For/>Mean square error loss value of each training batch,/>To at/>The number of the neighborhood represented by the low dimension is the number of the neighborhood and the number of the neighborhood is the number of the neighborhood and the number of the/>The number of the low-dimensional characterizations belonging to the same defect type,/>, is equal toMaximum value of neighborhood number of any one of the low-dimensional tokens in the set for all low-dimensional tokens,/>Is an exponential function.
When (when)The lower the value of (2) is, the more the first network is preset to be at the (H)The generated images in the training batches and the images of the input bowl forging have smaller errors, and the/>All low-dimensional characterizations obtained by the encoder in each training batch can well characterize the input pot forging image, and the/>When all low-dimensional tokens in the training batches are used for low-dimensional token expansion, the newly added low-dimensional tokens have high reliability, so when/>The lower the value of/>The greater the value of (2).
When (when)The larger the value of (2) is, the more/>The training batch number/>The higher the distribution density of the low-dimensional characterization in the low-dimensional characterization set, the closer to the center of the low-dimensional characterization set, the more the low-dimensional characterization can represent the characteristics of the low-dimensional characterization set, and furtherThe higher the value of/>The greater the value of (2).
The larger the value of (2) is, the more/>, theThe training batch number/>The better the low-dimensional characterization is for the type of defect to which it belongs, the better the effect is for expanding the low-dimensional characterization.
Thus, after the effective weight of each low-dimensional representation is obtained, the low-dimensional representation with high effective weight belongs to the high-value low-dimensional representation, and when the new low-dimensional representation is obtained by utilizing the low-dimensional representation with high effective weight, the deviation between the generated image corresponding to the new low-dimensional representation and the actual pot forging image is smaller.
S205, constructing a Gaussian model of each defect type according to the low-dimensional feature set of each defect type and the effective weight of each low-dimensional feature.
The specific implementation is that through the step S204, the effective weights corresponding to all the low-dimensional characterizations can be obtained, the effect of the low-dimensional characterizations set corresponding to the defect type of the bowl forging to which the characterizations belong can be expressed according to the effective weights of the low-dimensional characterizations, but the distribution limit between the low-dimensional characterizations sets corresponding to different defect types of the bowl forging cannot be guaranteed to be obvious, so that the gaussian model is constructed for each low-dimensional characterizations in the low-dimensional characterizations of one defect type, one gaussian model is utilized to represent the low-dimensional characterizations set of one defect type, and the gaussian model of each defect type is constructed by utilizing the low-dimensional characterizations set of each defect type and the effective weights of each low-dimensional characterizations because the effects of the different low-dimensional characterizations are different when the defect types of the bowl forging to which the characterizations belong.
According to the effective weight of each low-dimensional characterization in a low-dimensional characterization set of a defect type, calculating a Gaussian model mean value of the defect type, wherein the calculation of the Gaussian model mean value meets the relation:
; wherein/> For/>Gaussian model mean of seed defect types,/>For/>Low-dimensional characterization set of seed defect types/>Low-dimensional representation,/>For/>Low-dimensional characterization set of seed defect types/>Efficient weights for individual low-dimensional characterizations,/>For/>Traversal value of value,/>For/>The number of low-dimensional characterizations in the seed defect type low-dimensional characterization set; calculating the standard deviation of the Gaussian model of the defect type, wherein the calculation of the standard deviation of the Gaussian model meets the relation:
; wherein/> For/>Gaussian model standard deviation of seed defect type,/>For/>Gaussian model mean of seed defect types,/>For/>Low-dimensional characterization set of seed defect types/>Low-dimensional representation,/>For/>Low-dimensional characterization set of seed defect types/>Efficient weights for individual low-dimensional characterizations,/>For/>The value of the traversal of the value,For/>The number of low-dimensional characterizations in the defect type low-dimensional characterization set.
Wherein,For/>Gaussian model mean of seed defect type, representing the/>Seed defect type corresponds to all low-dimensional characterization distribution centers in the low-dimensional feature set,/>For/>The standard deviation of the gaussian model of the seed defect type, which in fact also represents the/>The seed defect type corresponds to the degree of dispersion of all low-dimensional characterization distributions within the low-dimensional feature set.
According to the effective weight of each low-dimensional representation in a low-dimensional representation set of a defect type, calculating a Gaussian model mean value and a Gaussian model standard deviation of the defect type to obtain a Gaussian model of the defect type; according to the same method, a gaussian model for each defect type is obtained.
In this way, after the gaussian model of each low-dimensional feature set is weighted by using the effective weight of each low-dimensional feature, each gaussian model represents the distribution of the low-dimensional features of the high effective weight in the corresponding low-dimensional feature set, so that when the distribution difference between the low-dimensional feature sets is represented by using each gaussian model, the low-dimensional feature distribution of the high effective weight is more attached to the low-dimensional feature distribution, and the interference of the low-dimensional feature distribution of the low effective weight in measuring the distribution difference between the low-dimensional feature sets is reduced.
S206, constructing a loss function based on the mean square error loss value and the Gaussian model of all defect types.
The method is concretely implemented, after the Gaussian model of each defect type, the farther the interval between different Gaussian models is, the larger the distribution difference between the different Gaussian models is, the larger the distribution difference of all low-dimensional characterization data in the low-dimensional characterization data set of the defect type corresponding to the different Gaussian models is, and the further the method is utilizedObtaining a divergence calculation formula between any two Gaussian modelsMaximum value of divergence value/>Representing the distribution difference of the low-dimensional characterization data sets corresponding to different defect types when/>When the value is larger, the effect of obtaining the new added low-dimensional characterization when the new added bowl forging defect image is generated by utilizing the low-dimensional characterization generated by the preset first network is better.
However, in the whole scheme calculation process of the application, the preset first network of the 1 st training batch does not have enough low-dimensional representation to participate in calculation, so when the training batch of the preset first network is 1, the mean square error loss function is adopted as the loss function value of the preset first network, and then the loss function value of the preset first network is setIs a step function of 0-1, when/>Time,/>Is 0, when/>Time,/>For/>
The loss function satisfies the relationship:
; wherein/> For presetting the first network at the/>Loss function value of bowl forging image data in each training batch,/>For/>Mean square error loss value of generated image and pot forging image data of all low-dimensional characterization in each training batch,/>For/>Between any two Gaussian models/>, in the training process of image data of batch pot forgingsMaximum value of divergence value,/>Is super-parameter,/>Indicating that the maximum value is taken and S is a step function of 0-1.
Wherein,The smaller the value of (c) is, the clearer the distribution limit between the low-dimensional characterizations of different belonging defect types among the low-dimensional characterizations generated in the preset first network is, and the smaller the error in restoring the input pot forging image data by decoding is.
Furthermore, bowl forging data sets of different batches are sequentially input into a preset first network to obtain each training batchValues.
Thus, the quality of the low-dimensional representation in one training batch is represented by the loss function value of one training batch, if the loss function value of one training batch is larger, the quality of the low-dimensional representation of the training batch is lower, and the preset first network is in the direction of decreasing the loss function value, the parameters of the encoder and the decoder are updated, so that the loss function value of one training batch is utilized, the clearer distribution limit between the low-dimensional representations of different defect types in the next training batch is promoted, and the error in the process of utilizing decoding and restoring the input pot forging image is smaller.
S207, back propagation is carried out on the preset first network training according to the loss function, the encoder and the decoder are updated, and one training is completed.
In particular embodiments, each training batch is utilizedThe value is updated by means of back propagation, presetting the encoder and decoder in the first network.
In this way, by means of back propagation, the parameters of the encoder and decoder can be updated to perform the training of the preset first network.
And S208, iteratively updating the encoder and the decoder until the value of the loss function is smaller than a loss function set value or the iteration number is larger than the set number, so as to obtain a trained preset first network.
In a specific embodiment, the encoder and decoder in the preset first network are continuously updated, and the current latest training batch is updatedA value of less than/>Or/>Greater than/>When the preset first network training is finished, wherein/>For the loss function set value, the loss function set value is 0.01,/>For the set number of times, the set number of times takes a value of 5000.
Thus, the preset first network training is completed by setting the training stop condition of the preset first network, and the preset first network training is used for acquiring the effective low-dimensional representation so as to acquire the new low-dimensional representation through a data enhancement algorithm.
And step S3, determining a new added low-dimensional representation based on the low-dimensional representation and the labeling data of all the pot forging image data.
The method is concretely implemented, through a trained preset first network model, the low-dimensional representation corresponding to each bowl forging image can be obtained, wherein each low-dimensional representation is oneThe dimension vector is used for constructing the feature space, but not all low-dimension representations can be used for constructing the feature space, because the low-dimension representation is obtained by the iterative training method through the preset first network, and then effective low-dimension representations need to be screened for constructing the feature space, and effective weight utilization/>, of all the low-dimension representations is achievedThe algorithm performs two classifications, set/>The algorithm classification number is 2, classifying low-dimensional tokens with approximate effective weight values into one class, acquiring the average value of effective weights corresponding to all low-dimensional tokens in two classes, selecting a classification class with a larger average value as an effective class, acquiring all low-dimensional tokens in the effective class as effective low-dimensional tokens, and constructing one/>, by using the effective low-dimensional tokensThe feature space of the dimension, and because the label value of each effective low-dimension representation is known, the new low-dimension representation is obtained by utilizing the existing data enhancement algorithm in the feature space, and the application sets the upper limit of the number of the new low-dimension representation as/>When the number of newly added low-dimensional characterizations is equal to/>When the method stops adding the effective low-dimensional characterization, wherein the method selects smote algorithm as data enhancement algorithm,/>The empirical value was taken to be 500.
The smote algorithm is a comprehensive sampling artificial data synthesis algorithm, which is used for solving the problem of unbalanced data types, synthesizing data in a mode of combining minority classes and majority classes, and preferentially generating minority classes of data.
Therefore, the low-dimensional characterization in all training rounds can be obtained through presetting the first network, and the feature space is constructed through screening the low-dimensional characterization with high effective weight, so that the effectiveness of the newly added low-dimensional characterization is ensured, and the deviation between the corresponding generated image of the newly added low-dimensional characterization and the actual pot forging image is reduced.
And S4, inputting the new low-dimensional representation into the decoder to output a new bowl forging image corresponding to the new low-dimensional representation.
The method comprises the steps of obtaining a decoder in a preset first network after training, inputting new low-dimensional representation into the decoder, outputting a corresponding generated image by the decoder, wherein the generated image is a new bowl forging image corresponding to the new low-dimensional representation.
Therefore, by means of the new added low-dimensional characterization, the new added bowl forging images are obtained, the training data set is expanded when the bowl forging images are used for training of the classification network, and the problem that the defect flaw detection and judgment accuracy of the classification network on the bowl forging is insufficient due to the fact that the number of the bowl forging images of each defect type is small is solved.
And S5, training a classification network based on the bowl forging image data in the bowl forging image data set and the newly added bowl forging image to obtain a trained classification network, wherein the input of the trained classification network is a real-time image of the bowl forging, and outputting a flaw detection result which is the real-time image of the bowl forging.
The method comprises the steps of obtaining a newly-added bowl forging image obtained in the step S4, marking the newly-added bowl forging image by utilizing a marking data method in the step S1, merging the marked newly-added bowl forging image and the marked bowl forging image data set into a classification network training set, selecting a VGG19 network as a classification network, wherein the classification network is a convolution network, different label values in the classification network training set represent different bowl forging defect types in the classification network, the classification network adopts a multi-type cross entropy loss function for classification network training, the learning rate of the classification network takes a tested value of 0.001, the training round is 10000, after training of the classification network is completed, the X-ray imaging gray level image of the real-time collected bowl forging is input into the trained classification network, the output type of the classification network is obtained, and the defect type of the bowl forging is obtained according to the output type of the classification network, so that the defect detection of the bowl forging belongs to the bowl forging is completed.
Thus, the flaw detection method for the bowl forging based on image recognition is completed. The classification network trained by all the steps of the application has higher accuracy in judging the flaw detection type when used for detecting the flaw detection of the bowl forging, and has higher efficiency in judging the flaw detection type because the classification network is an end-to-end model.
The embodiment of the application also discloses a pot forging flaw detection system based on image recognition, and fig. 3 is a structural block diagram of the pot forging flaw detection system based on image recognition according to the embodiment of the application, and as shown in fig. 3, the pot forging flaw detection system comprises a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the pot forging flaw detection method based on image recognition according to the application is realized.
The above system further comprises other components well known to those skilled in the art, such as a communication bus and a communication interface, the arrangement and function of which are known in the art and therefore are not described in detail herein.
In the context of this patent, the foregoing memory may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, the computer-readable storage medium may be any suitable magnetic or magneto-optical storage medium, such as, for example, resistance change Memory RRAM (Resistive Random Access Memory), dynamic Random Access Memory DRAM (Dynamic Random Access Memory), static Random Access Memory SRAM (Static Random-Access Memory), enhanced dynamic Random Access Memory EDRAM (ENHANCED DYNAMIC Random Access Memory), high-Bandwidth Memory HBM (High-Bandwidth Memory), hybrid storage cube HMC (Hybrid Memory Cube), or any other medium that may be used to store the desired information and that may be accessed by an application, a module, or both. Any such computer storage media may be part of, or accessible by, or connectable to, the device.
While various embodiments of the present application have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Many modifications, changes, and substitutions will now occur to those skilled in the art without departing from the spirit and scope of the application. It should be understood that various alternatives to the embodiments of the application described herein may be employed in practicing the application.
The above embodiments are not intended to limit the scope of the present application, so: all equivalent changes in structure, shape and principle of the application should be covered in the scope of protection of the application.

Claims (5)

1. The image identification-based flaw detection method for the pot forging is characterized by comprising the following steps of:
acquiring a pot forging image dataset, labeling the pot forging image dataset, and acquiring labeling data of each pot forging image in the pot forging image dataset;
Inputting the bowl forging image dataset and the annotation data into a trained preset first network to obtain a low-dimensional representation of each bowl forging image data, wherein the preset first network comprises an encoder and a decoder;
Determining a new added low-dimensional representation based on the low-dimensional representation and the labeling data of all the pot forging image data;
Inputting the new low-dimensional representation into the decoder to output a new bowl forging image corresponding to the new low-dimensional representation;
Training a classification network based on the bowl forging image data in the bowl forging image data set and the newly added bowl forging image to obtain a trained classification network, wherein the input of the trained classification network is a real-time image of the bowl forging, and the input is a flaw detection result of the real-time image of the bowl forging;
The training method of the preset first network comprises the following steps:
inputting bowl forging image data of one training batch into the encoder to obtain low-dimensional characterization of the image data of each bowl forging in the training batch;
Inputting the low-dimensional representation of each bowl forging image data into the decoder to obtain a generated image corresponding to the low-dimensional representation, and calculating a mean square error loss value of the training batch based on the generated image and the bowl forging image data;
Dividing all low-dimensional characterizations in the training batch based on the labeling data to obtain a low-dimensional characterization set of each defect type;
For any defect type, calculating the effective weight of each low-dimensional token in the low-dimensional token set;
constructing a Gaussian model of each defect type according to the low-dimensional feature set of each defect type and the effective weight of each low-dimensional feature;
constructing a loss function based on the mean square error loss value and a Gaussian model of all defect types;
The preset first network training is conducted in a counter-propagation mode according to the loss function, the encoder and the decoder are updated, and one training is completed;
Iteratively updating the encoder and the decoder until the value of the loss function is smaller than a set value or the iteration number is larger than the set number, so as to obtain a trained preset first network;
The calculating the effective weight of each low-dimensional token in the low-dimensional token set for any one of the defect types includes:
according to the low-dimensional feature set of the defect type, calculating the effective weight of each low-dimensional feature, wherein the effective weight meets the relation:
; wherein/> For/>The training batch number/>Efficient weights for individual low-dimensional characterizations,/>For/>Mean square error loss value of each training batch,/>To at/>The number of the neighborhood represented by the low dimension is the number of the neighborhood and the number of the neighborhood is the number of the neighborhood and the number of the/>The number of the low-dimensional characterizations belonging to the same defect type,/>, is equal toA maximum value of the number of neighborhoods of any one low-dimensional token in all low-dimensional token sets;
the constructing a gaussian model for each defect type from the low-dimensional feature set for each defect type and the effective weight for each low-dimensional characterization includes:
according to the effective weight of each low-dimensional characterization in a low-dimensional characterization set of a defect type, calculating a Gaussian model mean value of the defect type, wherein the calculation of the Gaussian model mean value meets the relation:
; wherein/> For/>Gaussian model mean of seed defect types,/>For/>Low-dimensional characterization set of seed defect types/>Low-dimensional representation,/>For/>Low-dimensional characterization set of seed defect types/>Efficient weights for individual low-dimensional characterizations,/>For/>Traversal value of value,/>For/>The number of low-dimensional characterizations in the seed defect type low-dimensional characterization set;
Calculating the standard deviation of the Gaussian model of the defect type, wherein the calculation of the standard deviation of the Gaussian model meets the relation:
; wherein/> For/>Gaussian model standard deviation of seed defect type,/>For/>Gaussian model mean of seed defect types,/>For/>Low-dimensional characterization set of seed defect types/>Low-dimensional representation,/>For/>Low-dimensional characterization set of seed defect types/>Efficient weights for individual low-dimensional characterizations,/>For/>Traversal value of value,/>For/>The number of low-dimensional characterizations in the seed defect type low-dimensional characterization set;
According to the effective weight of each low-dimensional representation in a low-dimensional representation set of a defect type, calculating a Gaussian model mean value and a Gaussian model standard deviation of the defect type to obtain a Gaussian model of the defect type;
according to the same method, a Gaussian model of each defect type is obtained;
the loss function satisfies the relationship:
; wherein/> For presetting the first network at the/>Loss function value of bowl forging image data in each training batch,/>For/>Mean square error loss value of generated image and pot forging image data of all low-dimensional characterization in each training batch,/>For/>Between any two Gaussian models/>, in the training process of image data of batch pot forgingsMaximum value of divergence value,/>Is super-parameter,/>Indicating that the maximum value is taken and S is a step function of 0-1.
2. The image recognition-based pot forging flaw detection method according to claim 1, wherein the acquiring of the pot forging image dataset comprises:
collecting X-ray images of a plurality of pot forgings, and carrying out graying treatment on the X-ray images;
and taking all X-ray images after the graying treatment as a pot forging image data set.
3. The image recognition-based pot forging flaw detection method according to claim 1, wherein the determining of the new low-dimensional characterization based on the low-dimensional characterization and labeling data of all pot forging image data comprises:
And classifying the low-dimensional characterizations of all the pot forging image data to obtain effective low-dimensional characterizations, and generating new low-dimensional characterizations according to the effective low-dimensional characterizations and corresponding labeling data by utilizing a data enhancement algorithm.
4. The image recognition-based pot forging flaw detection method according to claim 3, wherein the data enhancement algorithm is smote algorithm.
5. Image recognition-based bowl forging flaw detection system, which is characterized by comprising:
A processor; and a memory storing computer instructions for an image recognition based pot forging inspection method, which when executed by the processor, cause an apparatus to perform the image recognition based pot forging inspection method of any one of claims 1-4.
CN202410381654.7A 2024-04-01 2024-04-01 Image recognition-based bowl forging flaw detection method and system Active CN117974664B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410381654.7A CN117974664B (en) 2024-04-01 2024-04-01 Image recognition-based bowl forging flaw detection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410381654.7A CN117974664B (en) 2024-04-01 2024-04-01 Image recognition-based bowl forging flaw detection method and system

Publications (2)

Publication Number Publication Date
CN117974664A CN117974664A (en) 2024-05-03
CN117974664B true CN117974664B (en) 2024-06-11

Family

ID=90853935

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410381654.7A Active CN117974664B (en) 2024-04-01 2024-04-01 Image recognition-based bowl forging flaw detection method and system

Country Status (1)

Country Link
CN (1) CN117974664B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019178291A1 (en) * 2018-03-13 2019-09-19 Genetic Intelligence, Inc. Methods for data segmentation and identification
CN111488882A (en) * 2020-04-10 2020-08-04 视研智能科技(广州)有限公司 High-precision image semantic segmentation method for industrial part measurement
CN112001903A (en) * 2020-08-21 2020-11-27 深圳市华汉伟业科技有限公司 Defect detection network construction method, abnormality detection method and system, and storage medium
CN112577743A (en) * 2020-11-06 2021-03-30 中国矿业大学 Rolling bearing fault diagnosis method based on maximum local boundary criterion
CN114897817A (en) * 2022-05-09 2022-08-12 昆明理工大学 Forging defect rapid target detection method based on neural network
CN116485767A (en) * 2023-04-26 2023-07-25 长安大学 Pavement crack image detection method and system based on image classification and segmentation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019178291A1 (en) * 2018-03-13 2019-09-19 Genetic Intelligence, Inc. Methods for data segmentation and identification
CN111488882A (en) * 2020-04-10 2020-08-04 视研智能科技(广州)有限公司 High-precision image semantic segmentation method for industrial part measurement
CN112001903A (en) * 2020-08-21 2020-11-27 深圳市华汉伟业科技有限公司 Defect detection network construction method, abnormality detection method and system, and storage medium
CN112577743A (en) * 2020-11-06 2021-03-30 中国矿业大学 Rolling bearing fault diagnosis method based on maximum local boundary criterion
CN114897817A (en) * 2022-05-09 2022-08-12 昆明理工大学 Forging defect rapid target detection method based on neural network
CN116485767A (en) * 2023-04-26 2023-07-25 长安大学 Pavement crack image detection method and system based on image classification and segmentation

Also Published As

Publication number Publication date
CN117974664A (en) 2024-05-03

Similar Documents

Publication Publication Date Title
CN112241766A (en) Liver CT image multi-lesion classification method based on sample generation and transfer learning
CN112258470B (en) Intelligent industrial image critical compression rate analysis system and method based on defect detection
CN114048468A (en) Intrusion detection method, intrusion detection model training method, device and medium
CN112819821A (en) Cell nucleus image detection method
CN112017161A (en) Pulmonary nodule detection method and device based on central point regression
CN114639102B (en) Cell segmentation method and device based on key point and size regression
CN113112447A (en) Tunnel surrounding rock grade intelligent determination method based on VGG convolutional neural network
CN115391561A (en) Method and device for processing graph network data set, electronic equipment, program and medium
CN107908807B (en) Small subsample reliability evaluation method based on Bayesian theory
CN115908142A (en) Contact net tiny part damage testing method based on visual recognition
CN114463300A (en) Steel surface defect detection method, electronic device, and storage medium
CN112766381B (en) Attribute-guided SAR image generation method under limited sample
CN114511521A (en) Tire defect detection method based on multiple representations and multiple sub-field self-adaption
CN117974664B (en) Image recognition-based bowl forging flaw detection method and system
CN113313021A (en) Deep learning model construction method based on low-quality image recognition
WO2021237682A1 (en) Display panel detection device and detection method, electronic device, and readable medium
CN117495786A (en) Defect detection meta-model construction method, defect detection method, device and medium
CN115759291B (en) Spatial nonlinear regression method and system based on ensemble learning
CN116826734A (en) Photovoltaic power generation power prediction method and device based on multi-input model
US12094147B2 (en) Estimating a thickness of cortical region by extracting a plurality of interfaces as mesh data
CN110781755A (en) Intelligent identification and metering method and system for construction steel bars
CN114842192A (en) Aero-engine blade damage identification model, damage identification method and system
CN109657795B (en) Hard disk failure prediction method based on attribute selection
CN113341890A (en) Intelligent diagnosis method and system oriented to cooperation of adaptive scheduling and unmanned production line
CN117496162B (en) Method, device and medium for removing thin cloud of infrared satellite remote sensing image

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
GR01 Patent grant
GR01 Patent grant