CN115713533A - Method and device for detecting surface defects of electrical equipment based on machine vision - Google Patents
Method and device for detecting surface defects of electrical equipment based on machine vision Download PDFInfo
- Publication number
- CN115713533A CN115713533A CN202310032686.1A CN202310032686A CN115713533A CN 115713533 A CN115713533 A CN 115713533A CN 202310032686 A CN202310032686 A CN 202310032686A CN 115713533 A CN115713533 A CN 115713533A
- Authority
- CN
- China
- Prior art keywords
- image
- neural network
- convolutional neural
- data
- preset
- 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.)
- Granted
Links
- 230000007547 defect Effects 0.000 title claims abstract description 123
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000012549 training Methods 0.000 claims abstract description 134
- 238000013527 convolutional neural network Methods 0.000 claims abstract description 104
- 238000001514 detection method Methods 0.000 claims abstract description 15
- 238000012545 processing Methods 0.000 claims description 39
- 210000002569 neuron Anatomy 0.000 claims description 28
- 238000011176 pooling Methods 0.000 claims description 28
- 238000005070 sampling Methods 0.000 claims description 25
- 238000003709 image segmentation Methods 0.000 claims description 11
- 238000000605 extraction Methods 0.000 claims description 7
- 238000013507 mapping Methods 0.000 claims description 7
- 238000007781 pre-processing Methods 0.000 claims description 7
- 230000002708 enhancing effect Effects 0.000 claims description 5
- 230000010354 integration Effects 0.000 claims description 4
- 230000004913 activation Effects 0.000 claims description 3
- 238000013473 artificial intelligence Methods 0.000 abstract description 5
- 238000005516 engineering process Methods 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 73
- 238000001914 filtration Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 5
- 230000002829 reductive effect Effects 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 238000009826 distribution Methods 0.000 description 3
- 230000011218 segmentation Effects 0.000 description 3
- 239000006002 Pepper Substances 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000002238 attenuated effect Effects 0.000 description 2
- 230000002146 bilateral effect Effects 0.000 description 2
- 230000002950 deficient Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000670 limiting effect Effects 0.000 description 2
- 230000036961 partial effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 235000002566 Capsicum Nutrition 0.000 description 1
- 235000016761 Piper aduncum Nutrition 0.000 description 1
- 235000017804 Piper guineense Nutrition 0.000 description 1
- 244000203593 Piper nigrum Species 0.000 description 1
- 235000008184 Piper nigrum Nutrition 0.000 description 1
- 229910000831 Steel Inorganic materials 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 239000012535 impurity Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- -1 plaques Substances 0.000 description 1
- 238000010248 power generation Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 150000003839 salts Chemical class 0.000 description 1
- 239000010959 steel Substances 0.000 description 1
- 238000003860 storage Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
-
- Y—GENERAL 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
- Y04—INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
- Y04S—SYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
- Y04S10/00—Systems supporting electrical power generation, transmission or distribution
- Y04S10/50—Systems or methods supporting the power network operation or management, involving a certain degree of interaction with the load-side end user applications
Landscapes
- Image Analysis (AREA)
Abstract
The invention relates to an artificial intelligence technology, and discloses a method and a device for detecting surface defects of electrical equipment based on machine vision, wherein the method comprises the following steps: acquiring a preset convolutional neural network, and presetting a surface defect training set of the convolutional neural network according to the acquired equipment image of the power equipment; training the preset convolutional neural network by utilizing a surface defect training set and a preset receptive field value to generate an attenuation function of the preset convolutional neural network, and updating parameters of the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain a trained convolutional neural network; and detecting the surface defects of the target power equipment by using the trained convolutional neural network. The method and the device can improve the accuracy of the detection of the surface defects of the electrical equipment based on the machine vision.
Description
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a method and a device for detecting surface defects of electric equipment based on machine vision.
Background
The appearance of the product is an important component of the surface quality of the product, and various defects inevitably exist on the surface of the product due to the limitation of factors such as production environment and the like.
The defects on the surface of the product are shown in different places from other parts of the product, namely, the defects have significance, and human eyes can easily find the defects, so that the traditional surface defect detection mainly depends on the human eyes, but people are easily influenced by subjective factors, the judgment defect standards are different, reliable, consistent and accurate detection results cannot be obtained, the defects with small defect target and background gray scale difference, the defects with very small size or the defects in a complex background are difficult to distinguish by the human eyes, and therefore, the problem to be solved is how to improve the detection accuracy of the surface defects of the electric power equipment.
Disclosure of Invention
The invention provides a method and a device for detecting surface defects of electric equipment based on machine vision, and mainly aims to solve the problem of low accuracy in detection of the surface defects of the electric equipment.
In order to achieve the above object, the present invention provides a method for detecting surface defects of electrical equipment based on machine vision, comprising:
acquiring an equipment image of power equipment, and performing image processing on the equipment image to obtain a target image of the equipment image;
acquiring a preset convolutional neural network, and constructing a surface defect training set of the preset convolutional neural network by using the target image;
generating a training label of the training data in the surface defect training set, and training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network;
generating a loss function of the preset convolutional neural network according to the training result and the training label;
attenuating the loss function to obtain an attenuation function of the loss function, and updating parameters of the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain a trained convolutional neural network;
and detecting the surface defects of the target power equipment by using the trained convolutional neural network.
Optionally, the performing image processing on the device image to obtain a target image of the device image includes:
performing region extraction on the equipment image to obtain a standard image of the equipment image;
performing image preprocessing on the standard image to obtain a preprocessed image of the standard image;
and carrying out image segmentation on the preprocessed image to obtain a target image of the preprocessed image.
Optionally, the performing image preprocessing on the standard image to obtain a preprocessed image of the standard image includes:
denoising the standard image to obtain a denoised image of the standard image;
and enhancing the de-noised image to obtain a preprocessed image of the de-noised image.
Optionally, the constructing a surface defect training set of the preset convolutional neural network by using the target image includes:
performing feature extraction on the target image to obtain image features of the target image;
establishing a characteristic sequence of the target image according to the image characteristics, and performing hierarchical sampling on the characteristic sequence according to a preset sampling proportion to obtain sampling data of the target image;
and collecting the sampling data as a surface defect training set of the preset convolutional neural network.
Optionally, the generating a training label of the training data in the surface defect training set includes:
and determining a label mapping rule of the training data, and generating a training label of the training data according to the label mapping rule.
Optionally, the training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network, including:
initializing parameters of a preset convolutional neural network to obtain an initial convolutional neural network;
inputting the surface defect training set into the initial convolutional neural network, and performing convolutional processing on the surface defect training set by using a preset receptive field value and the initial convolutional neural network to obtain convolutional data of the surface defect training set;
pooling the convolution data to obtain pooled data of the convolution data;
and performing data integration on the pooled data by using the full-link layer of the initial convolutional neural network to obtain a training result of the initial convolutional neural network.
Optionally, the performing convolution processing on the surface defect training set by using a preset receptive field value and the initial convolutional neural network to obtain convolution data of the surface defect training set includes:
determining the pooling dimensionality of a pooling layer in the initial convolutional neural network according to a preset receptive field value;
performing convolution processing on the surface defect training set by using a convolution algorithm to obtain convolution data of the surface defect training set:
wherein ,is to indicate the firstLayer oneThe output of each of the plurality of neurons,is the layer number mark of the convolution layer,is the first in the convolutional layerThe identification of layer neurons is carried out,is the first in the convolutional layerThe layer of neuron identification is provided with a layer of neuron identification,is the firstLayer oneA single neuron and a second neuronLayer oneNerve of individualThe connection weight of the element is determined,is the firstLayer oneThe output of each of the plurality of neurons,is the firstLayer oneThe bias of the individual neurons is such that,is an activation function.
Optionally, the performing pooling processing on the convolution data to obtain pooled data of the convolution data includes:
determining a downsampling function type of the convolution data, and performing pooling processing on the convolution data according to the downsampling function type and the following sampling algorithm to obtain pooled data of the convolution data:
wherein ,is pooled data of the convolved data,is a function of the down-sampling,is the convolved data.
Optionally, the attenuating the loss function to obtain an attenuation function of the loss function includes:
determining a regularization type of the loss function, and generating a penalty term of the loss function according to the regularization type;
and carrying out attenuation processing on the loss function by utilizing the penalty term to obtain an attenuation function of the loss function.
In order to solve the above problem, the present invention further provides a device for detecting surface defects of electrical equipment based on machine vision, the device comprising:
the image processing module is used for acquiring an equipment image of the power equipment, and performing image processing on the equipment image to obtain a target image of the equipment image;
a training set generation module used for acquiring a preset convolutional neural network and constructing a surface defect training set of the preset convolutional neural network by using the target image;
the model training module is used for generating a training label of training data in the surface defect training set, and training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network;
the loss function module is used for generating a loss function of the preset convolutional neural network according to the training result and the training label;
the parameter updating module is used for performing attenuation processing on the loss function to obtain an attenuation function of the loss function, and performing parameter updating on the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain a trained convolutional neural network;
and the defect detection module is used for detecting the surface defects of the target power equipment by utilizing the trained convolutional neural network.
According to the embodiment of the invention, the equipment image of the power equipment is preprocessed, so that partial noise of the equipment image is eliminated, the influence of the noise on subsequent analysis is reduced, the local characteristic and the global characteristic of the equipment image are enhanced, an interested image area is more prominent, the recognition effect of the image is improved, the preset convolutional neural network is trained by using the preset receptive field value and the generated surface defect training set, so that the model parameters are more accurate, the loss function of the preset convolutional neural network is generated, the loss model is attenuated, the model error is reduced, the parameters are updated by using the preset gradient descent algorithm, and the parameter updating speed is accelerated.
Drawings
Fig. 1 is a schematic flowchart of a method for detecting surface defects of an electrical device based on machine vision according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of generating a surface defect training set according to an embodiment of the present invention;
fig. 3 is a schematic flowchart illustrating a training process of a predetermined convolutional neural network according to an embodiment of the present invention;
FIG. 4 is a functional block diagram of a surface defect detecting apparatus for electrical equipment based on machine vision according to an embodiment of the present invention;
the implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
The embodiment of the application provides a method for detecting surface defects of electrical equipment based on machine vision. The execution subject of the power equipment surface defect detection method based on machine vision includes, but is not limited to, at least one of electronic devices such as a server, a terminal and the like that can be configured to execute the method provided by the embodiments of the present application. In other words, the method for detecting surface defects of power equipment based on machine vision may be performed by software or hardware installed in a terminal device or a server device. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), and a big data and artificial intelligence platform.
Referring to fig. 1, a schematic flow chart of a method for detecting surface defects of electrical equipment based on machine vision according to an embodiment of the present invention is shown. In this embodiment, the method for detecting surface defects of electrical equipment based on machine vision includes:
s1, acquiring an equipment image of the power equipment, and performing image processing on the equipment image to obtain a target image of the equipment image.
In the embodiment of the present invention, the power device may be various, for example: power generation equipment such as power station boilers, steam turbines, gas turbines, water turbines, generators, transformers and the like, and power supply equipment such as transmission lines, mutual inductors, contactors and the like with various voltage grades; the equipment image is a photo obtained by taking a picture of the power equipment and sampling.
In this embodiment of the present invention, the performing image processing on the device image to obtain a target image of the device image includes:
performing region extraction on the equipment image to obtain a standard image of the equipment image;
performing image preprocessing on the standard image to obtain a preprocessed image of the standard image;
and carrying out image segmentation on the preprocessed image to obtain a target image of the preprocessed image.
In detail, the region extraction refers to selecting an image region to be analyzed on the device image.
In detail, the image preprocessing includes: image denoising and image enhancement, wherein the image denoising is to denoise the device image because the acquired device image may be influenced by environment, sensors, electronic elements and the like to generate noise, so as to reduce the influence of the noise on subsequent analysis; the image enhancement is to emphasize local or global features of the image, so that an interested image area is more prominent, and the recognition effect of the image is improved.
Further, the image segmentation on the preprocessed image aims to segment the defect from the whole image so as to extract the feature of the defect and identify the defect in the next step.
In detail, the image segmentation method can be divided into edge-based image segmentation, region-based image segmentation, threshold-based image segmentation, cluster-based image segmentation, theory-specific image segmentation, and the like, wherein the theory-specific image segmentation includes: watershed segmentation, segmentation based on fuzzy theory, segmentation based on graph theory, and the like.
In detail, the image preprocessing the standard image to obtain a preprocessed image of the standard image includes:
denoising the standard image to obtain a denoised image of the standard image;
and enhancing the de-noised image to obtain a preprocessed image of the de-noised image.
In detail, common noise in an image comprises salt-pepper noise and gaussian noise, and the denoising processing can utilize methods such as mean filtering, median filtering, bilateral filtering and the like, wherein the mean filtering uses a gray mean of a central pixel and a pixel point in a neighborhood window thereof to replace a gray value of the central pixel, the larger the neighborhood is, the better the denoising effect is, but the more the image is blurred, edge detail characteristics cannot be kept, and the denoising method is suitable for removing the gaussian noise; the median filtering detects the median of the neighborhood window pixels of the central pixel point, replaces the gray value of the central pixel point, can reduce the image blurring problem caused by mean filtering, and is suitable for removing salt and pepper noise and impulse noise; the bilateral filtering considers the spatial position relation of the pixel points and the similarity of the pixel gray levels, and can filter noise and keep good edge information.
In detail, due to illumination variation, defect shape, size, defect depth and other reasons, the image gray scale distribution is not uniform, and the difference between the defect target and the background is not obvious, so that image enhancement is required to improve the significance of the defect target, so that the difference between the target and the background is increased. Image enhancement techniques can be roughly divided into two categories: indirect enhancement and direct enhancement. And indirectly enhancing the histogram of the calculated image to adjust the image contrast. For example, histogram equalization, the effect of enhancing the image contrast is achieved by changing the distribution of pixels on the whole gray level; direct enhancement adjusts the contrast of an image based on a contrast strategy that represents a quantitative difference in color or brightness between the target and the background.
S2, obtaining a preset convolutional neural network, and constructing a surface defect training set of the preset convolutional neural network by using the target image.
In an embodiment of the present invention, referring to fig. 2, the constructing a surface defect training set of the preset convolutional neural network by using the target image includes:
s21, performing feature extraction on the target image to obtain image features of the target image;
s22, establishing a feature sequence of the target image according to the image features, and performing hierarchical sampling on the feature sequence according to a preset sampling proportion to obtain sampling data of the target image;
and S23, collecting the sampling data to be a surface defect training set of the preset convolutional neural network.
In detail, the image features of the target image include, but are not limited to: the defect detection method comprises the following steps of geometric characteristics, gray level characteristics and texture characteristics, wherein the geometric characteristics refer to that the defect generally has geometric characteristics such as area, ellipticity, linearity, rectangularity, perimeter and the like, so that the defect can be described by adopting the geometric characteristics, and the geometric characteristics are mainly divided into two types: simple descriptors including the length of the boundary, area of the region, aspect ratio of the circumscribed rectangle, etc.; shape descriptors including roundness, invariant moment, chain code, curvature, etc. generally require geometric features having translational invariance, rotational invariance and scale invariance; the gray feature describes the distribution condition of image pixel values, including the mean value, variance, entropy, 23780 degree and the like of gray, and the texture feature of a general image is related to the gray feature of the image and can be composed of the gray feature; the texture features reflect structural information of the surface of an image and the relation between each pixel and surrounding pixels, do not depend on the color of the image, are very important features, need to calculate statistics in the neighborhood of pixel points, and only depend on the gray value of a single pixel, so that the texture features have locality, generally have rotation invariance, are not sensitive to noise and have better robustness.
In detail, the establishing of the feature sequence of the target image according to the image features means that the image features are represented in a vector set or a matrix form, and feature points representing the image features are represented in a vector or a number.
In detail, the preset sampling ratio may be selected from 8:2, wherein 80% of the data in the signature sequence is used to form sampled data.
And S3, generating a training label of the training data in the surface defect training set, and training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network.
In an embodiment of the present invention, the training labels refer to labels used for representing features of the training data, where the training labels and the training data have a one-to-one correspondence relationship, and may be used to check the practicability and accuracy of the preset convolutional neural network.
In detail, the preset receptive field value refers to a convolution dimension when convolution layers in a preset convolution neural network are convolved and a pooling dimension when the pooling layers are pooled, that is, both the convolution layers and the pooling layers are affected by the receptive field, the receptive field refers to a region of the input image that can be seen by a certain point on the feature map, that is, the point on the feature map is obtained by calculating the size region of the receptive field in the input image, and a larger value of the neuron receptive field indicates that the original image range that the neuron receptive field can contact the neuron is larger, which also means that the neuron receptive field may contain more global features with higher semantic levels; conversely, a smaller value indicates that the feature it contains tends to be more local and detailed. Thus, the receptive field value can be used to approximate the level of abstraction at each level.
In an embodiment of the present invention, the generating the training labels of the training data in the surface defect training set includes:
and determining a label mapping rule of the training data, and generating a training label of the training data according to the label mapping rule.
In detail, the label mapping rule is generated according to key-value pairs, such as: when the value =1, the corresponding label is 'defective', or when the value =1, the corresponding label is 'non-defective', and the training label is self-defined.
In an embodiment of the present invention, referring to fig. 3, the training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network includes:
s31, initializing parameters of a preset convolutional neural network to obtain an initial convolutional neural network;
s32, inputting the surface defect training set into the initial convolutional neural network, and performing convolutional processing on the surface defect training set by using a preset receptive field value and the initial convolutional neural network to obtain convolutional data of the surface defect training set;
s33, performing pooling treatment on the convolution data to obtain pooled data of the convolution data;
and S34, performing data integration on the pooled data by using the full-connection layer of the initial convolutional neural network to obtain a training result of the initial convolutional neural network.
In detail, the preset convolutional neural network mainly comprises an input layer, a convolutional layer, a pooling layer, a full connection layer and an output layer, wherein the convolutional layer is used for carrying out convolution processing, the pooling layer is used for carrying out pooling processing, and the full connection layer is used for carrying out data integration processing.
In detail, the performing convolution processing on the surface defect training set by using a preset receptive field value and the initial convolution neural network to obtain convolution data of the surface defect training set includes:
determining the pooling dimensionality of a pooling layer in the initial convolutional neural network according to a preset receptive field value;
performing convolution processing on the surface defect training set by using a convolution algorithm to obtain convolution data of the surface defect training set:
wherein ,is to indicate the firstLayer oneThe output of each of the plurality of neurons,is the layer number mark of the convolution layer,is the first in the convolutional layerThe layer of neuron identification is provided with a layer of neuron identification,is the first in the convolutional layerThe layer of neuron identification is provided with a layer of neuron identification,is the firstLayer oneA single neuron and a second neuronLayer oneThe connection weight of each neuron is calculated,is the firstLayer oneThe output of each of the plurality of neurons,is the firstLayer oneThe bias of the individual neurons is such that,is an activation function.
In detail, considering that each mode may appear in a local area of an image, the same mode may appear in different areas of the image, and the down-sampling original image does not affect the recognition result, the CNN uses a convolution layer to extract local features of the image, uses a pooling layer to implement the down-sampling of the image, extracts the image features layer by layer through a local receptive field and the down-sampling, and uses a weight sharing method to reduce network parameters.
In detail, the performing pooling processing on the convolution data to obtain pooled data of the convolution data includes:
determining a downsampling function type of the convolution data, and performing pooling processing on the convolution data according to the downsampling function type and the following sampling algorithm to obtain pooled data of the convolution data:
wherein ,is pooled data of the convolved data,is a function of the down-sampling,is the convolved data.
In detail, the pooling layer is to down-sample the feature map by a certain rule, and the rule generally includes: average pooling, maximum pooling, etc., i.e., downsampling function types include: average down-sampling function, maximum down-sampling function and the like, wherein the average pooling is to calculate the average value of each characteristic value in the receptive field, the maximum pooling is to obtain the maximum value of the characteristics in the receptive field, the purpose of the pooling layer is to down-sample the image, reduce the number of model parameters, effectively avoid overfitting of the model, and gradually enlarge the receptive field of the image, so that the local characteristics of the extracted image are gradually transited to the global characteristics of the extracted image.
And S4, generating a loss function of the preset convolutional neural network according to the training result and the training label.
In the embodiment of the present invention, the loss function is an operation function for measuring a difference degree between a predicted value and a true value of the predetermined convolutional neural network, that is, the loss function is an operation function for measuring a difference degree between the training result of the predetermined convolutional neural network and the training label, and is a non-negative real value function, and the smaller the loss function is, the better the robustness of the model is.
In detail, the loss functions include, but are not limited to: a mean square error loss function, a euclidean distance loss function, a manhattan distance loss function, a huber loss function, a relative entropy, and the like.
And S5, attenuating the loss function to obtain an attenuation function of the loss function, and updating parameters of the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain the trained convolutional neural network.
In the embodiment of the invention, the attenuation function is mainly used in the training stage of the preset convolutional neural network, after each batch of training data is sent into the model, the predicted value is output through forward propagation, then the attenuation function calculates the loss value, and after the loss value is obtained, the model updates each parameter through backward propagation to reduce the loss between the true value and the predicted value, so that the predicted value generated by the preset convolutional neural network is close to the true value, and the learning purpose is achieved.
In this embodiment of the present invention, the attenuating the loss function to obtain an attenuation function of the loss function includes:
determining the regularization type of the loss function, and generating a penalty term of the loss function according to the regularization type;
and carrying out attenuation processing on the loss function by utilizing the penalty term to obtain the attenuation function of the loss function.
In detail, the regularization types include: l2 regularization and L1 regularization, wherein the L2 regularization is a penalty term for adding a weight parameter to a loss functionSo that the simpler the model, the better it passesThe degree of the penalty term is adjusted,larger indicates a very high penalty for a parameter with larger weight, thus making the weight more uniform; the L1 regularization is to add a weight parameter penalty term to the loss functionSome weights are made to be 0 as much as possible, and only weights having a relatively large influence on the objective function are retained.
In detail, the preset gradient descent algorithm is as follows:
wherein ,is a parameter that is updated in the context of the application,is a parameter that needs to be adjusted,which is indicative of the gradient of the light beam,required for calculating said decay functionData andthe small batches of data between the data,is required for calculating said decay functionData andthe small batches of data between the data,as a result of a value container carrying a gradient squared weighted average,as a factor in the scaling of the gradient,is a constant, generally taken,Is the identification of the data, and,is a data identification.
In detail, the preset gradient descent algorithm is to update parameters faster in the direction of descending the attenuation function, and change parameters slower in the direction perpendicular to the descending direction of the attenuation function, so as to avoid the phenomenon of 'zigzag' descent of the attenuation function;is constant and is a small number, avoiding said predetermined gradient descent algorithmIs 0
And S6, detecting the surface defects of the target power equipment by using the trained convolutional neural network.
In the embodiments of the present invention, the defects on the surface of the product appear differently from other parts of the product, i.e. have significance, for example: scratches, impurities, pitted surfaces, scratches, oxide scales and the like appear on the surface of strip steel, plaques, holes and the like appear on the surface of metal, stains, color differences and the like appear on the surface of paper, and defects on the surface of a product not only affect the commercial value of the product, but also have serious influence on subsequent processing and user experience of the product, so that before the product leaves a factory, whether defects exist in the appearance of the product needs to be strictly checked.
In detail, the trained convolutional neural network can be used to detect the surface defects of the target power device, such as: and if the trained convolutional neural network output value is larger than a preset defect threshold value, determining that the surface of the target electric equipment has defects.
According to the embodiment of the invention, the equipment image of the power equipment is preprocessed, so that partial noise of the equipment image is eliminated, the influence of the noise on subsequent analysis is reduced, the local characteristic and the global characteristic of the equipment image are enhanced, an interested image area is more prominent, the recognition effect of the image is improved, the preset convolutional neural network is trained by using the preset receptive field value and the generated surface defect training set, so that the model parameters are more accurate, the loss function of the preset convolutional neural network is generated, the loss model is attenuated, the model error is reduced, the parameters are updated by using the preset gradient descent algorithm, and the parameter updating speed is accelerated.
Fig. 4 is a functional block diagram of a device for detecting surface defects of electrical equipment based on machine vision according to an embodiment of the present invention.
The device 100 for detecting surface defects of electrical equipment based on machine vision can be installed in electronic equipment. According to the implemented functions, the apparatus 100 for detecting surface defects of power equipment based on machine vision may include an image processing module 101, a training set generation module 102, a model training module 103, a loss function module 104, a parameter update module 105, and a defect detection module 106. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and can perform a fixed function, and are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the image processing module 101 is configured to acquire an apparatus image of an electrical apparatus, perform image processing on the apparatus image, and obtain a target image of the apparatus image;
the training set generation module 102 is configured to obtain a preset convolutional neural network, and construct a surface defect training set of the preset convolutional neural network by using the target image;
the model training module 103 is configured to generate a training label of training data in the surface defect training set, train the preset convolutional neural network by using the surface defect training set and a preset receptive field value, and obtain a training result of the preset convolutional neural network;
the loss function module 104 is configured to generate a loss function of the preset convolutional neural network according to the training result and the training label;
the parameter updating module 105 is configured to perform attenuation processing on the loss function to obtain an attenuation function of the loss function, and perform parameter updating on the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain a trained convolutional neural network;
the defect detection module 106 is configured to perform surface defect detection on the target power device by using the trained convolutional neural network.
In the embodiments provided in the present invention, it should be understood that the disclosed method and apparatus can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application device that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
1. A method for detecting surface defects of electric equipment based on machine vision is characterized by comprising the following steps:
acquiring an equipment image of power equipment, and performing image processing on the equipment image to obtain a target image of the equipment image;
acquiring a preset convolutional neural network, and constructing a surface defect training set of the preset convolutional neural network by using the target image;
generating a training label of the training data in the surface defect training set, and training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network;
generating a loss function of the preset convolutional neural network according to the training result and the training label;
performing attenuation processing on the loss function to obtain an attenuation function of the loss function, and performing parameter updating on the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain a trained convolutional neural network, wherein the preset gradient descent algorithm is as follows:
wherein ,is a parameter that is updated in the context of the application,is a parameter that needs to be adjusted,the gradient is represented by the number of lines,is required for calculating said decay functionData andthe small batches of data between the data,required for calculating said decay functionData andthe small batches of data between the data,as a result of a value container carrying a gradient squared weighted average,as a factor in the scaling of the gradient,is a constantGenerally take,Is the identification of the data, and,is a data identification;
and detecting the surface defects of the target power equipment by using the trained convolutional neural network.
2. The method for detecting the surface defects of the power equipment based on the machine vision as claimed in claim 1, wherein the image processing of the equipment image to obtain the target image of the equipment image comprises:
performing region extraction on the equipment image to obtain a standard image of the equipment image;
performing image preprocessing on the standard image to obtain a preprocessed image of the standard image;
and carrying out image segmentation on the preprocessed image to obtain a target image of the preprocessed image.
3. The method for detecting surface defects of power equipment based on machine vision as claimed in claim 2, wherein the image preprocessing of the standard image to obtain a preprocessed image of the standard image comprises:
denoising the standard image to obtain a denoised image of the standard image;
and enhancing the denoised image to obtain a preprocessed image of the denoised image.
4. The method for detecting surface defects of power equipment based on machine vision according to claim 1, wherein the constructing of the training set of surface defects of the preset convolutional neural network by using the target image comprises:
performing feature extraction on the target image to obtain image features of the target image;
establishing a feature sequence of the target image according to the image features, and performing layered sampling on the feature sequence according to a preset sampling proportion to obtain sampling data of the target image;
and collecting the sampling data as a surface defect training set of the preset convolutional neural network.
5. The machine-vision-based electrical equipment surface defect detection method of claim 1, wherein the generating of the training labels for the training data in the surface defect training set comprises:
and determining a label mapping rule of the training data, and generating a training label of the training data according to the label mapping rule.
6. The method for detecting surface defects of power equipment based on machine vision according to claim 1, wherein the training of the preset convolutional neural network by using the surface defect training set and preset receptive field values to obtain the training result of the preset convolutional neural network comprises:
initializing parameters of a preset convolutional neural network to obtain an initial convolutional neural network;
inputting the surface defect training set into the initial convolutional neural network, and performing convolutional processing on the surface defect training set by using a preset receptive field value and the initial convolutional neural network to obtain convolutional data of the surface defect training set;
pooling the convolution data to obtain pooled data of the convolution data;
and performing data integration on the pooled data by using the full-link layer of the initial convolutional neural network to obtain a training result of the initial convolutional neural network.
7. The method for detecting surface defects of power equipment based on machine vision according to claim 6, wherein the convolving the surface defect training set by using the preset receptive field value and the initial convolutional neural network to obtain the convolved data of the surface defect training set comprises:
determining the pooling dimensionality of a pooling layer in the initial convolutional neural network according to a preset receptive field value;
performing convolution processing on the surface defect training set by using a convolution algorithm to obtain convolution data of the surface defect training set:
wherein ,is to indicate the firstLayer oneThe output of each of the plurality of neurons,is the layer number mark of the convolution layer,is the first in the convolutional layerThe identification of layer neurons is carried out,is the first in the convolutional layerThe layer of neuron identification is provided with a layer of neuron identification,is the firstLayer oneA single neuron and a second neuronLayer oneThe connection weight of each neuron is calculated,is the firstLayer oneThe output of each of the plurality of neurons,is the firstLayer oneThe bias of the individual neurons is such that,is an activation function.
8. The machine-vision-based power equipment surface defect detection method of claim 6, wherein the pooling of the convolution data to obtain pooled data of the convolution data comprises:
determining a downsampling function type of the convolution data, and performing pooling processing on the convolution data according to the downsampling function type and the following sampling algorithm to obtain pooled data of the convolution data:
9. The method for detecting the surface defects of the electric power equipment based on the machine vision according to any one of claims 1 to 8, wherein the attenuating the loss function to obtain an attenuation function of the loss function comprises:
determining the regularization type of the loss function, and generating a penalty term of the loss function according to the regularization type;
and carrying out attenuation processing on the loss function by utilizing the penalty term to obtain an attenuation function of the loss function.
10. A machine vision-based electrical equipment surface defect detection apparatus, the apparatus comprising:
the image processing module is used for acquiring an equipment image of the power equipment, and performing image processing on the equipment image to obtain a target image of the equipment image;
the generation training set module is used for acquiring a preset convolutional neural network and constructing a surface defect training set of the preset convolutional neural network by using the target image;
the model training module is used for generating a training label of training data in the surface defect training set, and training the preset convolutional neural network by using the surface defect training set and a preset receptive field value to obtain a training result of the preset convolutional neural network;
the loss function module is used for generating a loss function of the preset convolutional neural network according to the training result and the training label;
the parameter updating module is used for carrying out attenuation processing on the loss function to obtain an attenuation function of the loss function, and carrying out parameter updating on the preset convolutional neural network according to the attenuation function and a preset gradient descent algorithm to obtain a trained convolutional neural network;
and the defect detection module is used for detecting the surface defects of the target power equipment by using the trained convolutional neural network.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310032686.1A CN115713533B (en) | 2023-01-10 | 2023-01-10 | Power equipment surface defect detection method and device based on machine vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310032686.1A CN115713533B (en) | 2023-01-10 | 2023-01-10 | Power equipment surface defect detection method and device based on machine vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115713533A true CN115713533A (en) | 2023-02-24 |
CN115713533B CN115713533B (en) | 2023-06-06 |
Family
ID=85236232
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310032686.1A Active CN115713533B (en) | 2023-01-10 | 2023-01-10 | Power equipment surface defect detection method and device based on machine vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115713533B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115331152A (en) * | 2022-09-28 | 2022-11-11 | 江苏海舟安防科技有限公司 | Fire fighting identification method and system |
CN116704266A (en) * | 2023-07-28 | 2023-09-05 | 国网浙江省电力有限公司信息通信分公司 | Power equipment fault detection method, device, equipment and storage medium |
CN116758060A (en) * | 2023-08-10 | 2023-09-15 | 江苏森标科技有限公司 | Vertical basket of flowers visual detection system of battery piece |
CN118134938A (en) * | 2024-05-10 | 2024-06-04 | 山东银山耐火材料有限公司 | Visual detection method and system for surface defects of refractory bricks |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070146491A1 (en) * | 2004-06-09 | 2007-06-28 | Cognex Corporation | Human-machine-interface and method for manipulating data in a machine vision system |
CN109060838A (en) * | 2018-07-23 | 2018-12-21 | 三固(厦门)科技有限公司 | A kind of product surface scratch detection method based on machine vision |
CN109359608A (en) * | 2018-10-25 | 2019-02-19 | 电子科技大学 | A kind of face identification method based on deep learning model |
CN110349146A (en) * | 2019-07-11 | 2019-10-18 | 中原工学院 | The building method of fabric defect identifying system based on lightweight convolutional neural networks |
CN110992317A (en) * | 2019-11-19 | 2020-04-10 | 佛山市南海区广工大数控装备协同创新研究院 | PCB defect detection method based on semantic segmentation |
US20200134461A1 (en) * | 2018-03-20 | 2020-04-30 | Sri International | Dynamic adaptation of deep neural networks |
CN111507990A (en) * | 2020-04-20 | 2020-08-07 | 南京航空航天大学 | Tunnel surface defect segmentation method based on deep learning |
US20210334587A1 (en) * | 2018-09-04 | 2021-10-28 | Boe Technology Group Co., Ltd. | Method and apparatus for training a convolutional neural network to detect defects |
CN113870230A (en) * | 2021-09-30 | 2021-12-31 | 湖南大学 | Surface anomaly detection method based on hybrid supervised learning |
CN114119554A (en) * | 2021-11-29 | 2022-03-01 | 哈尔滨工业大学 | Surface microdefect detection method and device based on convolutional neural network |
CN114330094A (en) * | 2021-11-18 | 2022-04-12 | 国家电网有限公司 | Wind power short-term prediction method based on TCN-GRU combined model |
CN115271263A (en) * | 2022-09-27 | 2022-11-01 | 佰聆数据股份有限公司 | Power equipment defect early warning method, system and medium based on improved association rule |
CN115294038A (en) * | 2022-07-25 | 2022-11-04 | 河北工业大学 | Defect detection method based on joint optimization and mixed attention feature fusion |
-
2023
- 2023-01-10 CN CN202310032686.1A patent/CN115713533B/en active Active
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070146491A1 (en) * | 2004-06-09 | 2007-06-28 | Cognex Corporation | Human-machine-interface and method for manipulating data in a machine vision system |
US20200134461A1 (en) * | 2018-03-20 | 2020-04-30 | Sri International | Dynamic adaptation of deep neural networks |
CN109060838A (en) * | 2018-07-23 | 2018-12-21 | 三固(厦门)科技有限公司 | A kind of product surface scratch detection method based on machine vision |
US20210334587A1 (en) * | 2018-09-04 | 2021-10-28 | Boe Technology Group Co., Ltd. | Method and apparatus for training a convolutional neural network to detect defects |
CN109359608A (en) * | 2018-10-25 | 2019-02-19 | 电子科技大学 | A kind of face identification method based on deep learning model |
CN110349146A (en) * | 2019-07-11 | 2019-10-18 | 中原工学院 | The building method of fabric defect identifying system based on lightweight convolutional neural networks |
CN110992317A (en) * | 2019-11-19 | 2020-04-10 | 佛山市南海区广工大数控装备协同创新研究院 | PCB defect detection method based on semantic segmentation |
CN111507990A (en) * | 2020-04-20 | 2020-08-07 | 南京航空航天大学 | Tunnel surface defect segmentation method based on deep learning |
CN113870230A (en) * | 2021-09-30 | 2021-12-31 | 湖南大学 | Surface anomaly detection method based on hybrid supervised learning |
CN114330094A (en) * | 2021-11-18 | 2022-04-12 | 国家电网有限公司 | Wind power short-term prediction method based on TCN-GRU combined model |
CN114119554A (en) * | 2021-11-29 | 2022-03-01 | 哈尔滨工业大学 | Surface microdefect detection method and device based on convolutional neural network |
CN115294038A (en) * | 2022-07-25 | 2022-11-04 | 河北工业大学 | Defect detection method based on joint optimization and mixed attention feature fusion |
CN115271263A (en) * | 2022-09-27 | 2022-11-01 | 佰聆数据股份有限公司 | Power equipment defect early warning method, system and medium based on improved association rule |
Non-Patent Citations (1)
Title |
---|
刘士波: "基于数字图像的输电线故障识别与定位方法研究", pages 1 - 60 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115331152A (en) * | 2022-09-28 | 2022-11-11 | 江苏海舟安防科技有限公司 | Fire fighting identification method and system |
CN115331152B (en) * | 2022-09-28 | 2024-03-08 | 江苏海舟安防科技有限公司 | Fire fighting identification method and system |
CN116704266A (en) * | 2023-07-28 | 2023-09-05 | 国网浙江省电力有限公司信息通信分公司 | Power equipment fault detection method, device, equipment and storage medium |
CN116704266B (en) * | 2023-07-28 | 2023-10-31 | 国网浙江省电力有限公司信息通信分公司 | Power equipment fault detection method, device, equipment and storage medium |
CN116758060A (en) * | 2023-08-10 | 2023-09-15 | 江苏森标科技有限公司 | Vertical basket of flowers visual detection system of battery piece |
CN116758060B (en) * | 2023-08-10 | 2023-10-27 | 江苏森标科技有限公司 | Vertical basket of flowers visual detection system of battery piece |
CN118134938A (en) * | 2024-05-10 | 2024-06-04 | 山东银山耐火材料有限公司 | Visual detection method and system for surface defects of refractory bricks |
CN118134938B (en) * | 2024-05-10 | 2024-07-12 | 山东银山耐火材料有限公司 | Visual detection method and system for surface defects of refractory bricks |
Also Published As
Publication number | Publication date |
---|---|
CN115713533B (en) | 2023-06-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115713533B (en) | Power equipment surface defect detection method and device based on machine vision | |
CN111723860B (en) | Target detection method and device | |
CN113160192B (en) | Visual sense-based snow pressing vehicle appearance defect detection method and device under complex background | |
Jiang et al. | Change detection in heterogeneous optical and SAR remote sensing images via deep homogeneous feature fusion | |
CN111611874B (en) | Face mask wearing detection method based on ResNet and Canny | |
CN110598600A (en) | Remote sensing image cloud detection method based on UNET neural network | |
CN111242864B (en) | Finger vein image restoration method based on Gabor texture constraint | |
CN111160249A (en) | Multi-class target detection method of optical remote sensing image based on cross-scale feature fusion | |
CN106651774B (en) | License plate super-resolution model reconstruction method and device | |
CN111968095B (en) | Product surface defect detection method, system, device and medium | |
CN109840483B (en) | Landslide crack detection and identification method and device | |
CN110060273B (en) | Remote sensing image landslide mapping method based on deep neural network | |
CN109191430A (en) | A kind of plain color cloth defect inspection method based on Laws texture in conjunction with single classification SVM | |
CN113516126A (en) | Adaptive threshold scene text detection method based on attention feature fusion | |
Sahu et al. | Trends and prospects of techniques for haze removal from degraded images: A survey | |
CN113392849A (en) | R-CNN-based complex pavement crack identification method | |
CN113221881B (en) | Multi-level smart phone screen defect detection method | |
CN116228780A (en) | Silicon wafer defect detection method and system based on computer vision | |
CN115829942A (en) | Electronic circuit defect detection method based on non-negative constraint sparse self-encoder | |
CN116012922A (en) | Face image gender identification method suitable for mask wearing state | |
CN116152261A (en) | Visual inspection system for quality of printed product | |
Han et al. | Low contrast image enhancement using convolutional neural network with simple reflection model | |
Widyantara et al. | Gamma correction-based image enhancement and canny edge detection for shoreline extraction from coastal imagery | |
CN117036342B (en) | Chip defect identification method and system | |
CN108537266A (en) | A kind of cloth textured fault sorting technique of depth convolutional network |
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 |