Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for training a flaw detection model, which are used for improving the detection accuracy of the trained flaw detection model.
The invention provides a training method of a flaw detection model, which comprises the following steps: receiving a data transmission request sent by a terminal, determining data to be uploaded according to the data transmission request, and performing data uploading catalog structure verification on the data to be uploaded to obtain a detection result; generating an uploading strategy of the data to be uploaded according to the inspection result, and uploading the data to be uploaded according to the uploading strategy to obtain uploaded data; calling a preset data labeling tool to perform data labeling on the uploaded data and generating a training data set corresponding to the uploaded data; performing data enhancement processing on the training data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw labels; acquiring a deep learning network to be trained, and inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection respectively to generate a feature map corresponding to each sample picture; and performing parameter optimization on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network is converged to obtain a flaw detection model.
Optionally, in a first implementation manner of the first aspect of the present invention, the receiving a data transmission request sent by a terminal, determining data to be uploaded according to the data transmission request, and performing data upload directory structure verification on the data to be uploaded to obtain a verification result, including: receiving a data transmission request sent by a terminal; inquiring data to be uploaded according to the data transmission request; judging whether the data transmission request carries a specified directory or not so as to verify a data uploading directory structure; if the data transmission request is carried, inquiring a directory folder carried by the data transmission request, and generating a detection result according to the directory folder; and if not, generating a test result corresponding to the data to be uploaded based on a preset auditing mechanism.
Optionally, in a second implementation manner of the first aspect of the present invention, the invoking a preset data tagging tool to perform data tagging on the uploaded data and generate a training data set corresponding to the uploaded data includes: performing data inspection on the uploaded data, and removing error data in the uploaded data to obtain standard data; marking the standard data through a preset data marking tool to obtain marked standard data; dividing the marked standard data into positive sample data and negative sample data according to a preset proportion; and generating a training data set corresponding to the uploaded data by using the positive sample data and the negative sample data.
Optionally, in a third implementation manner of the first aspect of the present invention, the performing data enhancement processing on the training data set to generate an enhanced data set, where the enhanced data set includes a plurality of sample pictures with flaw labels, and includes: acquiring a plurality of defective pictures and good pictures to automatically expand the training data set to obtain an expanded data set; and performing characteristic adjustment on the extended data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw marks.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the obtaining a deep learning network to be trained, and inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection, and generating a feature map corresponding to each sample picture includes: obtaining a deep learning network to be trained, wherein the deep learning network comprises: an input layer, a multilayer convolution network, a weight layer and an output layer; respectively inputting the plurality of sample pictures with flaw marks into the input layer for processing to obtain an input picture corresponding to each sample picture; respectively inputting the input pictures into the multilayer convolution network for feature extraction to obtain a prediction picture corresponding to each sample picture; inputting the prediction graph corresponding to each sample picture into the weight layer to carry out flaw weight processing, and obtaining a weight graph corresponding to each sample picture, wherein the weight graph and the prediction graph have the same size; and generating a characteristic diagram corresponding to the weight diagram through the output layer to obtain a characteristic diagram corresponding to each sample picture.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the performing parameter tuning on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network converges to obtain a flaw detection model includes: calling a preset loss function to calculate a loss value between the feature map and the sample picture; judging whether the loss value exceeds a preset target value or not; if the loss value does not exceed the preset value, carrying out reverse propagation of random gradient downward on the deep learning network according to the loss value and updating parameters in the deep learning network to obtain a parameter-updated deep learning network; acquiring a sample picture, inputting the sample picture into the deep learning network with the updated parameters for network convergence verification, and generating a verification result of the deep learning network with the updated parameters; and if the verification result is that the deep learning network after the parameter updating is converged, taking the deep learning network after the parameter updating as a flaw detection model.
The second aspect of the present invention provides a training apparatus for a flaw detection model, including: the receiving module is used for receiving a data transmission request sent by a terminal, determining data to be uploaded according to the data transmission request, and verifying a data uploading directory structure of the data to be uploaded to obtain a detection result; the uploading module is used for generating an uploading strategy of the data to be uploaded according to the inspection result and uploading the data to be uploaded according to the uploading strategy to obtain uploaded data; the marking module is used for calling a preset data marking tool to carry out data marking on the uploaded data and generating a training data set corresponding to the uploaded data; the enhancement module is used for carrying out data enhancement processing on the training data set to generate an enhanced data set, and the enhanced data set comprises a plurality of sample pictures with flaw labels; the detection module is used for acquiring a deep learning network to be trained, inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection, and generating a feature map corresponding to each sample picture; and the parameter tuning module is used for performing parameter tuning on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network converges to obtain a flaw detection model.
Optionally, in a first implementation manner of the second aspect of the present invention, the receiving module is specifically configured to: receiving a data transmission request sent by a terminal; inquiring data to be uploaded according to the data transmission request; judging whether the data transmission request carries a specified directory or not so as to verify a data uploading directory structure; if the data transmission request is carried, inquiring a directory folder carried by the data transmission request, and generating a detection result according to the directory folder; and if not, generating a test result corresponding to the data to be uploaded based on a preset auditing mechanism.
Optionally, in a second implementation manner of the second aspect of the present invention, the labeling module is specifically configured to: performing data check on the uploaded data, and removing error data in the uploaded data to obtain standard data; marking the standard data through a preset data marking tool to obtain marked standard data; dividing the marked standard data into positive sample data and negative sample data according to a preset proportion; and generating a training data set corresponding to the uploaded data by using the positive sample data and the negative sample data.
Optionally, in a third implementation manner of the second aspect of the present invention, the enhancing module further includes: the acquisition unit is used for acquiring a plurality of defective pictures and good pictures to automatically expand the training data set to obtain an expanded data set; and the enhancement unit is used for carrying out characteristic adjustment on the expansion data set to generate an enhancement data set, and the enhancement data set comprises a plurality of sample pictures with flaw marks.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the detection module is specifically configured to: obtaining a deep learning network to be trained, wherein the deep learning network comprises: an input layer, a multilayer convolutional network, a weight layer and an output layer; inputting the plurality of sample pictures with the flaw marks into the input layer for processing to obtain an input picture corresponding to each sample picture; respectively inputting the input pictures into the multilayer convolution network for feature extraction to obtain a prediction picture corresponding to each sample picture; inputting the prediction graph corresponding to each sample picture into the weight layer to carry out flaw weight processing, and obtaining a weight graph corresponding to each sample picture, wherein the weight graph and the prediction graph have the same size; and generating a characteristic diagram corresponding to the weight diagram through the output layer to obtain a characteristic diagram corresponding to each sample picture.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the parameter tuning module is specifically configured to: calling a preset loss function to calculate a loss value between the feature map and the sample picture; judging whether the loss value exceeds a preset target value or not; if the loss value does not exceed the preset loss value, carrying out reverse propagation of random gradient downward on the deep learning network according to the loss value and updating parameters in the deep learning network to obtain the deep learning network after parameter updating; acquiring a sample picture, inputting the sample picture into the deep learning network with the updated parameters for network convergence verification, and generating a verification result of the deep learning network with the updated parameters; and if the verification result is that the deep learning network after the parameter updating is converged, taking the deep learning network after the parameter updating as a flaw detection model.
The third aspect of the present invention provides a training device for a flaw detection model, comprising: a memory and at least one processor, the memory having instructions stored therein; the at least one processor calls the instructions in the memory to cause the training device of the flaw detection model to execute the above-mentioned training method of the flaw detection model.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-described method of training a flaw detection model.
In the technical scheme provided by the invention, a data transmission request sent by a terminal is received, data to be uploaded is determined according to the data transmission request, and data uploading directory structure verification is carried out on the data to be uploaded to obtain a detection result; generating an uploading strategy of the data to be uploaded according to the inspection result, uploading the data to be uploaded according to the uploading strategy to obtain uploaded data, wherein the data can be uploaded only after being labeled, and an auditing mechanism is provided for the labeled data, so that the safety of a data set is improved; calling a preset data labeling tool to perform data labeling on the uploaded data and generating a training data set corresponding to the uploaded data; performing data enhancement processing on the training data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw labels; acquiring a deep learning network to be trained, and inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection respectively to generate a feature map corresponding to each sample picture; and performing parameter optimization on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network is converged to obtain a flaw detection model. According to the method, the data enhancement processing is performed on the data set in the defect detection model training process, the richness of the training data set is improved through the data enhancement processing, and the detection accuracy of the trained defect detection model is effectively improved through training the defect detection model through the data set after the data enhancement processing.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for training a flaw detection model, which are used for improving the detection accuracy of the trained flaw detection model. The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Moreover, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For understanding, a specific flow of an embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a method for training a fault detection model according to an embodiment of the present invention includes:
101. receiving a data transmission request sent by a terminal, determining data to be uploaded according to the data transmission request, and performing data uploading catalog structure verification on the data to be uploaded to obtain a detection result;
it is to be understood that the execution subject of the present invention may be a training apparatus of the flaw detection model, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
Optionally, the server receives a data transmission request sent by the terminal; inquiring data to be uploaded according to the data transmission request; judging whether the data transmission request carries a specified directory to verify a data uploading directory structure; if the data transmission request is carried, inquiring a directory folder carried by the data transmission request, and generating a detection result according to the directory folder; and if the data to be uploaded does not carry the data, generating a test result corresponding to the data to be uploaded based on a preset auditing mechanism.
Specifically, the server verifies a data upload directory structure in the data transmission process, specifically verifies whether the data transmission request carries a directory specified for upload, where the directory includes: a primary directory and a root directory. If the data transmission request carries the directory folder, the server inquires the directory folder carried by the data transmission request and generates a detection result according to the directory folder, wherein the detection result is used for indicating that the data transmission request carries the specified directory; if the server does not carry the data, the server generates a test result corresponding to the data to be uploaded based on a preset auditing mechanism, specifically, the server sends the data to be uploaded back to an auditor, and the uploaded data is manually subjected to catalog storage.
102. Generating an uploading strategy of the data to be uploaded according to the inspection result, and uploading the data to be uploaded according to the uploading strategy to obtain uploaded data;
specifically, the server generates an uploading policy of the data to be uploaded according to the inspection result, and uploads the data to be uploaded according to the uploading policy to obtain the uploaded data, and further, the uploading policy specifically includes: if the data to be uploaded does not specify a primary directory (train/test), the data to be uploaded can only be uploaded to the lower part of a/data/unlabeled/folder; if the directory to be uploaded specifies a root directory (/ data /), the directory structure needs to be complied with, and the root directory, the primary directory and the secondary directory structure need to be checked in sequence:
/data/train/{class_xx,class_yy,class_...};
/data/test/{class_xx,class_yy,class_...}。
furthermore, the server can also perform breakpoint continuous transmission on the data to be uploaded, namely the server skips the uploaded data and covers all the data in the folder; the server provides an auditing mechanism for the marked data, the data to be uploaded is uploaded after approval by an auditor, and in addition, the data can be directly uploaded/data/{ train | test }/folder after marking; the unlabeled data can only be uploaded to the information of/data/unsowwn/".
103. Calling a preset data labeling tool to perform data labeling on the uploaded data and generating a training data set corresponding to the uploaded data;
optionally, the server performs data check on the uploaded data, and removes error data in the uploaded data; obtaining standard data; marking the standard data through a preset data marking tool to obtain marked standard data; dividing the marked standard data into positive sample data and negative sample data according to a preset proportion; and generating a training data set corresponding to the uploaded data by using the positive sample data and the negative sample data.
Specifically, the server performs data information labeling on the uploaded data through a preset data labeling tool, the data labeling tool can be a Labellmg tool, the data labeling tool executes an open file command at first, then selects a defect area in the uploaded data, inputs a category name in a create rectangle box, and finally generates an xml file under a path for storing the file, wherein the name of the xml file is consistent with the name of a labeled picture, and when the picture is labeled, the category name is represented by a lower case letter. In addition, the server can also label semi-automatically aiming at different scenes, for example, segmentation labeling can be automatically completed after automatic generation of defective pictures, the pictures are preliminarily screened by adopting a clustering algorithm or a classification algorithm when the pictures are disordered, and the server performs automatic data cleaning after the pictures are labeled. Further, the server marks the catalog and marks the whole catalog; the server corrects the data of the individual data; and the server labels the data in the whole folder one by one. The server divides the marked standard data into positive sample data and negative sample data according to a preset proportion, wherein the proportion can be 20% of the negative sample data and 80% of the positive sample data; the server takes the positive sample data and the negative sample data as training data sets.
104. Performing data enhancement processing on the training data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw labels;
optionally, the server obtains a plurality of defective pictures and good-quality pictures to automatically expand the training data set to obtain an expanded data set; and performing characteristic adjustment on the expansion data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw marks.
Specifically, the server enhances the number and quality of samples by automatic algorithm expansion: the server automatically expands the training data set, extracts real flaws on the picture with the flaws, adjusts the characteristics of the picture, generates rich flaw pictures, and can automatically expand the picture to generate a good product picture. Further, data enhancement may enable the flaw detection model to have a stronger detection capability faster.
105. Acquiring a deep learning network to be trained, and inputting a plurality of sample pictures with flaw labels into the deep learning network for flaw detection to generate a feature map corresponding to each sample picture;
optionally, the server obtains a deep learning network to be trained, where the deep learning network includes: an input layer, a multilayer convolutional network, a weight layer and an output layer; respectively inputting a plurality of sample pictures with flaw marks into an input layer for processing to obtain an input picture corresponding to each sample picture; respectively inputting the input pictures into a multilayer convolution network for feature extraction to obtain a prediction picture corresponding to each sample picture; respectively inputting the prediction graph corresponding to each sample picture into a weight layer for flaw weight processing to obtain a weight graph corresponding to each sample picture, wherein the weight graph and the prediction graph have the same size; and generating a feature map corresponding to the weight map through the output layer to obtain a feature map corresponding to each sample picture.
The deep learning network includes an input layer, where the input layer is used to perform processing such as contrast enhancement on the sample picture, so as to make a defective region in the sample picture more easily appear; the multi-layer convolutional network comprises a plurality of convolutional layers, each convolutional layer consists of a convolutional core, a BN (Batch Normalization) layer and a LeakyRelu layer, the specification of the convolutional core is 3x3, the step length is 2, the BN layer can accelerate the training speed and improve the generalization capability of the network, and the last Leaky Relu layer is an activation function and can be transmitted to the next network node only when the input value reaches a certain numerical range, so that the obvious characteristic is transmitted to the next node, and the characteristic extraction is realized; and the weight layer is accessed behind the neural network and is subjected to dot multiplication with the characteristic diagram output by the neural network through the weight layer, so that the weight of the position with the flaw in the characteristic diagram output by the neural network is improved. In the final feature map obtained in this way, the position corresponding to the maximum value in the matrix corresponding to the final feature map may be the position of the flaw in the picture with a high probability. Therefore, the defect position detection in the defect detection process is realized to a certain extent, and the problem that the position information of the defect in the picture is not reflected in the current defect detection process is solved; the output layer is used for outputting the feature map. The server inputs the prediction graph corresponding to each sample picture into the weight layer to carry out flaw weight processing to obtain a weight graph corresponding to each sample picture, wherein the weight graph and the prediction graph have the same size; and generating a feature map corresponding to the weight map through the output layer to obtain the feature map corresponding to each sample picture.
106. And performing parameter optimization on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network is converged to obtain a flaw detection model.
Optionally, the server calls a preset loss function to calculate a loss value between the feature map and the sample picture; judging whether the loss value exceeds a preset target value or not; if the loss value does not exceed the preset threshold value, carrying out reverse propagation of random gradient downward on the deep learning network according to the loss value and updating parameters in the deep learning network to obtain the deep learning network after the parameters are updated; acquiring a sample picture, inputting the sample picture into the deep learning network with updated parameters for network convergence verification, and generating a verification result of the deep learning network with updated parameters; and if the verification result is that the deep learning network after the parameter updating is converged, taking the deep learning network after the parameter updating as a flaw detection model.
Specifically, the server performs targeted network optimization and parameter optimization on the deep learning network, so that the trained model has great improvement and improvement on the detected missed-kick rate and the false-kick rate, wherein the main purpose of the loss function is to calculate the difference between the prediction result and the labeling information. The difference between the prediction result and the labeling information can be quantified through the loss value, so that the parameters of the model can be conveniently adjusted subsequently and can be learned. And reversely propagating the loss value back to the deep learning network, and then carrying out random gradient descent on the deep learning network by the server through the optimizer so as to realize parameter optimization. There are different optimizers in the stochastic Gradient Descent, such as BGD (Batch Gradient Description), SDG (Stochastic Gradient Description), MBGD (Mini-Batch Gradient Description). The optimized optimizer in the scheme is an SGD optimizer. The SGD is updated only once, no redundancy exists, the speed is high, and a new sample can be added. And when the parameter optimization of the deep learning network is completed, verifying the model after the parameter optimization by adopting a verification picture, and if the loss value between the output of the deep learning network after the parameter updating and the pre-marked information picture is less than a preset loss threshold value, taking the deep learning network after the parameter updating as a flaw detection model.
In the embodiment of the invention, a data transmission request sent by a terminal is received, data to be uploaded is determined according to the data transmission request, and data uploading directory structure verification is carried out on the data to be uploaded to obtain a detection result; generating an uploading strategy of the data to be uploaded according to the inspection result, uploading the data to be uploaded according to the uploading strategy to obtain uploaded data, wherein the data can be uploaded only after being labeled, and an auditing mechanism is provided for the labeled data, so that the safety of a data set is improved; calling a preset data labeling tool to perform data labeling on the uploaded data and generating a training data set corresponding to the uploaded data; performing data enhancement processing on the training data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw labels; acquiring a deep learning network to be trained, and inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection respectively to generate a feature map corresponding to each sample picture; and performing parameter optimization on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network is converged to obtain a flaw detection model. According to the method, the data enhancement processing is carried out on the data set in the defect detection model training process, the richness of the training data set is improved through the data enhancement processing, and the detection accuracy of the trained defect detection model is effectively improved through training the defect detection model through the data set after the data enhancement.
With reference to fig. 2, the method for training a fault detection model in an embodiment of the present invention is described above, and a training apparatus for a fault detection model in an embodiment of the present invention is described below, where an embodiment of the training apparatus for a fault detection model in an embodiment of the present invention includes:
the receivingmodule 201 is configured to receive a data transmission request sent by a terminal, determine data to be uploaded according to the data transmission request, and perform data upload directory structure verification on the data to be uploaded to obtain a verification result;
theuploading module 202 is configured to generate an uploading policy of the data to be uploaded according to the inspection result, and upload the data to be uploaded according to the uploading policy to obtain uploaded data;
the markingmodule 203 is configured to call a preset data marking tool to perform data marking on the uploaded data and generate a training data set corresponding to the uploaded data;
anenhancement module 204, configured to perform data enhancement processing on the training data set to generate an enhanced data set, where the enhanced data set includes a plurality of sample pictures with flaw labels;
thedetection module 205 is configured to obtain a deep learning network to be trained, and input the plurality of sample pictures with the flaw labels into the deep learning network for flaw detection, so as to generate a feature map corresponding to each sample picture;
and theparameter tuning module 206 is configured to perform parameter tuning on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network converges to obtain a flaw detection model.
In the embodiment of the invention, a data transmission request sent by a terminal is received, data to be uploaded is determined according to the data transmission request, and data uploading directory structure verification is carried out on the data to be uploaded to obtain a detection result; generating an uploading strategy of the data to be uploaded according to the inspection result, uploading the data to be uploaded according to the uploading strategy to obtain uploaded data, wherein the data can be uploaded only after being labeled, and an auditing mechanism is provided for the labeled data, so that the safety of a data set is improved; calling a preset data labeling tool to perform data labeling on the uploaded data and generating a training data set corresponding to the uploaded data; performing data enhancement processing on the training data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw labels; acquiring a deep learning network to be trained, and inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection respectively to generate a feature map corresponding to each sample picture; and performing parameter optimization on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network is converged to obtain a flaw detection model. According to the method, the data enhancement processing is performed on the data set in the defect detection model training process, the richness of the training data set is improved through the data enhancement processing, and the detection accuracy of the trained defect detection model is effectively improved through training the defect detection model through the data set after the data enhancement processing.
Referring to fig. 3, another embodiment of the training apparatus for the defect detection model in the embodiment of the present invention includes:
the receivingmodule 201 is configured to receive a data transmission request sent by a terminal, determine data to be uploaded according to the data transmission request, and perform data upload directory structure verification on the data to be uploaded to obtain a verification result;
theuploading module 202 is configured to generate an uploading policy of the data to be uploaded according to the inspection result, and upload the data to be uploaded according to the uploading policy to obtain uploaded data;
the markingmodule 203 is configured to call a preset data marking tool to perform data marking on the uploaded data and generate a training data set corresponding to the uploaded data;
anenhancement module 204, configured to perform data enhancement processing on the training data set to generate an enhanced data set, where the enhanced data set includes a plurality of sample pictures with flaw labels;
thedetection module 205 is configured to acquire a deep learning network to be trained, and input the plurality of sample pictures with the flaw labels into the deep learning network for flaw detection, so as to generate a feature map corresponding to each sample picture;
and theparameter tuning module 206 is configured to perform parameter tuning on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network converges to obtain a flaw detection model.
Optionally, the receivingmodule 201 is specifically configured to: receiving a data transmission request sent by a terminal; inquiring data to be uploaded according to the data transmission request; judging whether the data transmission request carries a specified directory or not so as to verify a data uploading directory structure; if the data transmission request carries the directory folder, inquiring the directory folder carried by the data transmission request, and generating a detection result according to the directory folder; and if not, generating a test result corresponding to the data to be uploaded based on a preset auditing mechanism.
Optionally, thelabeling module 203 is specifically configured to: performing data inspection on the uploaded data, and removing error data in the uploaded data to obtain standard data; marking the standard data through a preset data marking tool to obtain marked standard data; dividing the marked standard data into positive sample data and negative sample data according to a preset proportion; and generating a training data set corresponding to the uploaded data by using the positive sample data and the negative sample data.
Optionally, the enhancingmodule 204 further includes: an obtainingunit 2041, configured to obtain multiple defective pictures and good pictures to perform automatic expansion on the training data set, so as to obtain an expanded data set; an enhancingunit 2042, configured to perform feature adjustment on the extended data set, so as to generate an enhanced data set, where the enhanced data set includes a plurality of sample pictures with defect labels.
Optionally, the detectingmodule 205 is specifically configured to: obtaining a deep learning network to be trained, wherein the deep learning network comprises: an input layer, a multilayer convolutional network, a weight layer and an output layer; inputting the plurality of sample pictures with the flaw marks into the input layer for processing to obtain an input picture corresponding to each sample picture; respectively inputting the input pictures into the multilayer convolution network for feature extraction to obtain a prediction picture corresponding to each sample picture; inputting the prediction graph corresponding to each sample picture into the weight layer for flaw weight processing to obtain a weight graph corresponding to each sample picture, wherein the weight graph and the prediction graph have the same size; and generating a feature map corresponding to the weight map through the output layer to obtain a feature map corresponding to each sample picture.
Optionally, theparameter tuning module 206 is specifically configured to: calling a preset loss function to calculate a loss value between the feature map and the sample picture; judging whether the loss value exceeds a preset target value or not; if the loss value does not exceed the preset loss value, carrying out reverse propagation of random gradient downward on the deep learning network according to the loss value and updating parameters in the deep learning network to obtain the deep learning network after parameter updating; acquiring a sample picture, inputting the sample picture into the deep learning network with the updated parameters for network convergence verification, and generating a verification result of the deep learning network with the updated parameters; and if the verification result is that the deep learning network after the parameter updating is converged, taking the deep learning network after the parameter updating as a flaw detection model.
In the embodiment of the invention, a data transmission request sent by a terminal is received, data to be uploaded is determined according to the data transmission request, and data uploading directory structure verification is carried out on the data to be uploaded to obtain a detection result; generating an uploading strategy of the data to be uploaded according to the inspection result, uploading the data to be uploaded according to the uploading strategy to obtain uploaded data, wherein the data can be uploaded only after being labeled, and an auditing mechanism is provided for the labeled data, so that the safety of a data set is improved; calling a preset data labeling tool to perform data labeling on the uploaded data and generating a training data set corresponding to the uploaded data; performing data enhancement processing on the training data set to generate an enhanced data set, wherein the enhanced data set comprises a plurality of sample pictures with flaw labels; acquiring a deep learning network to be trained, and inputting the plurality of sample pictures with flaw labels into the deep learning network for flaw detection respectively to generate a feature map corresponding to each sample picture; and performing parameter optimization on the deep learning network according to the feature map corresponding to each sample picture until the deep learning network is converged to obtain a flaw detection model. According to the method, the data enhancement processing is carried out on the data set in the defect detection model training process, the richness of the training data set is improved through the data enhancement processing, and the detection accuracy of the trained defect detection model is effectively improved through training the defect detection model through the data set after the data enhancement.
Fig. 2 and 3 describe the training apparatus of the fault detection model in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the following describes the training apparatus of the fault detection model in the embodiment of the present invention in detail from the perspective of the hardware processing.
Fig. 4 is a schematic structural diagram of a training apparatus for a fault detection model according to an embodiment of the present invention, where thetraining apparatus 400 for a fault detection model may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 410 (e.g., one or more processors) and amemory 420, and one or more storage media 430 (e.g., one or more mass storage devices) storing anapplication 433 ordata 432.Memory 420 andstorage medium 430 may be, among other things, transient or persistent storage. The program stored on thestorage medium 430 may include one or more modules (not shown), each of which may include a series of instruction operations in thetraining apparatus 400 for a fault detection model. Still further, theprocessor 410 may be configured to communicate with thestorage medium 430 to execute a series of instruction operations in thestorage medium 430 on thetraining apparatus 400 for the fault detection model.
Thetraining apparatus 400 for the fault detection model may also include one ormore power supplies 440, one or more wired or wireless network interfaces 450, one or more input-output interfaces 460, and/or one ormore operating systems 431, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that the training apparatus configuration of the fault detection model shown in fig. 4 does not constitute a limitation of the training apparatus of the fault detection model, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The invention further provides a training device for the fault detection model, which comprises a memory and a processor, wherein the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the processor executes the steps of the training method for the fault detection model in the above embodiments.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when executed on a computer, cause the computer to perform the steps of the method for training a fault detection model.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. 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.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.