CN112734016A - Training method of neural network for detecting smoothness of surface of steel bar - Google Patents

Training method of neural network for detecting smoothness of surface of steel bar Download PDF

Info

Publication number
CN112734016A
CN112734016A CN202110074303.8A CN202110074303A CN112734016A CN 112734016 A CN112734016 A CN 112734016A CN 202110074303 A CN202110074303 A CN 202110074303A CN 112734016 A CN112734016 A CN 112734016A
Authority
CN
China
Prior art keywords
feature map
neural network
image
steel bar
smoothness
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.)
Withdrawn
Application number
CN202110074303.8A
Other languages
Chinese (zh)
Inventor
翁志华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Guipotuo Technology Co ltd
Original Assignee
Chengdu Guipotuo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Guipotuo Technology Co ltd filed Critical Chengdu Guipotuo Technology Co ltd
Priority to CN202110074303.8A priority Critical patent/CN112734016A/en
Publication of CN112734016A publication Critical patent/CN112734016A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Quality & Reliability (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

The application relates to intelligent state detection in the field of intelligent manufacturing, and particularly discloses a neural network training method for detecting the smoothness of a steel bar surface. The training method comprises the step of training the neural network for detecting the smoothness degree of the surface of the steel bar in two stages. In the first stage, a convolutional neural network for detecting the smoothness of the surface of the steel bar is trained based on the idea of counterlearning by taking an actually shot steel bar surface image and a computer three-dimensional modeling image of the steel bar as a reference image, so that the convolutional neural network can pay more attention to shape features in the image. In a second phase, the convolutional neural network is updated by computing the differential signatures between the signatures and by back propagation of gradient descent, so that it is further able to focus more on irregularities in the surface shape of the rebar. Thus, the trained convolutional neural network can improve the detection accuracy of the condition of the smoothness of the surface of the steel bar.

Description

Training method of neural network for detecting smoothness of surface of steel bar
Technical Field
The present application relates to intelligent state detection in the field of intelligent manufacturing, and more particularly, to a neural network training method for detecting the smoothness of a surface of a steel bar, a method for detecting the smoothness of a surface of a steel bar based on a deep neural network, a neural network training system for detecting the smoothness of a surface of a steel bar, a system for detecting the smoothness of a surface of a steel bar based on a deep neural network, and an electronic device.
Background
The reinforcing bar is when tentatively accomplishing production, and the surface of reinforcing bar is not smooth and flat, and the surface of reinforcing bar generally still remains there is more burr, and then follow-up needs to reinforcing bar processing, generally all can polish the surface of reinforcing bar to carry out the shear of regulation length to the reinforcing bar. Before practical construction application, the surface of the steel bar is usually polished and the smoothness of the shearing section is detected, so that the damage to constructors in the construction process is avoided.
Currently, the smoothness of such surfaces is basically determined by manual inspection, and with the development of computer vision technology, it is also expected that automatic inspection based on images can be performed by applying computer vision technology based on deep neural networks.
Therefore, an automatic detection scheme for detecting the smoothness of the surface of the steel bar is desired.
At present, deep learning and neural networks have been widely applied in the fields of computer vision, natural language processing, text signal processing, and the like. In addition, deep learning and neural networks also exhibit a level close to or even exceeding that of humans in the fields of image classification, object detection, semantic segmentation, text translation, and the like.
In recent years, deep learning and development of neural networks provide new solutions for detecting the smoothness of the surface of the steel bar.
Disclosure of Invention
The embodiment of the application provides a method for detecting the smoothness of a steel bar surface based on a deep neural network, a training system of the neural network for detecting the smoothness of the steel bar surface, a system for detecting the smoothness of the steel bar surface based on the deep neural network and an electronic device, wherein the training method trains the neural network for detecting the smoothness of the steel bar surface in two stages. In the first stage, a convolutional neural network for detecting the smoothness of the surface of the steel bar is trained based on the idea of counterlearning by taking an actually shot steel bar surface image and a computer three-dimensional modeling image of the steel bar as a reference image, so that the convolutional neural network can pay more attention to shape features in the image. In a second phase, the convolutional neural network is updated by computing the differential signatures between the signatures and by back propagation of gradient descent, so that it is further able to focus more on irregularities in the surface shape of the rebar. Thus, the trained convolutional neural network can improve the detection accuracy of the condition of the smoothness of the surface of the steel bar.
According to one aspect of the present application, there is provided a training method of a neural network for smoothness detection of a surface of a steel bar, comprising:
the first stage is as follows:
acquiring a first image and a second image, wherein the first image is an image of a practically produced reinforcing steel bar and the second image is an image of a computer three-dimensional modeling reinforcing steel bar;
passing the first image through a first convolutional neural network to obtain a first feature map;
passing the second image through a second convolutional neural network to obtain a second feature map, wherein the second convolutional neural network has the same network structure as the first convolutional neural network;
inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value;
decreasing the discriminator loss function value by a preset step size and updating the parameters of the first convolutional neural network by back propagation of gradient descent;
and a second stage:
passing the first image through the first convolutional neural network trained in the first stage to obtain a third feature map;
calculating a difference between the third feature map and the second feature map to obtain a difference feature map;
passing the differential feature map through a classifier to obtain a classification loss function value; and
reducing the classification loss function value by a preset step size, and updating the parameters of the first convolutional neural network through back propagation of gradient descent.
In a training method of a neural network for smoothness detection of a surface of a reinforcing bar according to the present application, inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value, comprising: inputting the first feature map into the discriminator neural network to obtain a fourth feature map; inputting the second feature map into the discriminator neural network to obtain a fifth feature map; determining whether the values of the predetermined positions in the fourth feature map and the fifth feature map are the same; in response to the values of the predetermined positions in the fourth feature map and the fifth feature map being the same, calculating a negative value of a base two logarithm of the values of the predetermined positions as a first value; in response to the values of the predetermined positions in the fourth feature map and the fifth feature map being different, calculating a base two logarithmic value of the values of the predetermined positions as a second value; and calculating the sum of the average value of the positions where the first values are the same in value and the average value of the positions where the second values are different in value as the discriminator loss function value.
In the training method of a neural network for smoothness detection of a surface of a reinforcing bar according to the present application, the discriminator neural network includes a preset number of convolution layers of a preset size.
In the training method of the neural network for detecting the smoothness of the surface of the steel bar according to the application, calculating a difference between the third feature map and the second feature map to obtain a difference feature map, including: and calculating the difference of the characteristic values of the third characteristic diagram and the second characteristic diagram according to the pixel positions to obtain the difference characteristic diagram.
In the training method of the neural network for detecting the smoothness of the surface of the steel bar according to the application, the differential feature map is passed through a classifier to obtain a classification loss function value, and the method comprises the following steps: passing the differential feature map through one or more fully connected layers to obtain a classification feature vector; inputting the classification characteristic vector into a classification function to obtain a classification result, wherein the classification result is used for indicating whether the smoothness of the surface of the steel bar meets a preset requirement or not; and inputting the classification result and the real value into a cross entropy loss function to obtain the classification loss function value.
In the training method of the neural network for detecting the smoothness of the surface of the steel bar, the first convolution neural network is a deep residual error network
According to another aspect of the present application, there is provided a method for detecting smoothness of a surface of a steel bar based on a deep neural network, including:
acquiring an image to be detected, wherein the image to be detected is an image of the surface of a steel bar to be detected;
inputting the image to be detected into the first convolution neural network trained according to the neural network training method for detecting the smoothness of the surface of the steel bar so as to obtain a classification characteristic diagram;
the classification characteristic diagram is processed by a classifier to obtain a classification result, and the classification result shows whether the smoothness of the surface of the steel bar in the image to be detected meets the preset requirement or not
According to yet another aspect of the present application, there is provided a training system of a neural network for smoothness detection of a surface of a reinforcing bar, including:
a first training module comprising:
the training image acquisition unit is used for acquiring a first image and a second image, wherein the first image is an image of a practically produced reinforcing steel bar and the second image is an image of a computer three-dimensional modeling reinforcing steel bar;
a first feature map generation unit, configured to pass the first image obtained by the training image obtaining unit through a first convolutional neural network to obtain a first feature map;
a second feature map generation unit, configured to pass the second image obtained by the training image obtaining unit through a second convolutional neural network to obtain a second feature map, where the second convolutional neural network and the first convolutional neural network have the same network structure;
a discriminator loss function value generating unit configured to input the first feature map obtained by the first feature map generating unit and the second feature map obtained by the second feature map generating unit into a discriminator neural network to obtain a discriminator loss function value;
a first parameter updating unit configured to reduce the discriminator loss function value obtained by the discriminator loss function value generating unit by a preset step size and update a parameter of the first convolutional neural network by back propagation of gradient descent
A second training module comprising:
a third feature map generation unit, configured to pass the first image obtained by the training image obtaining unit through the first convolutional neural network trained in the first stage to obtain a third feature map;
a difference feature map generation unit configured to calculate a difference between the third feature map obtained by the third feature map generation unit and the second feature map obtained by the second feature map generation unit to obtain a difference feature map;
a classification loss function value calculation unit, configured to pass the differential feature map obtained by the differential feature map generation unit through a classifier to obtain a classification loss function value; and
a second parameter updating unit for reducing the classification loss function value obtained by the classification loss function value calculating unit by a preset step length and updating the parameter of the first convolutional neural network by back propagation of gradient descent
In the above training system for a neural network for detecting a smoothness of a surface of a reinforcing bar, the discriminator loss function value generating unit includes: a fourth feature map generation subunit, configured to input the first feature map into the discriminator neural network to obtain a fourth feature map; a fifth feature map generation subunit, configured to input the second feature map into the discriminator neural network to obtain a fifth feature map; a feature value judgment subunit, configured to determine whether values of predetermined positions in the fourth feature map and the fifth feature map are the same; a first value assignment subunit, configured to, in response to that the values of the predetermined positions in the fourth feature map and the fifth feature map are the same, calculate a negative value of a base-two logarithm value of the values of the predetermined positions as a first value; a second value assignment subunit, configured to, in response to that values of predetermined positions in the fourth feature map and the fifth feature map are different, calculate a base-two logarithmic value of the predetermined position as a second value; and a discriminator loss function value calculation operator unit for calculating a sum of the average value of the positions where the first values are the same in value and the average value of the positions where the second values are different in value as the discriminator loss function value.
In the training system of the neural network for detecting the smoothness of the surface of the steel bar, the discriminator neural network includes a preset number of convolutional layers with preset sizes.
In the training system of the neural network for detecting the smoothness of the surface of the steel bar, the difference feature map generation unit is further configured to calculate a difference between feature values of the third feature map and the second feature map by pixel position to obtain the difference feature map.
In the above training system for a neural network used for detecting the smoothness of the surface of a steel bar, the classification loss function value calculation unit includes: the classified feature vector generation subunit is used for enabling the differential feature map to pass through one or more fully-connected layers so as to obtain a classified feature vector; the classification result generation subunit is used for inputting the classification characteristic vectors into a classification function to obtain a classification result, and the classification result is used for indicating whether the smoothness of the surface of the steel bar meets a preset requirement or not; and the loss function value calculation operator unit is used for inputting the classification result and the real value into the cross entropy loss function so as to obtain the classification loss function value.
In the training system of the neural network for detecting the smoothness of the surface of the steel bar, the first convolution neural network is a depth residual error network.
According to still another aspect of the present application, there is provided a system for detecting smoothness of a surface of a steel bar based on a deep neural network, including:
the device comprises an image acquisition unit to be detected, a detection unit and a control unit, wherein the image acquisition unit to be detected is used for acquiring an image to be detected, and the image to be detected is an image of the surface of a steel bar to be detected;
the classification characteristic diagram generating unit is used for inputting the image to be detected obtained by the image to be detected obtaining unit into the first convolution neural network trained according to the neural network training method for detecting the smoothness of the surface of the steel bar so as to obtain a classification characteristic diagram; and
and the classification result generating unit is used for enabling the classification characteristic diagram obtained by the classification characteristic diagram generating unit to pass through a classifier so as to obtain a classification result, and the classification result represents whether the smoothness of the surface of the steel bar in the image to be detected meets a preset requirement or not.
According to still another aspect of the present application, there is provided an electronic apparatus including: a processor; and a memory in which computer program instructions are stored, which, when executed by the processor, cause the processor to perform the method of training a neural network for smoothness detection of a surface of a steel bar as described above, or the method of detecting smoothness of a surface of a steel bar based on a deep neural network as described above.
According to yet another aspect of the present application, there is provided a computer readable medium having stored thereon computer program instructions which, when executed by a processor, cause the processor to execute the method of training a neural network for smoothness detection of a steel bar surface as described above, or the method of detecting smoothness of a steel bar surface based on a deep neural network as described above.
Compared with the prior art, the method for detecting the smoothness of the surface of the steel bar based on the deep neural network, the training system for the neural network for detecting the smoothness of the surface of the steel bar, the system for detecting the smoothness of the surface of the steel bar based on the deep neural network and the electronic device are provided, wherein the training method is used for training the neural network for detecting the smoothness of the surface of the steel bar in two stages. In the first stage, a convolutional neural network for detecting the smoothness of the surface of the steel bar is trained based on the idea of counterlearning by taking an actually shot steel bar surface image and a computer three-dimensional modeling image of the steel bar as a reference image, so that the convolutional neural network can pay more attention to shape features in the image. In a second phase, the convolutional neural network is updated by computing the differential signatures between the signatures and by back propagation of gradient descent, so that it is further able to focus more on irregularities in the surface shape of the rebar. Thus, the trained convolutional neural network can improve the detection accuracy of the condition of the smoothness of the surface of the steel bar.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in more detail embodiments of the present application with reference to the attached drawings. The accompanying drawings are included to provide a further understanding of the embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings, like reference numbers generally represent like parts or steps.
Fig. 1 illustrates an application scenario diagram of a training method of a neural network for detecting the smoothness of a steel bar surface and a detection method of the smoothness of a steel bar surface based on a deep neural network according to an embodiment of the present application.
Fig. 2 illustrates a flow chart of a training method of a neural network for smoothness detection of a surface of a steel bar according to an embodiment of the present application.
Fig. 3 illustrates an architecture diagram of a training method of a neural network for smoothness detection of a steel bar surface according to an embodiment of the present application.
Fig. 4 is a flowchart illustrating inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value in a training method of a neural network for smoothness detection of a steel bar surface according to an embodiment of the present application.
Fig. 5 is a flowchart illustrating the differential feature map is passed through a classifier to obtain a classification loss function value in a training method of a neural network for detecting smoothness of a steel bar surface according to an embodiment of the present application.
Fig. 6 illustrates a flowchart of a method for detecting smoothness of a surface of a steel bar based on a deep neural network according to an embodiment of the present application.
Fig. 7 illustrates a block diagram of a training system for a neural network for smoothness detection of a rebar surface according to an embodiment of the present application.
Fig. 8 illustrates a block diagram of a discriminator loss function value generating unit in a training system of a neural network for smoothness detection of a surface of a reinforcing bar according to an embodiment of the present application.
Fig. 9 illustrates a block diagram of a classification loss function value calculation unit in a training system of a neural network for smoothness detection of a steel bar surface according to an embodiment of the present application.
Fig. 10 illustrates a block diagram of a system for detecting the smoothness of a surface of a rebar based on a deep neural network in accordance with an embodiment of the present application.
FIG. 11 illustrates a block diagram of an electronic device in accordance with an embodiment of the present application.
Detailed Description
Hereinafter, example embodiments according to the present application will be described in detail with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of the present application and not all embodiments of the present application, and that the present application is not limited by the example embodiments described herein.
Overview of a scene
As mentioned above, when the reinforcing steel bar is produced preliminarily, the surface of the reinforcing steel bar is not smooth and flat, more burrs are generally remained on the surface of the reinforcing steel bar, and then the surface of the reinforcing steel bar is generally ground and sheared by a specified length according to the processing requirement of the reinforcing steel bar. Before practical construction application, the surface of the steel bar is usually polished and the smoothness of the shearing section is detected, so that the damage to constructors in the construction process is avoided.
Currently, the smoothness of such surfaces is basically determined by manual inspection, and with the development of computer vision technology, it is also expected that automatic inspection based on images can be performed by applying computer vision technology based on deep neural networks.
Therefore, an automatic detection scheme for detecting the smoothness of the surface of the steel bar is desired.
In the application process, the applicant of the application finds that, because the detection of the smoothness degree of the surface of the steel bar is influenced by factors such as the shape and the light reflection of the surface of the steel bar, when the image of the surface of the steel bar is directly passed through the convolutional neural network and classification training is carried out, the training speed and the training precision are influenced, and therefore, other reference conditions are introduced to further promote the convergence of parameters of the convolutional neural network during training.
Therefore, in the technical scheme of the application, a two-stage training scheme is adopted, in the first stage, a computer three-dimensional modeling image of the steel bar is obtained, and the artificial image actually comprises information on the structural shape of the steel bar, so that noise factors such as surface reflection and the like are eliminated compared with the actual steel bar image. That is, when a computer three-dimensional modeled image of a reinforcing bar is used as a reference image, some non-shaped image elements in the actual image are actually treated as noise. Therefore, the actually shot steel bar surface image and the computer three-dimensional modeling image of the steel bar are respectively used for obtaining the first feature map and the second feature map through the first convolutional neural network and the second convolutional neural network, and the discriminator loss function value between the first feature map and the second feature map is calculated.
Then, in a second stage, calculating a differential feature map of the first feature map and the second feature map, wherein the differential feature map can relatively accurately reflect the difference between the actual steel bar shape and the steel bar shape modeled in three dimensions by the computer because the first convolution neural network is trained to focus on the shape feature in the image, so as to characterize the irregular part of the steel bar surface, namely the feature of the non-smooth part in the high-dimensional space. Then, the differential feature map is used for obtaining a classification loss function value through a classifier, so that whether the irregularity of the surface shape of the steel bar is concerned by the first convolution neural network or not can be trained to be judged to influence the smoothness degree of the surface of the steel bar
Based on this, the application provides a training method of a neural network for smoothness detection of a surface of a steel bar, which comprises the following steps: the first stage is as follows: acquiring a first image and a second image, wherein the first image is an image of a practically produced reinforcing steel bar and the second image is an image of a computer three-dimensional modeling reinforcing steel bar; passing the first image through a first convolutional neural network to obtain a first feature map; passing the second image through a second convolutional neural network to obtain a second feature map, wherein the second convolutional neural network has the same network structure as the first convolutional neural network; inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value; decreasing the discriminator loss function value by a preset step size and updating the parameters of the first convolutional neural network by back propagation of gradient descent; and, a second stage: passing the first image through the first convolutional neural network trained in the first stage to obtain a third feature map; calculating a difference between the third feature map and the second feature map to obtain a difference feature map; passing the differential feature map through a classifier to obtain a classification loss function value; and reducing the classification loss function value by a preset step size and updating the parameters of the first convolutional neural network through back propagation of gradient descent
Based on this, the application also provides a method for detecting the smoothness of the surface of the steel bar based on the deep neural network, which comprises the following steps: acquiring an image to be detected, wherein the image to be detected is an image of the surface of a steel bar to be detected; inputting the image to be detected into the first convolution neural network trained according to the neural network training method for detecting the smoothness of the surface of the steel bar so as to obtain a classification characteristic diagram; and the classification characteristic graph is processed by a classifier to obtain a classification result, and the classification result represents whether the smoothness of the surface of the steel bar in the image to be detected meets a preset requirement or not.
Fig. 1 illustrates an application scenario diagram of a training method of a neural network for detecting the smoothness of a steel bar surface and a detection method of the smoothness of a steel bar surface based on a deep neural network according to an embodiment of the present application.
As shown in fig. 1, in this application scenario, in the training phase, a camera (e.g., C as illustrated in fig. 1) is used to acquire a surface image of the actually produced rebar and to acquire a surface image of the computer three-dimensionally modeled rebar. Then, the surface image of the actually produced reinforcing steel bar and the surface image of the computer three-dimensional modeled reinforcing steel bar are input into a server (for example, S as illustrated in fig. 1) deployed with a training algorithm of a neural network for smoothness detection of the surface of the reinforcing steel bar, wherein the server is capable of training the neural network for smoothness detection of the surface of the reinforcing steel bar with the surface image of the actually produced reinforcing steel bar and the surface image of the computer three-dimensional modeled reinforcing steel bar as a data set based on the training algorithm of the neural network for smoothness detection of the surface of the reinforcing steel bar.
After the training is completed, in the inspection phase, the surface image of the actually produced reinforcing bar acquired by the camera (e.g., C as illustrated in fig. 1) is taken as an image to be inspected. Then, the image to be detected is input into a server (for example, S as illustrated in fig. 1) deployed with a detection algorithm for detecting the smoothness of the surface of the steel bar based on the deep neural network, where the server can process the image to be detected by using the detection algorithm for detecting the smoothness of the surface of the steel bar based on the deep neural network to generate a detection result indicating whether the smoothness of the surface of the steel bar in the image to be detected meets a preset requirement.
Having described the general principles of the present application, various non-limiting embodiments of the present application will now be described with reference to the accompanying drawings.
Exemplary method
Fig. 2 illustrates a flow chart of a training method of a neural network for smoothness detection of a surface of a steel bar according to an embodiment of the present application. As shown in fig. 2, the training method of the neural network for detecting the smoothness of the surface of the steel bar according to the embodiment of the present application includes two stages of training, wherein the first stage includes: s110, acquiring a first image and a second image, wherein the first image is an image of a practically produced reinforcing steel bar and the second image is an image of a reinforcing steel bar subjected to three-dimensional modeling by a computer; s120, passing the first image through a first convolutional neural network to obtain a first feature map; s130, enabling the second image to pass through a second convolutional neural network to obtain a second feature map, wherein the second convolutional neural network and the first convolutional neural network have the same network structure; s140, inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value; and, S150, reducing the discriminator loss function value by a preset step size, and updating the parameters of the first convolutional neural network by back propagation of gradient descent; and, a second stage comprising: s160, passing the first image through the first convolutional neural network trained in the first stage to obtain a third feature map; s170, calculating the difference between the third feature map and the second feature map to obtain a difference feature map; s180, passing the differential feature map through a classifier to obtain a classification loss function value; and S190, reducing the classification loss function value by a preset step size, and updating the parameters of the first convolution neural network through the back propagation of gradient descent.
Fig. 3 illustrates an architecture diagram of a training method of a neural network for smoothness detection of a steel bar surface according to an embodiment of the present application. As shown IN fig. 3, IN the network architecture of the training method, IN a first stage, first, an acquired first image (e.g., IN1 as illustrated IN fig. 3) is passed through a first convolutional neural network (e.g., CNN1 as illustrated IN fig. 3) to obtain a first feature map (e.g., F1 as illustrated IN fig. 3), wherein the first image is an image of actually produced rebar; then, passing the obtained second image (for example, IN2 as illustrated IN fig. 3) through a second convolutional neural network (for example, CNN2 as illustrated IN fig. 3) to obtain a second feature map (for example, F2 as illustrated IN fig. 3), wherein the second image is an image of a computer three-dimensional modeled steel bar, and IN the network architecture, the second convolutional neural network has the same network structure as the first convolutional neural network; then, inputting the first feature map and the second feature map into a discriminator neural network (e.g., DN as illustrated in fig. 3) to obtain a discriminator loss function value; and further, decreasing the discriminator loss function value by a preset step size, and updating the parameters of the first convolutional neural network through the back propagation of gradient descent. Then, in a second stage, passing the acquired first image through the first convolutional neural network (e.g., CNN 1' as illustrated in fig. 3) trained in the first stage to obtain a third feature map (e.g., F3 as illustrated in fig. 3); then, calculating a difference between the third feature map and the second feature map to obtain a difference feature map (e.g., Fd as illustrated in fig. 3); then, the differential feature map passes through a classifier to obtain a classification loss function value; and further, reducing the classification loss function value by a preset step size, and updating the parameters of the first convolution neural network through the back propagation of gradient descent.
In the first stage of training, in step S110, a first image and a second image are obtained, wherein the first image is an image of a steel bar actually produced and the second image is an image of a steel bar modeled in three dimensions by a computer. As described above, in the technical solution of the present application, since the detection of the smoothness of the surface of the steel bar is influenced by the shape of the surface of the steel bar and the reflection of light, in the embodiment of the present application, in the training process, the computer three-dimensional modeling image of the steel bar is used as the reference image, and the reference image actually includes the information on the structural shape of the steel bar, so that noise factors such as the reflection of light on the surface are excluded from the actual steel bar image. That is, when a computer three-dimensional modeled image of a reinforcing bar is used as a reference image, some non-shaped image elements in the actual image are actually treated as noise.
In specific implementation, the surface pattern of the actually produced reinforcing steel bar can be collected through a camera. The image of the computer three-dimensionally modeled rebar can be derived by computer-aided design software such as CAD, pro, and the like.
In a first stage of training, in step S120, the first image is passed through a first convolutional neural network to obtain a first feature map. That is, an image of an actually produced steel bar is passed through a first convolutional neural network, so as to extract a high-dimensional implicit feature in the first image through the first convolutional neural network.
Those skilled in the art will appreciate that the deep convolutional neural network has excellent performance in extracting local spatial features of an image. In one particular example of the present application, the deep convolutional neural network is implemented as a deep residual network, e.g., ResNet 50. It should be known to those skilled in the art that, compared to the conventional convolutional neural network, the deep residual network is an optimized network structure proposed on the basis of the conventional convolutional neural network, which mainly solves the problem of gradient disappearance during the training process. The depth residual error network introduces a residual error network structure, the network layer can be made deeper through the residual error network structure, and the problem of gradient disappearance can not occur. The residual error network uses the cross-layer link thought of a high-speed network for reference, breaks through the convention that the traditional neural network only can provide N layers as input from the input layer of the N-1 layer, enables the output of a certain layer to directly cross several layers as the input of the later layer, and has the significance of providing a new direction for the difficult problem that the error rate of the whole learning model is not reduced and inversely increased by superposing multiple layers of networks.
In the first stage of training, in step S130, the second image is passed through a second convolutional neural network to obtain a second feature map, wherein the second convolutional neural network has the same network structure as the first convolutional neural network. That is, the image of the computer three-dimensionally modeled rebar is processed, also with a convolutional neural network, to extract the high-dimensional implicit features in the second image. In particular, in the embodiment of the present application, the second convolutional neural network has the same network structure as the first convolutional neural network, which is beneficial to reduce the amount of computation in the training process on one hand, and enables the obtained first feature map and the second feature map to have the same scale so as to facilitate subsequent computation on the other hand.
In the first stage of training, the first feature map and the second feature map are input to a discriminator neural network to obtain a discriminator loss function value in step S140. That is, along with the idea of countering learning, the discriminator loss function value between the first feature map and the second feature map is calculated, and the first convolutional neural network is trained so as to focus more on the shape feature in the image.
Specifically, in this embodiment of the present application, the process of inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value includes: first, the first feature map is input to the discriminator neural network to obtain a fourth feature map. Here, the discriminator neural network includes a preset number of convolutional layers of a preset size, for example, 4 convolutional layers of 2 × 2, the step size of each convolutional layer is 2, the number of channels of the 4 convolutional layers is 256, 128, 64, and 1, respectively, and the last layer is activated with a sigmoid function to ensure that the output is in the range of 0 to 1.
Then, the second feature map is input to the discriminator neural network to obtain a fifth feature map. That is, the second feature map is also input to the discriminator neural network to extract implicit features of higher dimensionality.
Further, the discriminator loss function value is calculated based on the fourth feature map and the fifth feature map. Specifically, in the embodiment of the present application, the discriminator loss function value is calculated by the following formula:
Figure BDA0002907012340000131
wherein F3 denotes the fourth characteristic diagram, and F4 denotes the fifth characteristic diagram.
That is, in the embodiment of the present application, the process of calculating the discriminator loss function value based on the fourth feature map and the fifth feature map includes: firstly, determining whether the values of the preset positions in the fourth feature map and the fifth feature map are the same; then, in response to the values of the predetermined positions in the fourth feature map and the fifth feature map being the same, calculating a negative value of a base two logarithm of the values of the predetermined positions as a first value; in contrast, in response to the values of the predetermined positions in the fourth feature map and the fifth feature map being different, calculating a base two logarithmic value of the values of the predetermined positions as a second value; further, the sum of the average value of the positions where the first values are the same in value and the average value of the positions where the second values are different in value is calculated as the discriminator loss function value.
It will be appreciated that updating the first convolutional neural network by the discriminator loss function values means that the features extracted by the first convolutional neural network are made similar to those extracted by the second convolutional neural network by "spoofing" the discriminator, i.e. the first convolutional neural network is trained to focus more on shape features in the image, while some non-shape image elements are treated as noise for filtering.
Fig. 4 is a flowchart illustrating inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value in a training method of a neural network for smoothness detection of a steel bar surface according to an embodiment of the present application. As shown in fig. 4, in the embodiment of the present application, a flowchart for inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value includes: s210, inputting the first feature map into the discriminator neural network to obtain a fourth feature map; s220, inputting the second feature map into the discriminator neural network to obtain a fifth feature map; s230, determining whether the values of the preset positions in the fourth feature map and the fifth feature map are the same; s240, responding to the fact that the values of the preset positions in the fourth feature map and the fifth feature map are the same, and calculating a negative value of a base two logarithm value of the preset position as a first value; s250, in response to the fact that the values of the preset positions in the fourth feature map and the fifth feature map are different, calculating a logarithm value of the preset position with the base of two as a second value; and S260, calculating the sum of the average value of the positions with the same value of the first value and the average value of the positions with different values of the second value as the discriminator loss function value.
In the first stage of training, the discriminator loss function value is reduced by a preset step size and the parameters of the first convolutional neural network are updated by the back propagation of gradient descent in step S150. This is the conventional process of deep neural network training, i.e., updating the parameters of the convolutional neural network by backpropagation of gradient descent. It should be appreciated that training the first convolutional neural network with the discriminator loss function value may make the first convolutional neural network more focused on shape features in the image.
In the second stage of training, in step S160, the first image is passed through the first convolutional neural network trained in the first stage to obtain a third feature map. That is, after the first convolutional neural network is trained in a first stage with a discriminator loss function value, the first image is input to the first convolutional neural network trained in the first stage to extract implicit features of a higher dimension from the first image, where the third feature map focuses more on shape features in the first image.
In the second stage of training, in step S170, a difference between the third feature map and the second feature map is calculated to obtain a difference feature map. That is, a difference feature map of the first feature map and the second feature map is calculated. It should be appreciated that since the first convolutional neural network is trained to focus on shape features in the image in the first stage, the differential feature map can relatively accurately reflect the differences between the actual rebar shape and the computer three-dimensional modeled rebar shape, thereby characterizing the irregular portions of the rebar surface, i.e., the non-smooth portions, in the high-dimensional space.
In a specific implementation, the per-pixel difference between the third feature map and the fourth feature map may be calculated to calculate the difference in the high-dimensional space of the third feature map and the fourth feature map at the pixel level.
In the second stage of training, in step S180, the difference feature map is passed through a classifier to obtain a classification loss function value. That is, the differential feature map is passed through a classifier to obtain classification results for which the differential feature map is attributed to labels of the classifier, so that the classification loss function value can be constructed based on the difference between the classification results and the true values. Accordingly, updating the first convolution neural network with the classification loss function value can make the first convolution neural network focus on whether the irregularity of the surface shape of the steel bar belongs to a situation that should be judged to affect the smoothness of the steel bar surface.
More specifically, in the embodiment of the present application, the process of passing the differential feature map through a classifier to obtain a classification loss function value includes: firstly, the differential characteristic diagram is coded, specifically, the differential characteristic diagram is coded by one or more full-connection layers, and the information of each position in the differential characteristic diagram can be fully utilized by the full-connection layers so as to improve the coding precision. The classification feature vector is then input into a classification function, e.g., a Softmax classification function, to obtain a classification result. Specifically, the classification result is: the smoothness degree of the surface of the steel bar meets a first probability of a preset requirement; and the smoothness degree of the surface of the steel bar does not meet a second probability of the preset requirement; then, based on the first probability and the second probability, a final classification result is determined. The final classification results and the true values (supervised learning) are then input to a loss function, which may be, for example, a cross-entropy loss function, to obtain the classification loss function values.
Fig. 5 is a flowchart illustrating the differential feature map is passed through a classifier to obtain a classification loss function value in a training method of a neural network for detecting smoothness of a steel bar surface according to an embodiment of the present application. As shown in fig. 5, in the embodiment of the present application, passing the differential feature map through a classifier to obtain a classification loss function value includes: s310, enabling the differential feature map to pass through one or more full-connection layers to obtain a classification feature vector; s320, inputting the classification characteristic vectors into a classification function to obtain a classification result, wherein the classification result is used for indicating whether the smoothness of the surface of the steel bar meets a preset requirement or not; s330, inputting the classification result and the real value into a cross entropy loss function to obtain the classification loss function value.
In the second stage of training, in step S190, the classification loss function value is reduced by a preset step size, and the parameters of the first convolutional neural network are updated by back propagation of gradient descent. This is also the conventional process of training of deep neural networks, i.e. updating the parameters of the first convolutional neural network by back propagation of gradient descent.
It is worth mentioning that in the embodiment of the present application, the parameters of the classifier may be synchronously updated in the process of updating the parameters of the first convolutional neural network with the classification loss function values. That is, the first convolutional neural network and the classifier may be jointly trained.
In summary, a training method of a neural network for detecting the smoothness of the surface of a steel bar based on an embodiment of the present application is illustrated, and the training method trains the neural network for detecting the smoothness of the surface of the steel bar in two stages. In the first stage, a convolutional neural network for detecting the smoothness of the surface of the steel bar is trained based on the idea of counterlearning by taking an actually shot steel bar surface image and a computer three-dimensional modeling image of the steel bar as a reference image, so that the convolutional neural network can pay more attention to shape features in the image. In a second phase, the convolutional neural network is updated by computing the differential signatures between the signatures and by back propagation of gradient descent, so that it is further able to focus more on irregularities in the surface shape of the rebar. Thus, the trained convolutional neural network can improve the detection accuracy of the condition of the smoothness of the surface of the steel bar.
According to another aspect of the application, a method for detecting the smoothness of the surface of the steel bar based on the deep neural network is also provided.
Fig. 6 illustrates a flowchart of a method for detecting smoothness of a surface of a steel bar based on a deep neural network according to an embodiment of the present application.
As shown in fig. 6, a method for detecting smoothness of a surface of a steel bar based on a deep neural network according to an embodiment of the present application includes: s410, acquiring an image to be detected, wherein the image to be detected is an image of the surface of the steel bar to be detected; s420, inputting the image to be detected into the first convolution neural network trained according to the neural network training method for detecting the smoothness of the surface of the steel bar to obtain a classification feature map; and S430, passing the classification characteristic diagram through a classifier to obtain a classification result, wherein the classification result represents whether the smoothness of the surface of the steel bar in the image to be detected meets a preset requirement or not.
Exemplary System
Fig. 7 illustrates a block diagram of a training system for a neural network for smoothness detection of a rebar surface according to an embodiment of the present application.
As shown in fig. 7, a training system 700 of a neural network for detecting smoothness of a surface of a steel bar according to an embodiment of the present application includes: a first training module 710 comprising: a training image obtaining unit 711, configured to obtain a first image and a second image, where the first image is an image of a steel bar actually produced and the second image is an image of a steel bar modeled in three dimensions by a computer; a first feature map generating unit 712, configured to pass the first image obtained by the training image obtaining unit 711 through a first convolutional neural network to obtain a first feature map; a second feature map generating unit 713, configured to pass the second image obtained by the training image obtaining unit 711 through a second convolutional neural network to obtain a second feature map, where the second convolutional neural network has the same network structure as the first convolutional neural network; a discriminator loss function value generating unit 714 configured to input the first feature map obtained by the first feature map generating unit 712 and the second feature map obtained by the second feature map generating unit 713 into a discriminator neural network to obtain a discriminator loss function value; a first parameter updating unit 715 configured to reduce the discriminator loss function value obtained by the discriminator loss function value generating unit 714 by a preset step size, and update a parameter of the first convolutional neural network by back propagation of gradient descent; and, a second training module 720, comprising: a third feature map generating unit 721, configured to pass the first image obtained by the training image obtaining unit 711 through the first convolutional neural network trained in the first stage to obtain a third feature map; a difference feature map generating unit 722 configured to calculate a difference between the third feature map obtained by the third feature map generating unit 721 and the second feature map obtained by the second feature map generating unit 713 to obtain a difference feature map; a classification loss function value calculating unit 723, configured to pass the difference feature map obtained by the difference feature map generating unit 722 through a classifier to obtain a classification loss function value; and a second parameter updating unit 724, configured to reduce the classification loss function value obtained by the classification loss function value calculating unit 723 by a preset step size, and update a parameter of the first convolutional neural network by back propagation of gradient descent.
In an example, in the training system of the neural network for detecting the smoothness of the surface of the steel bar, as shown in fig. 8, the discriminator loss function value generating unit 714 includes: a fourth feature map generation subunit 731, configured to input the first feature map into the discriminator neural network to obtain a fourth feature map; a fifth feature map generation subunit 732, configured to input the second feature map into the discriminator neural network to obtain a fifth feature map; a feature value determination subunit 733, configured to determine whether values of predetermined positions in the fourth feature map and the fifth feature map are the same; a first value assignment subunit 734, configured to, in response to that the values of the predetermined positions in the fourth feature map and the fifth feature map are the same, calculate a negative value of a base-two logarithm value of the predetermined position as a first value; a second value assignment subunit 735, configured to, in response to that the values of the predetermined positions in the fourth feature map and the fifth feature map are different, calculate a base-two logarithm value of the predetermined position as a second value; and a discriminator loss function value operator unit 736 for calculating a sum of an average value of the positions where the first values are the same in value and an average value of the positions where the second values are different in value as the discriminator loss function value.
In one example, in the above training system for a neural network for smoothness detection of a surface of a steel bar, the discriminator neural network includes a preset number of convolution layers of a preset size.
In an example, in the training system of the neural network for detecting the smoothness of the steel bar surface, the difference feature map generating unit 722 is further configured to calculate a difference between feature values of the third feature map and the second feature map by pixel position to obtain the difference feature map.
In one example, in the above training system of a neural network for detecting the smoothness of the steel bar surface, the classification loss function value calculating unit 723 includes: a classification feature vector generation subunit 725, configured to pass the difference feature map through one or more fully connected layers to obtain a classification feature vector; a classification result generating subunit 726, configured to input the classification feature vector into a classification function to obtain a classification result, where the classification result is used to indicate whether the smoothness of the surface of the steel bar meets a preset requirement; and a loss function value calculating operator unit 727, configured to input the classification result and the true value into a cross entropy loss function to obtain the classification loss function value.
In one example, in the training system of the neural network for smoothness detection of the surface of the steel bar, the first convolution neural network is a depth residual network.
Here, it will be understood by those skilled in the art that the specific functions and operations of the respective units and modules in the above-described training system 700 have been described in detail in the above description with reference to the training method of the neural network for smoothness detection of a surface of a reinforcing bar as in fig. 1 to 5, and thus, a repetitive description thereof will be omitted.
As described above, the training system 700 according to the embodiment of the present application may be implemented in various terminal devices, such as a server for detecting the smoothness of the surface of the reinforcing bar. In one example, the training system 700 according to embodiments of the present application may be integrated into a terminal device as a software module and/or a hardware module. For example, the training system 700 may be a software module in the operating system of the terminal device, or may be an application developed for the terminal device; of course, the training system 700 could equally be one of many hardware modules of the terminal device.
Alternatively, in another example, the training system 700 and the terminal device may be separate devices, and the training system 700 may be connected to the terminal device via a wired and/or wireless network and transmit the interaction information in an agreed data format.
According to another aspect of the application, a system for detecting the smoothness of the surface of the steel bar based on the deep neural network is also provided.
Fig. 10 illustrates a block diagram of a system for detecting the smoothness of a surface of a rebar based on a deep neural network in accordance with an embodiment of the present application. As shown in fig. 10, the system 800 for detecting the smoothness of the surface of the steel bar based on the deep neural network according to the embodiment of the present application includes: the to-be-detected image acquiring unit 810 is configured to acquire an image to be detected, where the image to be detected is an image of the surface of a to-be-detected steel bar; a classification feature map generating unit 820, configured to input the image to be detected obtained by the image to be detected obtaining unit 810 into the first convolution neural network trained according to the neural network training method for detecting the smoothness of the surface of the steel bar, so as to obtain a classification feature map; the classification result generating unit 830 is configured to obtain a classification result by passing the classification feature map obtained by the classification feature map generating unit 820 through a classifier, where the classification result indicates whether the smoothness of the surface of the reinforcement bar in the image to be detected meets a preset requirement.
Here, it will be understood by those skilled in the art that the detailed functions and operations of the respective units and modules in the above-described detection system 800 have been described in detail in the above description of the method for detecting the smoothness of the surface of the reinforcing steel bar based on the deep neural network with reference to fig. 6, and thus, a repetitive description thereof will be omitted.
As described above, the detection system 800 according to the embodiment of the present application may be implemented in various terminal devices, such as a server for detecting the smoothness of the surface of the reinforcing bar. In one example, the detection system 800 according to embodiments of the application may be integrated into the terminal device as one software module and/or hardware module. For example, the detection system 800 may be a software module in the operating system of the terminal device, or may be an application developed for the terminal device; of course, the detection system 800 may also be one of many hardware modules of the terminal device.
Alternatively, in another example, the detection system 800 and the terminal device may be separate devices, and the detection system 800 may be connected to the terminal device through a wired and/or wireless network and transmit the interaction information according to an agreed data format.
Exemplary electronic device
Next, an electronic apparatus according to an embodiment of the present application is described with reference to fig. 11.
FIG. 11 illustrates a block diagram of an electronic device in accordance with an embodiment of the present application.
As shown in fig. 11, the electronic device 10 includes one or more processors 11 and memory 12.
The processor 11 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
Memory 12 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer readable storage medium and executed by the processor 11 to implement the above-described neural network training method for smoothness detection of a steel bar surface or the deep neural network-based steel bar surface smoothness detection method of the various embodiments of the present application, and/or other desired functions. Various contents such as classification results, classification loss function values, discriminator loss function values, and the like may also be stored in the computer-readable storage medium.
In one example, the electronic device 10 may further include: an input device 13 and an output device 14, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device 13 may include, for example, a keyboard, a mouse, and the like.
The output device 14 can output various information including the classification result to the outside. The output devices 14 may include, for example, a display, speakers, a printer, and a communication network and its connected remote output devices, among others.
Of course, for the sake of simplicity, only some of the components of the electronic device 10 relevant to the present application are shown in fig. 11, and components such as buses, input/output interfaces, and the like are omitted. In addition, the electronic device 10 may include any other suitable components depending on the particular application.
Exemplary computer program product and computer-readable storage Medium
In addition to the above-described methods and apparatus, embodiments of the present application may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform the steps in a method of training a neural network for smoothness detection of a surface of a steel reinforcement or a method of detecting a smoothness of a surface of a steel reinforcement based on a deep neural network according to various embodiments of the present application described in the above-mentioned "exemplary methods" section of the present specification.
The computer program product may be written with program code for performing the operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present application may also be a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, cause the processor to perform the steps in the method for training a neural network for smoothness detection of a surface of a steel reinforcement or the method for detecting smoothness of a surface of a steel reinforcement based on a deep neural network according to various embodiments of the present application described in the "exemplary methods" section above in this specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing describes the general principles of the present application in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present application are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present application. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the foregoing disclosure is not intended to be exhaustive or to limit the disclosure to the precise details disclosed.
The block diagrams of devices, apparatuses, systems referred to in this application are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
It should also be noted that in the devices, apparatuses, and methods of the present application, the components or steps may be decomposed and/or recombined. These decompositions and/or recombinations are to be considered as equivalents of the present application.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the application. Thus, the present application is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, the description is not intended to limit embodiments of the application to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. A training method of a neural network for detecting the smoothness of the surface of a steel bar is characterized by comprising the following steps:
the first stage is as follows:
acquiring a first image and a second image, wherein the first image is an image of a practically produced reinforcing steel bar and the second image is an image of a computer three-dimensional modeling reinforcing steel bar;
passing the first image through a first convolutional neural network to obtain a first feature map;
passing the second image through a second convolutional neural network to obtain a second feature map, wherein the second convolutional neural network has the same network structure as the first convolutional neural network;
inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value;
decreasing the discriminator loss function value by a preset step size and updating the parameters of the first convolutional neural network by back propagation of gradient descent;
and a second stage:
passing the first image through the first convolutional neural network trained in the first stage to obtain a third feature map;
calculating a difference between the third feature map and the second feature map to obtain a difference feature map;
passing the differential feature map through a classifier to obtain a classification loss function value; and
reducing the classification loss function value by a preset step size, and updating the parameters of the first convolutional neural network through back propagation of gradient descent.
2. The training method of a neural network for smoothness detection of a steel bar surface according to claim 1, wherein inputting the first feature map and the second feature map into a discriminator neural network to obtain a discriminator loss function value comprises:
inputting the first feature map into the discriminator neural network to obtain a fourth feature map;
inputting the second feature map into the discriminator neural network to obtain a fifth feature map;
determining whether the values of the predetermined positions in the fourth feature map and the fifth feature map are the same;
in response to the values of the predetermined positions in the fourth feature map and the fifth feature map being the same, calculating a negative value of a base two logarithm of the values of the predetermined positions as a first value;
in response to the values of the predetermined positions in the fourth feature map and the fifth feature map being different, calculating a base two logarithmic value of the values of the predetermined positions as a second value;
and calculating the sum of the average value of the positions with the same value according to the first value and the average value of the positions with different values according to the second value as the discriminator loss function value.
3. The training method of the neural network for smoothness detection of a steel surface of claim 2, wherein the discriminator neural network includes a preset number of convolution layers of a preset size.
4. The training method of the neural network for detecting the smoothness of the surface of the steel bar according to claim 1, wherein calculating a difference between the third feature map and the second feature map to obtain a difference feature map comprises:
and calculating the difference of the characteristic values of the third characteristic diagram and the second characteristic diagram according to the pixel positions to obtain the difference characteristic diagram.
5. The training method of the neural network for detecting the smoothness of the surface of the steel bar according to claim 1, wherein passing the differential feature map through a classifier to obtain a classification loss function value comprises:
passing the differential feature map through one or more fully connected layers to obtain a classification feature vector;
inputting the classification characteristic vector into a classification function to obtain a classification result, wherein the classification result is used for indicating whether the smoothness of the surface of the steel bar meets a preset requirement or not; and
and inputting the classification result and the real value into a cross entropy loss function to obtain the classification loss function value.
6. The training method of the neural network for smoothness detection of a steel bar surface according to claim 1, wherein the first convolution neural network is a deep residual network.
7. A method for detecting the smoothness of a steel bar surface based on a deep neural network is characterized by comprising the following steps:
acquiring an image to be detected, wherein the image to be detected is an image of the surface of a steel bar to be detected;
inputting the image to be detected into the first convolution neural network trained according to the training method of the neural network for detecting the smoothness degree of the surface of the steel bar of any one of claims 1 to 6 to obtain a classification feature map; and
and passing the classification characteristic diagram through a classifier to obtain a classification result, wherein the classification result represents whether the smoothness of the surface of the steel bar in the image to be detected meets a preset requirement or not.
8. A training system for a neural network for detection of smoothness of a surface of a rebar, comprising:
a first training module comprising:
the training image acquisition unit is used for acquiring a first image and a second image, wherein the first image is an image of a practically produced reinforcing steel bar and the second image is an image of a computer three-dimensional modeling reinforcing steel bar;
a first feature map generation unit, configured to pass the first image obtained by the training image obtaining unit through a first convolutional neural network to obtain a first feature map;
a second feature map generation unit, configured to pass the second image obtained by the training image obtaining unit through a second convolutional neural network to obtain a second feature map, where the second convolutional neural network and the first convolutional neural network have the same network structure;
a discriminator loss function value generating unit configured to input the first feature map obtained by the first feature map generating unit and the second feature map obtained by the second feature map generating unit into a discriminator neural network to obtain a discriminator loss function value;
a first parameter updating unit configured to reduce the discriminator loss function value obtained by the discriminator loss function value generating unit by a preset step size and update a parameter of the first convolutional neural network by back propagation of gradient descent
A second training module comprising:
a third feature map generation unit, configured to pass the first image obtained by the training image obtaining unit through the first convolutional neural network trained in the first stage to obtain a third feature map;
a difference feature map generation unit configured to calculate a difference between the third feature map obtained by the third feature map generation unit and the second feature map obtained by the second feature map generation unit to obtain a difference feature map;
a classification loss function value calculation unit, configured to pass the differential feature map obtained by the differential feature map generation unit through a classifier to obtain a classification loss function value; and
a second parameter updating unit, configured to reduce the classification loss function value obtained by the classification loss function value calculating unit by a preset step size, and update the parameter of the first convolutional neural network by back propagation of gradient descent.
9. A system for detecting the smoothness of a steel bar surface based on a deep neural network is characterized by comprising:
the device comprises an image acquisition unit to be detected, a detection unit and a control unit, wherein the image acquisition unit to be detected is used for acquiring an image to be detected, and the image to be detected is an image of the surface of a steel bar to be detected;
a classification feature map generating unit, configured to input the image to be detected obtained by the image to be detected obtaining unit into the first convolution neural network trained according to the neural network training method for detecting the smoothness of the surface of a steel bar according to any one of claims 1 to 6, so as to obtain a classification feature map;
and the classification result generating unit is used for enabling the classification characteristic diagram obtained by the classification characteristic diagram generating unit to pass through a classifier so as to obtain a classification result, and the classification result represents whether the smoothness of the surface of the steel bar in the image to be detected meets a preset requirement or not.
10. An electronic device, comprising:
a processor; and
a memory in which computer program instructions are stored, which, when executed by the processor, cause the processor to perform the method of training a neural network for smoothness detection of a steel surface according to any one of claims 1 to 6, or the method of detecting the smoothness of a steel surface based on a deep neural network according to claim 7.
CN202110074303.8A 2021-01-20 2021-01-20 Training method of neural network for detecting smoothness of surface of steel bar Withdrawn CN112734016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110074303.8A CN112734016A (en) 2021-01-20 2021-01-20 Training method of neural network for detecting smoothness of surface of steel bar

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110074303.8A CN112734016A (en) 2021-01-20 2021-01-20 Training method of neural network for detecting smoothness of surface of steel bar

Publications (1)

Publication Number Publication Date
CN112734016A true CN112734016A (en) 2021-04-30

Family

ID=75592615

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110074303.8A Withdrawn CN112734016A (en) 2021-01-20 2021-01-20 Training method of neural network for detecting smoothness of surface of steel bar

Country Status (1)

Country Link
CN (1) CN112734016A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115375691A (en) * 2022-10-26 2022-11-22 济宁九德半导体科技有限公司 Image-based semiconductor diffusion paper source defect detection system and method thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115375691A (en) * 2022-10-26 2022-11-22 济宁九德半导体科技有限公司 Image-based semiconductor diffusion paper source defect detection system and method thereof
CN115375691B (en) * 2022-10-26 2023-04-07 济宁九德半导体科技有限公司 Image-based semiconductor diffusion paper source defect detection system and method thereof

Similar Documents

Publication Publication Date Title
JP7193252B2 (en) Captioning image regions
CN107784288B (en) Iterative positioning type face detection method based on deep neural network
CN116188584B (en) Method and system for identifying object polishing position based on image
KR19990010210A (en) Mass Pattern Matching Device and Method
CN111523421A (en) Multi-user behavior detection method and system based on deep learning and fusion of various interaction information
CN114048468A (en) Intrusion detection method, intrusion detection model training method, device and medium
CN114266894A (en) Image segmentation method and device, electronic equipment and storage medium
CN116091414A (en) Cardiovascular image recognition method and system based on deep learning
CN112734016A (en) Training method of neural network for detecting smoothness of surface of steel bar
CN110889290B (en) Text encoding method and apparatus, text encoding validity checking method and apparatus
CN112960213A (en) Intelligent package quality detection method using characteristic probability distribution representation
CN112465805A (en) Neural network training method for quality detection of steel bar stamping and bending
CN117011274A (en) Automatic glass bottle detection system and method thereof
CN116797533B (en) Appearance defect detection method and system for power adapter
CN116258947B (en) Industrial automatic processing method and system suitable for home customization industry
CN116994049A (en) Full-automatic flat knitting machine and method thereof
CN114820755B (en) Depth map estimation method and system
JP2007179413A (en) Pattern recognition device, pattern recognition method, and method for generating characteristic extraction parameter
CN111680674B (en) Hall personnel monitoring method based on self-integrated attention mechanism
CN115359248A (en) Robot navigation obstacle avoidance method and system based on meta-learning
CN112529093A (en) Method for testing mold cleaning effect based on sample dimension weighting of pre-detection weight
CN110705695B (en) Method, device, equipment and storage medium for searching model structure
CN112819040A (en) Intelligent control method for cement processing based on weight generation mechanism
CN112766465A (en) Training method of neural network for intelligent rotation performance detection
CN113610080A (en) Cross-modal perception-based sensitive image identification method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20210430

WW01 Invention patent application withdrawn after publication