CN115760800A - Aluminum product defect classification method and device based on Hash algorithm and Hash-AlexNet neural network - Google Patents
Aluminum product defect classification method and device based on Hash algorithm and Hash-AlexNet neural network Download PDFInfo
- Publication number
- CN115760800A CN115760800A CN202211472589.6A CN202211472589A CN115760800A CN 115760800 A CN115760800 A CN 115760800A CN 202211472589 A CN202211472589 A CN 202211472589A CN 115760800 A CN115760800 A CN 115760800A
- Authority
- CN
- China
- Prior art keywords
- hash
- aluminum product
- neural network
- layer
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
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
Landscapes
- Image Analysis (AREA)
Abstract
The invention provides a method and a device for classifying aluminum defects of a Hash-AlexNet neural network based on a Hash algorithm, wherein the method comprises the following steps of: acquiring a sample aluminum product image, and classifying defects of the sample aluminum product image to form an aluminum product defect data set; training a Hash-AlexNet neural network through the aluminum product defect data set, and obtaining a Hash code of the aluminum product defect type in the aluminum product defect data set; acquiring an aluminum product image to be detected, and preprocessing the aluminum product image to be detected; processing the aluminum product image to be detected by using the trained Hash-AlexNet neural network to obtain a Hash code of the aluminum product defect type of the aluminum product image to be detected; and calculating the Hamming distance between the Hash code of the defect type in the aluminum product defect data set and the Hash code of the defect type of the aluminum product image to be detected so as to classify the defect type of the aluminum product image to be detected. The invention can improve the speed and accuracy of classification.
Description
Technical Field
The invention relates to the technical field of aluminum product defect classification, in particular to a Hash algorithm-based aluminum product defect classification method of a Hash-AlexNet neural network and a Hash algorithm-based aluminum product defect classification device of the Hash-AlexNet neural network.
Background
With the continuous progress of scientific technology and the continuous development of industrial technology, aluminum products are widely applied in the industrial field, and the requirements of various products such as metal doors and windows, transportation industry, chemical industry, power equipment and the like on aluminum products are higher and higher. Since defects of aluminum materials directly affect the properties and appearance of products due to the wide demand for aluminum materials, problems regarding the quality of aluminum materials have been the focus of industrial production. The traditional manual detection technology is low in speed, low in detection accuracy and incapable of meeting the requirements of the existing products on the quality of aluminum products.
Disclosure of Invention
The invention provides a method and a device for classifying aluminum material defects of a Hash-AlexNet neural network based on a Hash algorithm, aiming at solving the technical problems, and the method and the device can improve the speed and the accuracy of classification.
The technical scheme adopted by the invention is as follows:
a Hash algorithm-based aluminum product defect classification method of a Hash-AlexNet neural network comprises the following steps: acquiring a sample aluminum product image, and classifying defects of the sample aluminum product image to form an aluminum product defect data set; training a Hash-AlexNet neural network through the aluminum product defect data set, and obtaining a Hash code of the aluminum product defect type in the aluminum product defect data set; acquiring an aluminum product image to be detected, and preprocessing the aluminum product image to be detected; processing the aluminum product image to be detected by using the trained Hash-AlexNet neural network to obtain a Hash code of the aluminum product defect type of the aluminum product image to be detected; and calculating the Hamming distance between the hash code of the defect type in the aluminum product defect data set and the hash code of the defect type of the aluminum product image to be detected so as to classify the defect type of the aluminum product image to be detected.
The defect types of the aluminum material include a plurality of cracks, pockmarks and bending twist.
The training of the Hash-AlexNet neural network comprises the following steps: inputting the sample image into a first convolution layer of the Hash-AlexNet neural network, and inputting an output result of the first convolution layer into a first pooling layer to perform Max posing operation; inputting the result after the operation of the first pooling layer into a second convolution layer, and inputting the output result of the second convolution base layer into the second pooling layer to perform Max posing operation; inputting the result after the second pooling layer operation into a third convolution layer for convolution operation, and inputting the operation result into a fourth convolution layer for convolution operation; inputting the operation result of the fourth convolution layer into a fifth convolution layer for convolution operation and performing Max posing operation on the input result; inputting the output result of the fifth convolutional layer into two full-connection layers of the Hash-AlexNet neural network, and inputting the output result of the second full-connection layer into the Hash layer of the Hash-AlexNet neural network; and inputting the output result of the Hash layer into the last layer of the Hash-AlexNet neural network for Softmax operation, and outputting the classification result of the sample image.
After convolution, the first convolution layer and the second convolution layer are subjected to local response normalization calculation, wherein a calculation formula of the local response normalization is as follows:
wherein N is the number of convolution kernels, Σ (. -) represents the mapping of N adjacent kernels converted at the same spatial position, N is the number of adjacent convolution kernels, k, α, β are hyper-parameters,the pixel point representing the position (x, y) calculates the neuron activation degree by applying the kernel,indicates the degree of neuronal activation after normalization at position (x, y), i indicates the number of channels,
each convolutional layer and the full link layer has a linear relationship from the previous layer to the next layer, and the linear relationship is expressed as:
wherein, the first and the second end of the pipe are connected with each other,is the image feature output for the input image passing through the y-th layer, W p And b p Weight and bias terms, respectively, of the first layer, f p Is the Relu activation function.
Training the Hash-AlexNet neural network through the aluminum product defect data set to obtain a Hash code of the aluminum product defect type, and specifically comprises the following steps: for all training sets in the aluminum product defect data set, the Hash-AlexNet neural network firstly calculates and generates an average value file; after all the pre-training images enter the Hash-AlexNet neural network, subtracting a global mean value in the mean value file from each pixel point; for an input image, randomly cutting the input image into fragments with fixed sizes by the Hash-AlexNet neural network, and training the fragments; and in the training, feature extraction is carried out on the fragments to generate high-dimensional feature vectors of the images, the Hash layer learns the high-dimensional feature vectors to obtain a Hash function, and finally the Hash function is mapped into a Hash code.
The Hash layer adopts a Sigmoid activation function, and the formula of the Sigmoid activation function is as follows:
wherein h is i Is the image feature vector output of the hash layer, and β is a hyper-parameter.
Preprocessing the image of the aluminum material to be detected, which specifically comprises the following steps: performing smooth filtering treatment on the aluminum product image to be detected by adopting median filtering; and carrying out edge sharpening on the aluminum material image to be detected by adopting a Canny operator.
The calculation formula of the Hamming distance is as follows:
wherein D (s, t) is the Hamming distance, i is an independent variable and the range of i is [0,n-1 ]]S and t are n-bit hash codes,representing an exclusive or.
A Hash-AlexNet neural network aluminum product defect classification device based on a Hash algorithm comprises the following components: the aluminum product defect detection method comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a sample aluminum product image and classifying defects of the sample aluminum product image to form an aluminum product defect data set; the training unit is used for training a Hash-AlexNet neural network through the aluminum product defect data set to obtain a Hash code of the aluminum product defect type in the aluminum product defect data set; the second acquisition unit is used for acquiring an aluminum product image to be detected and preprocessing the aluminum product image to be detected; the image processing unit is used for processing the aluminum product image to be detected by using the trained Hash-AlexNet neural network so as to obtain a Hash code of the aluminum product defect type of the aluminum product image to be detected; and the classification unit is used for calculating the Hamming distance between the Hash code of the defect type in the aluminum product defect data set and the Hash code of the defect type of the aluminum product image to be detected so as to classify the defect type of the aluminum product image to be detected.
The invention has the beneficial effects that:
according to the method, the Hash-AlexNet neural network is trained through the aluminum product defect data set to obtain the Hash codes of the aluminum product defect types, the aluminum product image to be detected is processed to obtain the Hash codes of the aluminum product image to be detected, and finally the defect types of the aluminum product image are classified by calculating the Hamming distance of the two groups of Hash codes, so that the classification speed and accuracy can be improved.
Drawings
FIG. 1 is a flowchart of a method for classifying aluminum defects of a Hash-AlexNet neural network based on a Hash algorithm according to an embodiment of the invention;
fig. 2 is a schematic block diagram of an aluminum defect classification device of a Hash-AlexNet neural network based on a Hash algorithm according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of an aluminum defect classification method of a Hash-AlexNet neural network based on a Hash algorithm according to an embodiment of the present invention.
As shown in fig. 1, the aluminum defect classification method based on the Hash algorithm Hash-AlexNet neural network of the embodiment of the present invention includes the following steps:
s1, obtaining a sample aluminum image, and classifying defects of the sample aluminum image to form an aluminum defect data set.
In one embodiment of the invention, images of some aluminum material defects can be crawled from a network or taken from a factory, a pipeline or the like to form an aluminum material defect data set. Wherein the defect types of the aluminum material may include a plurality of cracks, pocks, and twist-and-bend.
And S2, training the Hash-AlexNet neural network through the aluminum product defect data set, and obtaining the Hash code of the aluminum product defect type in the aluminum product defect data set.
In an embodiment of the invention, the Hash-AlexNet neural network is established based on an original AlexNet neural network, and the training of the Hash-AlexNet neural network specifically comprises the following steps:
and (I) inputting the sample image into a first convolution layer of the Hash-AlexNet neural network, and inputting an output result of the first convolution layer into a first pooling layer to perform Max posing operation.
And (II) inputting the result after the operation of the first pooling layer into the second convolution layer, and inputting the output result of the second convolution base layer into the second pooling layer to carry out Max posing operation.
And (III) inputting the result of the second pooling layer operation into a third convolution layer for convolution operation, and inputting the operation result into a fourth convolution layer for convolution operation.
And (IV) inputting the operation result of the fourth convolution layer into the fifth convolution layer for convolution operation and performing Max posing operation on the input result.
And (V) inputting the output result of the fifth convolutional layer into two full connection layers of the Hash-AlexNet neural network, and inputting the output result of the second full connection layer into the Hash layer of the Hash-AlexNet neural network.
And (VI), inputting the output result of the Hash layer into the last layer of the Hash-AlexNet neural network to perform Softmax operation, and outputting the classification result of the sample image.
In an embodiment of the present invention, the first convolution layer and the second convolution layer are subjected to a local response normalization calculation after convolution, wherein the calculation formula of the local response normalization is:
where N is the number of convolution kernels, Σ (. -) represents the conversion of N adjacent kernel maps at the same spatial location, and N is of adjacent convolution kernelsThe number of k, alpha and beta are hyper-parameters,the pixel point representing the position (x, y) calculates the neuron activation degree by applying the kernel,representing the degree of neuronal activation after normalization at position (x, y). Through the local response normalization operation, a competition mechanism can be created for the activity of local neurons, the value in which the response is larger becomes relatively larger, and the neurons with smaller feedback are inhibited, so that the generalization capability of the model is enhanced.
In an embodiment of the invention, two fully-connected layers can adopt a Dropout technology, and the neuron output of each hidden layer is set to be 0 through a certain probability, so that the adaptive complexity of neurons can be reduced, the regularization effect can be achieved to a certain extent, and the occurrence of overfitting can be better relieved.
In one embodiment of the present invention, since each convolutional layer and fully-connected layer output needs to be activated by the activation function, each convolutional layer and fully-connected layer can be expressed as a linear relationship from the previous layer to the next layer, and the linear relationship can be expressed as:
wherein the content of the first and second substances,for image feature output for input image passing through p-th layer, W p And b p Weight and bias terms, respectively, of the p-th layer, f p Is an activation function. Wherein f is p May be a Relu activation function, whose expression is:
F(g) Re Lu =Max(0,g)
in one embodiment of the present invention, a Sigmoid function can be used as an activation function of the hash layer, and the formula of the Sigmoid function is as follows:
wherein h is i Is the image feature vector output of the hash layer, and β is a hyper-parameter. The output result of the hash layer can be approximated to [0,1] due to the use of the Sigmoid activation function]In between, the length of the generated binary code may be set to be n, the binary code may be obtained through a threshold function, and the expression of the threshold function is:
wherein k is an integer, H i Is the generated binary code.
In an embodiment of the invention, a Hash-AlexNet neural network is trained through an aluminum defect data set to obtain a Hash code of an aluminum defect type, specifically, for a training set in all aluminum defect data sets, the Hash-AlexNet neural network firstly calculates and generates a mean file, for all mean files, further, after all pre-training images enter the Hash-AlexNet neural network, a global mean value in the mean file is subtracted from each pixel point, for an input image, the Hash-AlexNet neural network can randomly cut the input image into 227 × 227 fragments, and train the fragments, finally, feature extraction is performed on the fragments in the training to generate high-dimensional feature vectors of the image, a Hash layer learns the high-dimensional feature vectors to obtain a Hash function, and the Hash function is mapped into the Hash code. The hash layer can generate the hash code by orthogonal projection, and the hash code generated by orthogonal projection can reduce redundancy.
In an embodiment of the invention, the output layer of the Hash-AlexNet neural network can adopt a Softmax loss function, and since the final output of the Hash-AlexNet neural network is the probability distribution of which class the input image belongs to, and the output result with the maximum probability value is the result of classifying the input image by the Hash-AlexNet neural network, the loss function can be minimized by a gradient descent optimization algorithm, and the minimized loss function is obtained by iterative updating and derivation, thereby completing the regression of the Softmax loss function.
And S3, acquiring an aluminum image to be detected, and preprocessing the aluminum image to be detected.
In one embodiment of the invention, a CCD industrial camera can be used for acquiring the image of the aluminum material to be detected. The preprocessing of the aluminum image to be detected may include: and performing smooth filtering treatment on the aluminum material image to be detected by adopting median filtering and performing edge sharpening treatment on the aluminum material image to be detected by adopting a Canny operator. Specifically, the median of the pixel point and the gray value of the neighborhood can be used as the gray value of the pixel point by adopting a median filtering mode, so that the edge details of the image are retained. The Canny operator is superior to other operators in denoising and edge detection, has higher localization and lower error rate, and can make the edge and the contour of the defect image clearer in the aspect of image edge sharpening processing.
And S4, processing the aluminum product image to be detected by using the trained Hash-AlexNet neural network to obtain a Hash code of the aluminum product defect type of the aluminum product image to be detected.
In an embodiment of the invention, the aluminum image to be detected is subjected to feature extraction through a hash function to obtain a hash code of the corresponding image.
And S5, calculating the Hamming distance between the Hash codes of the defect types of the aluminum product defect data set and the Hash codes of the defect types of the aluminum product image to be detected so as to classify the defect types of the aluminum product image to be detected.
In an embodiment of the present invention, the hamming distance is the number of bits with different code values on corresponding bits between one set of hash codes and the other set of hash codes in two sets of hash codes, and the calculation formula of the hamming distance is:
wherein D (s, t) is the Hamming distance, i is an independent variable and the range of i is [0,n-1 ]]S and t are n-bit hash codes,representing an exclusive or. The larger the hamming distance is, the smaller the similarity of the explanatory images is, and conversely, the smaller the hamming distance is, the larger the similarity of the explanatory images is.
According to the aluminum product defect classification method of the Hash-AlexNet neural network based on the Hash algorithm, the Hash-AlexNet neural network is trained through an aluminum product defect data set to obtain the Hash codes of aluminum product defect types, an aluminum product image to be detected is processed to obtain the Hash codes of the aluminum product image to be detected, and finally the defect types of the aluminum product image are classified by calculating the Hamming distance of the two groups of Hash codes, so that the classification speed and accuracy can be improved.
In order to realize the aluminum defect classification method of the Hash-AlexNet neural network based on the Hash algorithm, the invention further provides an aluminum defect classification device of the Hash-AlexNet neural network based on the Hash algorithm.
As shown in fig. 2, the aluminum defect classification device of the Hash-AlexNet neural network based on the Hash algorithm in the embodiment of the present invention includes: a first acquisition unit 10, a training unit 20, a second acquisition unit 30, an image processing unit 40 and a classification unit 50. The first obtaining unit 10 is configured to obtain a sample aluminum product image, and classify a defect of the sample aluminum product image to form an aluminum product defect data set; the training unit 20 is used for training the Hash-AlexNet neural network through the aluminum product defect data set to obtain a Hash code of the aluminum product defect type in the aluminum product defect data set; the second obtaining unit 30 is configured to obtain an image of the aluminum material to be detected, and pre-process the image of the aluminum material to be detected; the image processing unit 40 is configured to process the aluminum product image to be detected by using the trained Hash-AlexNet neural network to obtain a Hash code of the aluminum product defect type of the aluminum product image to be detected; the classification unit 50 is configured to calculate a hamming distance between the hash code of the defect type in the aluminum product defect data set and the hash code of the defect type of the aluminum product image to be detected, so as to classify the defect type of the aluminum product image to be detected.
In one embodiment of the present invention, the first acquiring unit 10 may crawl images of some aluminum material defects from a network or take images of aluminum materials with defects from a factory, a pipeline, or the like to construct an aluminum material defect data set. Wherein the defect types of the aluminum material may include a plurality of cracks, pits, and bending twists.
In an embodiment of the present invention, the Hash-AlexNet neural network is established based on the original AlexNet neural network, and the training of the Hash-AlexNet neural network by the training unit 20 specifically includes the following steps:
and (I) inputting the sample image into a first convolution layer of the Hash-AlexNet neural network, and inputting an output result of the first convolution layer into a first pooling layer to perform Max posing operation.
And (II) inputting the result after the operation of the first pooling layer into the second convolution layer, and inputting the output result of the second convolution base layer into the second pooling layer to carry out Max posing operation.
And (III) inputting the result of the second pooling layer operation into a third convolution layer for convolution operation, and inputting the operation result into a fourth convolution layer for convolution operation.
And (IV) inputting the operation result of the fourth convolution layer into the fifth convolution layer for convolution operation and performing Max posing operation on the input result.
And (V) inputting the output result of the fifth convolutional layer into two full connection layers of the Hash-AlexNet neural network, and inputting the output result of the second full connection layer into the Hash layer of the Hash-AlexNet neural network.
And (VI), inputting the output result of the Hash layer into the last layer of the Hash-AlexNet neural network to perform Softmax operation, and outputting the classification result of the sample image.
In an embodiment of the present invention, the first convolution layer and the second convolution layer are subjected to a local response normalization calculation after convolution, wherein the calculation formula of the local response normalization is:
wherein N is the number of convolution kernels, Σ (. -) represents the mapping of N adjacent kernels converted at the same spatial position, N is the number of adjacent convolution kernels, k, α, β are hyper-parameters,the pixel point representing the position (x, y) calculates the neuron activation degree by applying the kernel,the neuron activation after normalization at the position (x, y) is shown, and i represents the number of channels. Through the local response normalization operation, a competition mechanism can be created for the activity of local neurons, the value in which the response is larger becomes relatively larger, and the neurons with smaller feedback are inhibited, so that the generalization capability of the model is enhanced.
In an embodiment of the invention, two fully-connected layers can adopt a Dropout technology, and the neuron output of each hidden layer is set to be 0 through a certain probability, so that the adaptive complexity of neurons can be reduced, the regularization effect can be achieved to a certain extent, and the occurrence of overfitting can be better relieved.
In one embodiment of the present invention, since each convolutional layer and fully-connected layer output needs to be activated by the activation function, each convolutional layer and fully-connected layer can be expressed as a linear relationship from the previous layer to the next layer, and the linear relationship can be expressed as:
wherein the content of the first and second substances,for the image feature output of the input image passing through the y-th layer, W p And b p Are respectively the weight sum of the first layerOffset term, f p Is an activation function. Wherein f is p May be a Relu activation function, whose expression is:
F(g) Re Lu =Max(0,g)
in one embodiment of the present invention, a Sigmoid function can be used as an activation function of the hash layer, and the formula of the Sigmoid function is as follows:
where hi is the image feature vector output of the hash layer and β is a hyper-parameter. Since the output result of the hash layer can be approximated to [0,1] by using the Sigmoid activation function, the length of the generated binary code can be set to be n, the binary code can be obtained by the threshold function, and the expression of the threshold function is:
wherein k is an integer, H i Is the generated binary code.
In an embodiment of the invention, a Hash-AlexNet neural network is trained through an aluminum defect data set to obtain a Hash code of an aluminum defect type, specifically, for a training set in all aluminum defect data sets, the Hash-AlexNet neural network firstly calculates and generates a mean file, for all mean files, further, after all pre-training images enter the Hash-AlexNet neural network, a global mean value in the mean file is subtracted from each pixel point, for an input image, the Hash-AlexNet neural network can randomly cut the input image into 227 × 227 fragments, and train the fragments, finally, feature extraction is performed on the fragments in the training to generate high-dimensional feature vectors of the image, a Hash layer learns the high-dimensional feature vectors to obtain a Hash function, and the Hash function is mapped into the Hash code. The hash layer can generate the hash code by orthogonal projection, and the hash code generated by orthogonal projection can reduce redundancy.
In an embodiment of the invention, the output layer of the Hash-AlexNet neural network can adopt a Softmax loss function, and since the final output of the Hash-AlexNet neural network is the probability distribution of which class the input image belongs to, and the output result with the maximum probability value is the result of classifying the input image by the Hash-AlexNet neural network, the loss function can be minimized by a gradient descent optimization algorithm, and the minimized loss function is obtained by iterative updating and derivation, thereby completing the regression of the Softmax loss function.
In one embodiment of the present invention, the second acquiring unit 30 may acquire the image of the aluminum material to be detected by using a CCD industrial camera. The preprocessing of the aluminum image to be detected may include: and performing smooth filtering treatment on the aluminum material image to be detected by adopting median filtering and performing edge sharpening treatment on the aluminum material image to be detected by adopting a Canny operator. Specifically, the median of the pixel point and the gray value of the neighborhood can be used as the gray value of the pixel point by adopting a median filtering mode, so that the edge details of the image are retained. The Canny operator is superior to other operators in denoising and edge detection, has higher localization and lower error rate, and can make the edge and the contour of the defect image clearer in the aspect of image edge sharpening processing.
In an embodiment of the present invention, the image processing unit 40 performs feature extraction on the aluminum image to be detected through a hash function to obtain a hash code of the corresponding image.
In an embodiment of the present invention, the hamming distance is the number of bits with different code values on corresponding bits between one set of hash codes and the other set of hash codes in two sets of hash codes, and the calculation formula of the hamming distance is:
wherein D (s, t) is the Hamming distance, i is an independent variable and the range of i is [0,n-1 ]]S and t are n-bit hash codes,representing an exclusive or. The larger the hamming distance is, the smaller the similarity of the explanatory images is, and conversely, the smaller the hamming distance is, the larger the similarity of the explanatory images is.
According to the aluminum product defect classification device of the Hash-AlexNet neural network based on the Hash algorithm, the Hash-AlexNet neural network is trained through the training unit to obtain the Hash codes of aluminum product defect types, the aluminum product images are processed through the image processing unit to obtain the Hash codes of the aluminum product images to be detected, and finally the Hamming distance between the two groups of Hash codes is calculated through the calculating unit to classify the defect types of the aluminum product images, so that the classification speed and accuracy can be improved.
In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The meaning of "plurality" is two or more unless specifically limited otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or may be connected through the use of two elements or the interaction of two elements. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "above," and "over" a second feature may be directly on or obliquely above the second feature, or simply mean that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description of the specification, reference to the description of "one embodiment," "some embodiments," "an example," "a specific example," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried out in the method of implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (10)
1. A Hash-AlexNet neural network aluminum product defect classification method based on a Hash algorithm is characterized by comprising the following steps:
acquiring a sample aluminum product image, and classifying defects of the sample aluminum product image to form an aluminum product defect data set;
training a Hash-AlexNet neural network through the aluminum product defect data set, and obtaining a Hash code of the aluminum product defect type in the aluminum product defect data set;
acquiring an aluminum product image to be detected, and preprocessing the aluminum product image to be detected;
processing the aluminum product image to be detected by using the trained Hash-AlexNet neural network, and obtaining a Hash code of the aluminum product defect type of the aluminum product image to be detected;
and calculating the Hamming distance between the Hash code of the defect type in the aluminum product defect data set and the Hash code of the defect type of the aluminum product image to be detected so as to classify the defect type of the aluminum product image to be detected.
2. The method for classifying the aluminum material defects of the Hash-AlexNet neural network based on the Hash algorithm, according to claim 1, wherein the defect types of the aluminum material comprise a plurality of cracks, pocks and bending twists.
3. The aluminum product defect classification method of the Hash-AlexNet neural network based on the Hash algorithm as claimed in claim 1, wherein training the Hash-AlexNet neural network specifically comprises:
inputting the sample image into a first convolution layer of the Hash-AlexNet neural network, and inputting an output result of the first convolution layer into a first pooling layer to perform Max posing operation;
inputting the result after the operation of the first pooling layer into a second convolution layer, and inputting the output result of the second convolution base layer into the second pooling layer to perform Max posing operation;
inputting the result after the second pooling layer operation into a third convolution layer for convolution operation, and inputting the operation result into a fourth convolution layer for convolution operation;
inputting the operation result of the fourth convolution layer into a fifth convolution layer for convolution operation and performing Max posing operation on the input result;
inputting the output result of the fifth convolutional layer into two full-connection layers of the Hash-AlexNet neural network, and inputting the output result of the second full-connection layer into the Hash layer of the Hash-AlexNet neural network;
and inputting the output result of the Hash layer into the last layer of the Hash-AlexNet neural network for Softmax operation, and outputting the classification result of the sample image.
4. The aluminum product defect classification method of Hash-AlexNet neural network based on Hash algorithm as claimed in claim 3, wherein the first convolution layer and the second convolution layer are processed with local response normalization calculation after convolution, and the calculation formula of local response normalization is:
where N is the number of convolution kernels and Σ (. -) represents in the same spacePosition converting n adjacent kernel mappings, n being the number of adjacent convolution kernels, k, alpha, beta being hyper-parameters,the pixel point representing the position (x, y) calculates the neuron activation degree by applying the kernel,representing the degree of neuronal activation after normalization at position (x, y), i being an independent variable and ranging from [1,N]。
5. The method for classifying the aluminum product defects of the Hash-AlexNet neural network based on the Hash algorithm, according to claim 4, wherein each convolution layer and the full connection layer have a linear relationship from the upper layer to the lower layer, and the linear relationship is expressed as follows:
6. The aluminum product defect classification method of the Hash-AlexNet neural network based on the Hash algorithm as claimed in claim 7, wherein training the Hash-AlexNet neural network through the aluminum product defect data set to obtain the Hash code of the aluminum product defect type specifically includes:
for all training sets in the aluminum product defect data set, the Hash-AlexNet neural network firstly calculates and generates an average value file;
after all the pre-training images enter the Hash-AlexNet neural network, subtracting a global mean value in the mean value file from each pixel point;
for an input image, randomly cutting the input image into fragments with fixed sizes by the Hash-AlexNet neural network, and training the fragments;
and in the training, feature extraction is carried out on the fragments to generate high-dimensional feature vectors of the images, the Hash layer learns the high-dimensional feature vectors to obtain a Hash function, and finally the Hash function is mapped into a Hash code.
7. The aluminum product defect classification method of Hash-AlexNet neural network based on Hash algorithm as claimed in claim 1, wherein the Hash layer adopts Sigmoid activation function, and the formula of the Sigmoid activation function is:
wherein h is i Is the image feature vector output of the hash layer, and β is a hyper-parameter.
8. The aluminum product defect classification method based on the Hash algorithm Hash-AlexNet neural network of claim 1, characterized in that the aluminum product image to be detected is preprocessed, specifically comprising:
performing smooth filtering treatment on the aluminum product image to be detected by adopting median filtering;
and carrying out edge sharpening on the aluminum material image to be detected by adopting a Canny operator.
9. The aluminum product defect classification method of Hash-AlexNet neural network based on Hash algorithm as claimed in claim 7, wherein the calculation formula of Hamming distance is:
10. A Hash algorithm-based aluminum product defect classification device of a Hash-AlexNet neural network is characterized by comprising the following components:
the aluminum product defect detection method comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a sample aluminum product image and classifying defects of the sample aluminum product image to form an aluminum product defect data set;
the training unit is used for training a Hash-AlexNet neural network through the aluminum product defect data set to obtain a Hash code of the aluminum product defect type in the aluminum product defect data set;
the second acquisition unit is used for acquiring an aluminum product image to be detected and preprocessing the aluminum product image to be detected;
the image processing unit is used for processing the aluminum product image to be detected by using the trained Hash-AlexNet neural network so as to obtain a Hash code of the aluminum product defect type of the aluminum product image to be detected;
and the classification unit is used for calculating the Hamming distance between the Hash code of the defect type in the aluminum product defect data set and the Hash code of the defect type of the aluminum product image to be detected so as to classify the defect type of the aluminum product image to be detected.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211472589.6A CN115760800A (en) | 2022-11-18 | 2022-11-18 | Aluminum product defect classification method and device based on Hash algorithm and Hash-AlexNet neural network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211472589.6A CN115760800A (en) | 2022-11-18 | 2022-11-18 | Aluminum product defect classification method and device based on Hash algorithm and Hash-AlexNet neural network |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115760800A true CN115760800A (en) | 2023-03-07 |
Family
ID=85335787
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211472589.6A Pending CN115760800A (en) | 2022-11-18 | 2022-11-18 | Aluminum product defect classification method and device based on Hash algorithm and Hash-AlexNet neural network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115760800A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117036255A (en) * | 2023-07-21 | 2023-11-10 | 北京北排建设有限公司 | Pipeline defect detection and evaluation method and device based on deep learning |
-
2022
- 2022-11-18 CN CN202211472589.6A patent/CN115760800A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117036255A (en) * | 2023-07-21 | 2023-11-10 | 北京北排建设有限公司 | Pipeline defect detection and evaluation method and device based on deep learning |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Zhang et al. | The application of one-class classifier based on CNN in image defect detection | |
KR101982231B1 (en) | Object recognition apparatus and controlling method thereof | |
CN111105032B (en) | Chromosome structure abnormality detection method, system and storage medium based on GAN | |
CN110653169B (en) | Garbage treatment method and device and terminal equipment | |
CN111191514A (en) | Hyperspectral image band selection method based on deep learning | |
CN110472695B (en) | Abnormal working condition detection and classification method in industrial production process | |
CN111539343A (en) | Black smoke vehicle detection method based on convolution attention network | |
CN115760800A (en) | Aluminum product defect classification method and device based on Hash algorithm and Hash-AlexNet neural network | |
CN115294563A (en) | 3D point cloud analysis method and device based on Transformer and capable of enhancing local semantic learning ability | |
CN114419413A (en) | Method for constructing sensing field self-adaptive transformer substation insulator defect detection neural network | |
CN114580934A (en) | Early warning method for food detection data risk based on unsupervised anomaly detection | |
CN114037888A (en) | Joint attention and adaptive NMS (network management System) -based target detection method and system | |
Lu et al. | Detection and classification of bearing surface defects based on machine vision | |
CN115564983A (en) | Target detection method and device, electronic equipment, storage medium and application thereof | |
Prasad et al. | A study of dimensionality reduction in GLCM feature-based classification of machined surface images | |
CN116823677B (en) | Image enhancement method and device, storage medium and electronic equipment | |
CN111681236B (en) | Target density estimation method with attention mechanism | |
Rahmi et al. | Offline signature recognition using back propagation neural network | |
CN117523555A (en) | Aircraft part defect detection method based on self-encoder | |
Lu et al. | Bearing defect classification algorithm based on autoencoder neural network | |
CN116823852A (en) | Strip-shaped skin scar image segmentation method and system based on convolutional neural network | |
CN110766662A (en) | Forging surface crack detection method based on multi-scale and multi-layer feature learning | |
CN115861226A (en) | Method for intelligently identifying surface defects by using deep neural network based on characteristic value gradient change | |
CN116091823A (en) | Single-feature anchor-frame-free target detection method based on fast grouping residual error module | |
CN115829942A (en) | Electronic circuit defect detection method based on non-negative constraint sparse self-encoder |
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 |