CN113096085A - Container surface damage detection method based on two-stage convolutional neural network - Google Patents

Container surface damage detection method based on two-stage convolutional neural network Download PDF

Info

Publication number
CN113096085A
CN113096085A CN202110353753.0A CN202110353753A CN113096085A CN 113096085 A CN113096085 A CN 113096085A CN 202110353753 A CN202110353753 A CN 202110353753A CN 113096085 A CN113096085 A CN 113096085A
Authority
CN
China
Prior art keywords
surface damage
container
data set
network
training
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
Application number
CN202110353753.0A
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.)
Wuhan University of Technology WUT
Original Assignee
Wuhan University of Technology WUT
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 Wuhan University of Technology WUT filed Critical Wuhan University of Technology WUT
Priority to CN202110353753.0A priority Critical patent/CN113096085A/en
Publication of CN113096085A publication Critical patent/CN113096085A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • 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
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/30Noise filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour

Landscapes

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

Abstract

The invention discloses a container surface damage detection method based on a two-stage convolutional neural network, S1, manufacturing a container surface damage detection training data set and a test data set; s2, constructing a container surface damage detection model based on a two-stage convolutional neural network, wherein the two-stage convolutional neural network comprises a segmentation network and a classification network, the segmentation network processes a container surface damage image sample to obtain a damage segmentation characteristic diagram, and the classification network judges the damage type of the container surface damage image; s3, training the container surface damage detection model through a training data set and a testing data set; and S4, judging the surface damage of the container by using the trained model and outputting a detection result. The invention carries out the detection of the surface damage of the container by establishing the two-stage convolution neural network model, can effectively reduce the recognition error rate, improve the detection accuracy and realize the accurate judgment of the surface damage type of the container.

Description

Container surface damage detection method based on two-stage convolutional neural network
Technical Field
The invention relates to the field of container damage detection, in particular to a container surface damage detection method based on a two-stage convolutional neural network.
Background
In recent years, the social economy of China is increasing at a high speed, and the large-scale container ships and harbors are developing at a high speed, so the traffic and the throughput of container harbors are increasing continuously. The container is easy to deform and break due to frequent collision in the lifting and stacking process, and is often in the outdoor environment of solarization and rain, so that the corrosion hole is generated, in each operation link of a container port, the inspection and evaluation of the surface damage of the container body are necessary processes for the container to enter the port, accidents in the container transportation, loading and unloading process can be effectively avoided, and meanwhile, transport enterprises and docks are prevented from generating disputes due to the damage of the container body. There is currently less research associated with automated detection of container surface damage. Most of container surface damage inspection work still relies on the condition such as whether have damage deformation to judge with the help of artificial experience or with the help of non-automatic detection instrument, needs many people to assist usually and the safety guarantee is not enough, because do not have strict unified standard, often the processing time is long but detects the rate of accuracy and hangs down. However, some existing systems for detecting damage to containers by applying image processing techniques are usually limited to digital image detection and analysis techniques by identifying some specific defects such as holes, corrosion or deformation on the surface of the container through two-dimensional or three-dimensional image processing methods, and most of them can only solve the detection problem of small data volume, and cannot well remove interference information caused by external environmental factors such as weather light.
Because the current port traffic is continuously expanded, the workload of detecting the container damage is increased day by day, the types of damage are numerous and the characteristics are complex, the detection effect which is not ideal in the past is faced with a larger data volume, the operation efficiency of a gate is seriously restricted, and the port traffic smoothness and the service level are influenced. The current deep learning theory obtains a lot of achievements in the fields of computer vision, image recognition and the like, and because the deep learning theory can learn a specific target from mass data and accurately judge, the efficiency and the accuracy of classification recognition are effectively improved while the workload is reduced. At present, the detection technology taking deep learning as a core is applied to the aspects of container position number identification, ship detection and the like in a relatively mature port, but is rarely applied to the detection of surface damage of the container.
Convolutional neural networks are the most typical image classification and identification methods belonging to deep learning. By accurately acquiring a large number of container body surface effective image samples to form a multi-type container surface damage image database, a labeled data set for training a convolutional neural network model can be effectively constructed; by reasonably designing the overall architecture of the two-stage convolutional neural network, parameters influencing network convergence and identification accuracy are continuously optimized, an overfitting phenomenon is avoided, the model has better generalization capability, and the target effect of container surface damage detection can be achieved. The method can effectively reduce the recognition error rate, improve the detection accuracy, realize the accurate judgment of the surface damage type of the container, achieve the purposes of improving the operation efficiency of the port container gate, reducing the operation cost and improving the operation safety, further realize the local upgrade of the port operation system and promote the intelligent development of modern ports, thereby having certain research and development potential and practical production value.
Disclosure of Invention
The invention mainly aims to provide a container surface damage detection method based on a two-stage convolutional neural network, which can accurately detect the surface damage condition of a container, avoid using a large amount of human resources, reduce the port operation cost and effectively improve the operation efficiency.
The technical scheme adopted by the invention is as follows:
the method for detecting the surface damage of the container based on the two-stage convolutional neural network comprises the following steps:
s1, making a container surface damage detection training data set and a test data set, specifically collecting required container surface damage pictures, and performing image preprocessing; establishing a label value table for the surface damage type of the container, labeling the label value of the surface damage type corresponding to each picture, and forming a container surface damage detection data set by the picture sample and the label value table; dividing a data set into a training set and a testing set, selecting half of all damage type picture samples from a container surface damage detection data set, placing the picture samples in a random order, numbering each picture in the placing order, storing the picture numbers and corresponding damage type label values into a training set text file, forming the training data set by the picture samples and the training set text file, and manufacturing the testing data set by the same method;
s2, constructing a container surface damage detection model based on a two-stage convolutional neural network, wherein the two-stage convolutional neural network comprises a segmentation network and a classification network, the segmentation network processes a container surface damage image sample to obtain a damage segmentation characteristic diagram, and the classification network judges the damage type of the container surface damage image;
s3, training the container surface damage detection model through a training data set and a testing data set;
and S4, judging the surface damage of the container by using the trained model and outputting a detection result.
In step S1, collecting the images of the surface damage of the container, and selecting a large number of images with obvious "crack", "rust", "pit", "hole" and "wear" states on the surface of the container for image preprocessing, wherein the preprocessed images are unified into pixels with the same height and width.
According to the technical scheme, the image preprocessing specifically comprises the following steps:
carrying out weighted average on RGB three components by different weights by adopting a weighted average method to obtain a gray level image;
carrying out geometric transformation processing on the image, correcting random errors in the image acquisition and imaging process, and using a bilinear interpolation algorithm to avoid that pixels of an output image are mapped to non-integer coordinates of an input image;
the image enhancement technology is adopted to enhance the image quality and the information quantity and improve the identification effect, the median filtering neighborhood enhancement algorithm is specifically applied to eliminate image noise and enable the image noise to be clear, and the gradient operator neighborhood enhancement algorithm is applied to expand the difference between different object characteristics so as to highlight useful information.
According to the technical scheme, the segmentation network comprises a CNN segmentation network and an ASPP network which are sequentially connected, wherein the CNN segmentation network comprises 9 3 × 3 convolution layers and 3 2 × 2 pooling layers, and each pooling layer is respectively arranged behind the 2 nd, 5 th and 9 th convolution layers to form 3 groups of convolution-pooling layers which are sequentially connected; after an original picture sample X is input, carrying out convolution operation on the characteristic value of the picture sample at each position weight in the convolution layer and the convolution kernel size, extracting a plurality of characteristics of the picture and obtaining a group of convolution layer characteristic diagram sets, connecting a BN layer and a ReLU layer behind each convolution layer, carrying out batch standardization and activation function processing, carrying out pooling operation on the characteristic diagram sets at a pooling layer and a pooling window, reducing the data quantity of the characteristic diagram, carrying out secondary characteristic extraction on the characteristic diagram, avoiding the occurrence of overfitting phenomenon, and connecting the BN layer behind each pooling layer for batch standardization; the ASPP network is formed by 1 × 1 convolution layer and 3 × 3 hollow convolution layers which are distributed in parallel, the sampling rate is 4, 6 and 8 respectively, BN batch standardization operation is used after each convolution layer, 12 × 2 average pooling layer is connected for processing, and the calculation result of the Avg function in each average pooling layer represents an output matrix value formed by average pixel values in each 2 × 2 area in X; and finally, connecting the four layers of outputs together, and recovering the sample resolution of the original image by using a bilinear interpolation method through 1X 1 convolution layer and 1 upsampling layer to obtain an injury segmentation feature map X'.
According to the technical scheme, the classification network comprises two CNN classification networks, each CNN classification network comprises 1 5 × 5 convolution layer, 2 3 × 3 convolution layers, 3 × 2 maximum pooling layers and 2 full- connection layers 120 and 84 at the tail, and each maximum pooling layer is arranged behind a single convolution layer to form 3 pairs of convolution-pooling layers connected in sequence; each layer has a plurality of two-dimensional planes, each plane having a plurality of neurons; connecting a ReLU layer behind each convolution layer for activating function processing, wherein the activating function ReLU calculates larger parameter values in output (0, x); the Max function calculation result in each maximum pooling layer represents an output matrix value consisting of the maximum pixel values in each 2X 2 area in X; and a Dropout layer is connected in front of each full connection layer, one-dimensional column vectors of the full connection layer are formed by completely expanding and recombining the characteristic diagrams of the most terminal pooling layer and are connected with the Softmax layer in a full connection mode.
In connection with the above technical solution, the first CNN classification network a is used for inputting the segmentation feature map X' to obtain the first classification feature map pa(ii) a The second CNN classification network b is used for inputting the original picture sample X to obtain a second classification characteristic graph pb(ii) a First class profile paAnd a second classification profile pbObtaining a fusion vector p after processing by a fusion functionsumThe probability Y 'of the various states of the conveying belt is obtained through calculation of a Softmax function, and the state with the maximum probability is selected as the finally judged current state Y' of the conveying belt to be output; y ' is an estimated value obtained by prediction calculation, Y is a corresponding label value of the original picture sample, and the cross entropy loss function L (Y ', Y) is calculated and minimized from Y ' and Y.
In step S3, the two-stage overall training process of the container surface damage detection model specifically includes:
inputting a training data set after the construction of the segmentation network is completed, and establishing a segmentation network loss function LsegMinimizing the parameters, and training the parameters lambda of the segmentation network matrix[seg]Fixing; inputting a training data set after the construction of the two classification networks a and b is completed, and establishing a classification network loss function LaAnd LbRespectively minimizing the parameters, and training the parameters lambda of the segmentation network matrix[a]And λ[b]Fixing; the matrix parameters of the segmentation and classification network are fixed, the two-stage convolutional neural network is input into a training data set after the construction is completed, and a loss function L of the two-stage convolutional neural network is establishedcMinimizing the parameter and obtaining the matrix parameter lambda of the trained two-stage convolution neural network[c]Fixing;
the training method of each network in the model comprises the following steps:
firstly, weighting matrix parameter values W of each layer in the neural network structure[i]And bias matrix parameter value B[i]Initializing to a random value, setting the number of iterationsS, learning rate Lr, let Xj=X0,X0Training the 1 st picture sample in the data set for the damage state;
② inputting picture sample X into sample input layerjCalculating to obtain and output the current state estimated value Yj’;
Computing cross entropy loss function L (Y)j’,Yj) Obtaining parameters W of each layer[i]And B[i]Variation value Δ W[i]And Δ B[i]
Updating all parameters W[i]And B[i]Value, W[i]=W[i]-Lr*ΔW[i],B[i]=B[i]-Lr*ΔB[i]
Judging whether the current picture sample is the last one in the damage state training data set, if not, making Xj=Xj+1Jumping to the second step for the next sample in the training set, and jumping to the sixth step if the next sample in the training set is in the training set;
sixthly, judging whether S is 0, if so, finishing iteration, jumping to the step seven, and if not, re-ordering Xj=X0If S is S-1, jumping to the second step;
seventhly, setting a correct rate threshold value to be T, and if all picture samples in the damage state test data set are input, setting each sample state estimation value Yj' and corresponding true value YjComparing, calculating the ratio of the number of samples with the same estimated value and true value to the total number N of all samples to obtain the accuracy Acc, and if Acc is reached<If Acc is not less than T, turning to (b);
b combining all parameters W[i]And B[i]And fixing and storing, and finishing the training of the neural network model.
In the above technical solution, step S4 is as follows:
loading all parameters in the trained container surface damage detection model;
importing a container surface picture to be distinguished, and carrying out relevant preprocessing operations of graying, geometric transformation and image enhancement on the container surface picture;
inputting the processed picture into a two-stage convolutional neural network, and judging whether the surface of the container in the picture has damage and the damage type of the container;
and outputting, displaying and storing the detection result and the corresponding original picture.
The invention also provides a container surface damage detection system based on the two-stage convolutional neural network, which comprises the following steps:
the data collection module is used for manufacturing a container surface damage detection training data set and a test data set, specifically collecting required container surface damage pictures and carrying out image preprocessing; establishing a label value table for the surface damage type of the container, labeling the label value of the surface damage type corresponding to each picture, and forming a container surface damage detection data set by the picture sample and the label value table; dividing a data set into a training set and a testing set, selecting half of all damage type picture samples from a container surface damage detection data set, placing the picture samples in a random order, numbering each picture in the placing order, storing the picture numbers and corresponding damage type label values into a training set text file, forming the training data set by the picture samples and the training set text file, and manufacturing the testing data set by the same method;
the model construction module is used for constructing a container surface damage detection model based on a two-stage convolutional neural network, the two-stage convolutional neural network comprises a segmentation network and a classification network, the segmentation network processes a container surface damage image sample to obtain a damage segmentation characteristic diagram, and the classification network judges the damage type of the container surface damage image;
the training module is used for training the container surface damage detection model through a training data set and a testing data set;
and the recognition module is used for distinguishing the surface damage of the container by using the trained model and outputting a detection result.
The invention also provides a storage medium which can be executed by a processor and in which a computer program is stored, wherein the computer program executes the container surface damage detection method based on the two-stage convolutional neural network.
The invention has the following beneficial effects: the method and the device construct a two-stage convolutional neural network model to detect the surface damage of the container by using computer vision and deep learning means, can effectively reduce the recognition error rate, improve the detection accuracy, realize the accurate judgment of the surface damage type of the container, and achieve the aims of improving the operation efficiency of a port container gate, reducing the operation cost and improving the operation safety, so the method and the device can be widely applied and have huge market potential.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
fig. 1 is a schematic diagram of the main steps of a container surface damage detection method based on a two-stage convolutional neural network implemented by the present invention.
Fig. 2 is a schematic diagram of training data set and test data set flow for surface damage detection of a manufactured container implemented by the present invention.
Fig. 3 is a schematic diagram of a framework structure for constructing a container surface damage detection model based on a two-stage convolutional neural network according to the embodiment of the present invention.
Fig. 4 is a schematic diagram of the overall training process of the container surface damage detection model based on the two-stage convolutional neural network implemented by the present invention.
Fig. 5 is a schematic diagram of each network training method in the container surface damage detection model based on the two-stage convolutional neural network implemented by the present invention.
Fig. 6 is a schematic diagram of the steps of discriminating the surface damage of the container by using the trained model and outputting the detection condition.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, the container surface damage detection method based on the two-stage convolutional neural network mainly comprises the following steps:
s1, manufacturing a container surface damage detection training data set and a test data set;
s2, constructing a container surface damage detection model based on a two-stage convolutional neural network;
s3, training a container surface damage detection model based on a two-stage convolutional neural network;
and S4, judging the surface damage of the container by using the trained model and outputting a detection result.
As shown in fig. 2, the training data set and the test data set flow for detecting the surface damage of the container are prepared as follows:
(1) collecting the picture of the surface damage of the container, and selecting a large number of pictures with obvious states of 'cracking', 'rusting', 'pit', 'hole', 'abrasion' and the like on the surface of the container body for image preprocessing. Firstly, in order to improve the detection speed, carrying out gray processing on a color image so as to reduce the data amount required to be processed, adopting a weighted average method L of 0.299R +0.587G +0.114B, wherein RGB is three color components of red, green and blue, and carrying out weighted average on the three components of RGB by different weights to obtain a more reasonable gray image; secondly, geometric transformation processing is carried out on the image through translation, transposition, rotation, scaling and the like, random errors in the image acquisition, imaging and other processes are corrected, and the image is processed by using a bilinear interpolation algorithm to be g (x, y) ═ 1-u) (1-v) f (x, y +1) + v (1-u) f (x, y +1) + u (1-v) f (x +1, y) + uvf (x +1, y +1), wherein x and y are integer parts of floating point coordinates, and u and v are fractional parts of the floating point coordinates, so that pixels of the output image can be prevented from being mapped to non-integer coordinates of the input image; finally, image quality and information content are enhanced and recognition effect is improved by adopting an image enhancement technology, the image processed by the median filtering neighborhood enhancement algorithm is g (x, y) ═ med { f (x-k, y-l), k, l belongs to W }, wherein W is a 3 x 3 area two-dimensional template, and image noise can be eliminated and becomes clear; the image processed by the neighborhood enhancement algorithm of the Laplace gradient operator is g (x, y) ═ f (x, y) + c [ f (x +1, y) + f (x-1, y) + f (x, y +1) + f (x, y-1) -4f (x, y) ], wherein c is a positive coefficient reflecting the sharpening degree, and the difference between different object characteristics can be expanded to highlight useful information.
(2) The preprocessed pictures are unified into pixels with the same height and width, a label value table is established for the surface damage type of the container, label values of the corresponding surface damage types of each picture are labeled, and the picture samples and the label value table jointly form a container surface damage detection data set; dividing a data set into a training set and a testing set, selecting half of all damage type picture samples from a container surface damage detection data set, placing the picture samples in a random order, numbering each picture in the placing order, storing the picture numbers and corresponding damage type label values into a training set text file, forming the training data set by the picture samples and the training set text file, and manufacturing the testing data set according to the same method.
As shown in fig. 3, the framework structure for constructing the container surface damage detection model based on the two-stage convolutional neural network is as follows:
the two-stage convolutional neural network model comprises a segmentation network and a classification network, wherein the segmentation network processes the container surface damage image sample to obtain a damage segmentation characteristic diagram, and the classification network judges the damage type of the container surface damage image.
The split network comprises a CNN split network and an ASPP network which are connected in sequence. The CNN split network is divided into 9 3 × 3 convolutional layers and 3 2 × 2 pooling layers, each pooling layer is disposed after the 2 nd, 5 th and 9 th convolutional layers, respectively, to constitute 3 sets of sequentially connected convolutional-pooling layers. After an original picture sample X is input (taking height and width as 160 × 160 pixels as an example), carrying out convolution operation on a picture sample characteristic value at each position weight in the sizes of a convolution layer and a convolution kernel, extracting a plurality of characteristics of a picture and obtaining a group of convolution layer characteristic diagram sets, connecting a BN layer and a ReLU layer behind each convolution layer, carrying out batch standardization and activation function processing, carrying out pooling operation on the characteristic diagram sets in a pooling layer and a pooling window, reducing the data quantity of the characteristic diagram, carrying out secondary characteristic extraction on the characteristic diagram, avoiding the occurrence of an overfitting phenomenon, and connecting the BN layer behind each pooling layer for batch standardization; the ASPP network aims to expand a feature receiving field while not sacrificing the spatial resolution of features, the sampling rates are respectively 4, 6 and 8 for 1 × 1 convolution layer and 3 × 3 hole convolution layers which are distributed in parallel, BN batch standardization operation is used after each convolution layer, 12 × 2 average pooling layer is connected for processing, and the calculation result of an Avg function in each average pooling layer represents an output matrix value formed by average pixel values in each 2 × 2 area in X; and finally, connecting the four layers of outputs together, and recovering the sample resolution of the original image by using a bilinear interpolation method through 1X 1 convolution layer and 1 upsampling layer to obtain an injury segmentation feature map X'.
The classification network comprises two CNN classification networks, each CNN classification network comprises 1 5 × 5 convolution layer, 2 3 × 3 convolution layers, 3 2 × 2 maximum pooling layers and 2 full-connection layers at the tail end and 84 full-connection layers, and each maximum pooling layer is respectively arranged behind a single convolution layer to form 3 pairs of convolution-pooling layers connected in sequence. Each layer has a plurality of two-dimensional planes, each plane having a plurality of neurons. Connecting a ReLU layer behind each convolution layer for activating function processing, wherein the activating function ReLU calculates larger parameter values in output (0, x); the Max function calculation result in each maximum pooling layer represents an output matrix value consisting of the maximum pixel values in each 2X 2 area in X; and a Dropout layer is connected in front of each full connection layer to prevent the occurrence of a model overfitting phenomenon, and a one-dimensional column vector of each full connection layer is formed by completely unfolding and recombining the characteristic diagram of the final pooling layer and is connected with the Softmax layer in a full connection mode. The classification network a is used for inputting the segmentation feature map X' to obtain a classification feature map pa(ii) a The classification network b is used for inputting the original picture sample X to obtain a classification characteristic graph pb. Classification feature map paAnd a classification feature map pbObtaining a fusion vector p after processing by a fusion functionsumAnd inputting the data into a Softmax layer for classification, calculating the probability Y 'of the various possible states of the conveying belt by using a Softmax function, and selecting the state with the maximum probability as the finally judged current state Y' of the conveying belt for output. Y ' is an estimated value obtained by prediction calculation, Y is a corresponding label value of the original picture sample, and the cross entropy loss function L (Y ', Y) is calculated and minimized from Y ' and Y.
After the convolution layer (pooling layer) and the convolution kernel (pooling window) of each image sample act, the extracted feature size is as follows:
Figure BDA0003002993160000111
where kernel is the convolution kernel, padding is the zero padding number, and threads is the step size.
The batch standardized processing mode of the BN layer is as follows:
Figure BDA0003002993160000112
where γ and β are learnable parameters for scaling and shifting normalized values, and e is a small positive number that avoids the addition of a variance of 0.
The output of the fully connected layer with the Dropout layer is as follows:
y=f(W·ri·x+B) (3)
wherein r isiObeying a Bernoulli distribution r for randomly generated 0 or 1 valuesi-Bernoulli (p), W is the layer weight matrix, B is the bias matrix, and f is the activation function.
The probability of various damage types calculated by the Softmax intralayer function is as follows:
Figure BDA0003002993160000121
wherein u, v belongs to n, and n is the total number of the damage types.
As shown in fig. 4, the overall training process of the container surface damage detection model based on the two-stage convolutional neural network is as follows:
let X { (X)j,Xj’,Yj) J ═ 1.. times, N }, X represents a container surface damage detection training dataset, and X represents a container surface damage detection training datasetj、Xj’、YjThe method comprises the steps of respectively obtaining an original picture sample, a segmentation feature map corresponding to the original picture sample and label values corresponding to the original picture sample, wherein j is the number of the picture sample, and N is the total number of the picture samples.
Inputting a training data set picture to train the segmentation network after the segmentation network is constructed, and training the segmentation network by establishingSplitting the network loss function LsegMinimizing the parameters, and training the parameters lambda of the segmentation network matrix[seg]And fixing to complete the training. The split network loss function is:
Lseg(sigmoid(prec(Xj[seg])),Xj') (5)
wherein p isrecTo be XjA function mapped to a class score; sigmoid is an activation function; lambda [ alpha ][seg]Is a matrix parameter of a split network, and[seg]={W[seg],B[seg]},W[seg]as a weight, B[seg]And (4) deviation.
After the classification networks a and b are constructed, training data set pictures are input to train the classification networks a and b, and a classification network loss function L is establishedaAnd LbRespectively minimizing the parameters, and training the parameters lambda of the segmentation network matrix[a]And λ[b]And fixing to complete the training. The loss functions of the classification network a and the classification network b are respectively as follows:
La(softmax(prec(Xj[seg][a])),Yj) (6)
Lb(softmax(prec(Xj[b])),Yj) (7)
wherein λ[a]To classify the matrix parameters of network a, and[a]={W[a],B[a]},W[a]as a weight, B[a]Is a deviation; lambda [ alpha ][b]Is a matrix parameter of the classification network b, and[b]={W[b],B[b]},W[b]as a weight, B[b]Is a deviation.
The matrix parameters of the segmentation network and the classification network are fixed, the two-stage convolutional neural network is constructed and then input into a training data set picture to train the two-stage convolutional neural network, and a loss function L of the two-stage convolutional neural network is establishedcMinimizing the parameter and obtaining the matrix parameter lambda of the trained two-stage convolution neural network[c]And fixing to complete the training. The loss function of the two-stage convolutional neural network is:
Lc(softmax(prec(Xj[seg][a][b][c])),Yj) (8)
wherein λ[c]Is a two-stage convolutional neural network matrix parameter, and[c]={W[b],B[b]},W[c]as a weight, B[c]Is a deviation.
As shown in fig. 5, each network training method in the container surface damage detection model based on the two-stage convolutional neural network is as follows:
firstly, all parameters W of each layer are calculated[i]And B[i]Initializing to a random value, setting iteration times S, learning rate Lr and making Xj=X0The 1 st picture sample in the damage state training data set is used;
② inputting picture sample X into sample input layerjCalculating to obtain and output the current state estimated value Yj’;
Computing cross entropy loss function L (Y)j',Yj)=-[Yjlog(Yj')+(1-Yj)log(1-Yj')]Obtaining the parameter value W of the parameter weight matrix of each layer[i]And bias matrix parameter value B[i]The value of the change is such that,
Figure BDA0003002993160000131
updating all parameters W[i]And B[i]Value, W[i]=W[i]-Lr·ΔW[i],B[i]=B[i]-Lr·ΔB[i]
Judging whether the current picture sample is the last one in the damage state training data set, if not, making Xj=Xj+1Jumping to the second step for the next sample in the training set, and jumping to the sixth step if the next sample in the training set is in the training set;
sixthly, judging whether S is 0, if so, finishing iteration, jumping to the step seven, and if not, re-ordering Xj=X0If S is S-1, jumping to the second step;
seventhly, if the accuracy threshold is set to T, indicating the damage stateAll picture samples in the test data set are input, and the state estimation value Y of each sample can be usedj' and corresponding true value YjComparing, calculating the ratio of the same number of samples with the estimated value and the true value to the total number N of all samples to obtain the accuracy Acc ═ Sigma (Y)j’==Yj) and/N. If Acc<If Acc is not less than T, turning to (b);
b combining all parameters W[i]And B[i]And fixing and storing, and finishing the training of the neural network model.
As shown in fig. 6, the steps of discriminating the surface damage of the container by using the trained model and outputting the detection condition are as follows:
firstly, loading all parameters in a trained container surface damage detection model; then importing the container surface picture to be distinguished, and carrying out relevant preprocessing operations such as graying, geometric transformation, image enhancement and the like on the container surface picture; inputting the processed picture into a two-stage convolutional neural network, and judging whether the surface of the container in the picture has damage and the damage type of the container; and finally, outputting, displaying, storing and recording the detection result and the corresponding original picture.
In summary, the technical core of the container surface damage detection method based on the two-stage convolutional neural network is to use the two-stage convolutional neural network, and the method mainly comprises four steps of data set making, detection model building, detection model training and detection by using the model. When a container surface damage detection training data set and a test data set are manufactured, preprocessing a picture sample and then constructing a division data set; the constructed container surface damage detection model based on the two-stage convolutional neural network consists of a segmentation network and a classification network; training a container surface damage detection model based on a two-stage convolutional neural network, wherein the training comprises an integral training process and a single network training method; and (3) distinguishing the surface damage of the container by using the trained model and outputting a detection result, wherein the distinguishing process comprises the processes of parameter loading, image processing, picture input, result distinguishing and the like. The invention carries out the detection of the surface damage of the container by establishing the two-stage convolution neural network model, realizes the automatic detection and judgment of whether the surface of the container is damaged or not and the damage type, can effectively reduce the recognition error rate, improve the detection accuracy, improve the operation efficiency of the container gate, reduce the operation labor cost of the port and improve the operation efficiency and the safety of the port.
While the invention has been described in detail and illustrated in the accompanying drawings and examples, it is not limited to the embodiments, but is capable of modifications and variations, as will be apparent to those skilled in the art, without departing from the spirit and scope of the invention.

Claims (10)

1. A container surface damage detection method based on a two-stage convolutional neural network is characterized by comprising the following steps:
s1, making a container surface damage detection training data set and a test data set, specifically collecting required container surface damage pictures, and performing image preprocessing; establishing a label value table for the surface damage type of the container, labeling the label value of the surface damage type corresponding to each picture, and forming a container surface damage detection data set by the picture sample and the label value table; dividing a data set into a training set and a testing set, selecting half of all damage type picture samples from a container surface damage detection data set, placing the picture samples in a random order, numbering each picture in the placing order, storing the picture numbers and corresponding damage type label values into a training set text file, forming the training data set by the picture samples and the training set text file, and manufacturing the testing data set by the same method;
s2, constructing a container surface damage detection model based on a two-stage convolutional neural network, wherein the two-stage convolutional neural network comprises a segmentation network and a classification network, the segmentation network processes a container surface damage image sample to obtain a damage segmentation characteristic diagram, and the classification network judges the damage type of the container surface damage image;
s3, training the container surface damage detection model through a training data set and a testing data set;
and S4, judging the surface damage of the container by using the trained model and outputting a detection result.
2. The method for detecting surface damage of container based on two-stage convolutional neural network as claimed in claim 1, wherein in step S1, container surface damage pictures are collected, and a large number of pictures with obvious "crack", "rust", "pit", "hole" and "wear" states on the surface of the container are selected for image preprocessing, wherein the preprocessed pictures are unified into pixels with the same height and width.
3. The container surface damage detection method based on the two-stage convolutional neural network as claimed in claim 1, wherein the image preprocessing specifically comprises:
carrying out weighted average on RGB three components by different weights by adopting a weighted average method to obtain a gray level image;
carrying out geometric transformation processing on the image, correcting random errors in the image acquisition and imaging process, and using a bilinear interpolation algorithm to avoid that pixels of an output image are mapped to non-integer coordinates of an input image;
the image enhancement technology is adopted to enhance the image quality and the information quantity and improve the identification effect, the median filtering neighborhood enhancement algorithm is specifically applied to eliminate image noise and enable the image noise to be clear, and the gradient operator neighborhood enhancement algorithm is applied to expand the difference between different object characteristics so as to highlight useful information.
4. The container surface damage detection method based on the two-stage convolutional neural network as claimed in claim 1, wherein the segmented network comprises a CNN segmented network and an ASPP network which are connected in sequence, the CNN segmented network is composed of 9 3 × 3 convolutional layers and 3 2 × 2 pooling layers, each pooling layer is respectively arranged after the 2 nd, 5 th and 9 th convolutional layers, so as to form 3 groups of convolutional-pooling layers which are connected in sequence; after an original picture sample X is input, carrying out convolution operation on the characteristic value of the picture sample at each position weight in the convolution layer and the convolution kernel size, extracting a plurality of characteristics of the picture and obtaining a group of convolution layer characteristic diagram sets, connecting a BN layer and a ReLU layer behind each convolution layer, carrying out batch standardization and activation function processing, carrying out pooling operation on the characteristic diagram sets at a pooling layer and a pooling window, reducing the data quantity of the characteristic diagram, carrying out secondary characteristic extraction on the characteristic diagram, avoiding the occurrence of overfitting phenomenon, and connecting the BN layer behind each pooling layer for batch standardization; the ASPP network is formed by 1 × 1 convolution layer and 3 × 3 hollow convolution layers which are distributed in parallel, the sampling rate is 4, 6 and 8 respectively, BN batch standardization operation is used after each convolution layer, 12 × 2 average pooling layer is connected for processing, and the calculation result of the Avg function in each average pooling layer represents an output matrix value formed by average pixel values in each 2 × 2 area in X; and finally, connecting the four layers of outputs together, and recovering the sample resolution of the original image by using a bilinear interpolation method through 1X 1 convolution layer and 1 upsampling layer to obtain an injury segmentation feature map X'.
5. The container surface damage detection method based on the two-stage convolutional neural network as claimed in claim 4, wherein the classification network comprises two CNN classification networks, each CNN classification network comprises 1 5 × 5 convolutional layer, 2 3 × 3 convolutional layers, 3 2 × 2 maximal pooling layers and last 2 fully-connected layers of 120 and 84, and each maximal pooling layer is respectively arranged behind a single convolutional layer to form 3 pairs of sequentially-connected convolutional-pooling layers; each layer has a plurality of two-dimensional planes, each plane having a plurality of neurons; connecting a ReLU layer behind each convolution layer for activating function processing, wherein the activating function ReLU calculates larger parameter values in output (0, x); the Max function calculation result in each maximum pooling layer represents an output matrix value consisting of the maximum pixel values in each 2X 2 area in X; and a Dropout layer is connected in front of each full connection layer, one-dimensional column vectors of the full connection layer are formed by completely expanding and recombining the characteristic diagrams of the most terminal pooling layer and are connected with the Softmax layer in a full connection mode.
6. The method as claimed in claim 4, wherein the first CNN classification network a is used for inputting a segmentation feature map X' to obtain the first CNN classification network aA classification characteristic map pa(ii) a The second CNN classification network b is used for inputting the original picture sample X to obtain a second classification characteristic graph pb(ii) a First class profile paAnd a second classification profile pbObtaining a fusion vector p after processing by a fusion functionsumThe probability Y 'of the various states of the conveying belt is obtained through calculation of a Softmax function, and the state with the maximum probability is selected as the finally judged current state Y' of the conveying belt to be output; y ' is an estimated value obtained by prediction calculation, Y is a corresponding label value of the original picture sample, and the cross entropy loss function L (Y ', Y) is calculated and minimized from Y ' and Y.
7. The method for detecting the surface damage of the container based on the two-stage convolutional neural network as claimed in claim 1, wherein in step S3, the overall training process of the two-stage surface damage detection model of the container specifically comprises:
inputting a training data set after the construction of the segmentation network is completed, and establishing a segmentation network loss function LsegMinimizing the parameters, and training the parameters lambda of the segmentation network matrix[seg]Fixing; inputting a training data set after the construction of the two classification networks a and b is completed, and establishing a classification network loss function LaAnd LbRespectively minimizing the parameters, and training the parameters lambda of the segmentation network matrix[a]And λ[b]Fixing; the matrix parameters of the segmentation and classification network are fixed, the two-stage convolutional neural network is input into a training data set after the construction is completed, and a loss function L of the two-stage convolutional neural network is establishedcMinimizing the parameter and obtaining the matrix parameter lambda of the trained two-stage convolution neural network[c]Fixing;
the training method of each network in the model comprises the following steps:
firstly, weighting matrix parameter values W of each layer in the neural network structure[i]And bias matrix parameter value B[i]Initializing to a random value, setting iteration times S, learning rate Lr and making Xj=X0,X0Training the 1 st picture sample in the data set for the damage state;
② inputting picture sample X into sample input layerjCalculating to obtain and output the current state estimated value Yj’;
Computing cross entropy loss function L (Y)j’,Yj) Obtaining parameters W of each layer[i]And B[i]Variation value Δ W[i]And Δ B[i]
Updating all parameters W[i]And B[i]Value, W[i]=W[i]-Lr*ΔW[i],B[i]=B[i]-Lr*ΔB[i]
Judging whether the current picture sample is the last one in the damage state training data set, if not, making Xj=Xj+1Jumping to the second step for the next sample in the training set, and jumping to the sixth step if the next sample in the training set is in the training set;
sixthly, judging whether S is 0, if so, finishing iteration, jumping to the step seven, and if not, re-ordering Xj=X0If S is S-1, jumping to the second step;
seventhly, setting a correct rate threshold value to be T, and if all picture samples in the damage state test data set are input, setting each sample state estimation value Yj' and corresponding true value YjComparing, calculating the ratio of the number of samples with the same estimated value and true value to the total number N of all samples to obtain the accuracy Acc, and if Acc is reached<If Acc is not less than T, turning to (b);
b combining all parameters W[i]And B[i]And fixing and storing, and finishing the training of the neural network model.
8. The method for detecting the surface damage of the container based on the two-stage convolutional neural network as claimed in claim 1, wherein the step S4 is as follows:
loading all parameters in the trained container surface damage detection model;
importing a container surface picture to be distinguished, and carrying out relevant preprocessing operations of graying, geometric transformation and image enhancement on the container surface picture;
inputting the processed picture into a two-stage convolutional neural network, and judging whether the surface of the container in the picture has damage and the damage type of the container;
and outputting, displaying and storing the detection result and the corresponding original picture.
9. A container surface damage detection system based on a two-stage convolutional neural network, comprising:
the data collection module is used for manufacturing a container surface damage detection training data set and a test data set, specifically collecting required container surface damage pictures and carrying out image preprocessing; establishing a label value table for the surface damage type of the container, labeling the label value of the surface damage type corresponding to each picture, and forming a container surface damage detection data set by the picture sample and the label value table; dividing a data set into a training set and a testing set, selecting half of all damage type picture samples from a container surface damage detection data set, placing the picture samples in a random order, numbering each picture in the placing order, storing the picture numbers and corresponding damage type label values into a training set text file, forming the training data set by the picture samples and the training set text file, and manufacturing the testing data set by the same method;
the model construction module is used for constructing a container surface damage detection model based on a two-stage convolutional neural network, the two-stage convolutional neural network comprises a segmentation network and a classification network, the segmentation network processes a container surface damage image sample to obtain a damage segmentation characteristic diagram, and the classification network judges the damage type of the container surface damage image;
the training module is used for training the container surface damage detection model through a training data set and a testing data set;
and the recognition module is used for distinguishing the surface damage of the container by using the trained model and outputting a detection result.
10. A storage medium, executable by a processor, having stored therein a computer program for performing the two-stage convolutional neural network-based container surface damage detection method as claimed in any one of claims 1 to 8.
CN202110353753.0A 2021-04-01 2021-04-01 Container surface damage detection method based on two-stage convolutional neural network Pending CN113096085A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110353753.0A CN113096085A (en) 2021-04-01 2021-04-01 Container surface damage detection method based on two-stage convolutional neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110353753.0A CN113096085A (en) 2021-04-01 2021-04-01 Container surface damage detection method based on two-stage convolutional neural network

Publications (1)

Publication Number Publication Date
CN113096085A true CN113096085A (en) 2021-07-09

Family

ID=76672337

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110353753.0A Pending CN113096085A (en) 2021-04-01 2021-04-01 Container surface damage detection method based on two-stage convolutional neural network

Country Status (1)

Country Link
CN (1) CN113096085A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113674225A (en) * 2021-07-30 2021-11-19 南京信息工程大学 Power equipment fault detection method based on convolutional neural network
CN114240948A (en) * 2021-11-10 2022-03-25 西安交通大学 Intelligent segmentation method and system for structural surface damage image
CN114782333A (en) * 2022-03-30 2022-07-22 中国民航大学 CFRP damage detection method based on U-net neural network model
CN116883444A (en) * 2023-08-02 2023-10-13 武汉理工大学 Automobile damage detection method based on machine vision and image scanning
CN117011295A (en) * 2023-10-07 2023-11-07 西南科技大学 UHPC prefabricated member quality detection method based on depth separable convolutional neural network
CN118097662A (en) * 2024-02-29 2024-05-28 东北大学 CNN-SPPF and ViT-based pap smear cervical cell image classification method
CN118097662B (en) * 2024-02-29 2024-09-27 东北大学 CNN-SPPF and ViT-based pap smear cervical cell image classification method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112037219A (en) * 2020-09-27 2020-12-04 上海电力大学 Metal surface defect detection method based on two-stage convolution neural network

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112037219A (en) * 2020-09-27 2020-12-04 上海电力大学 Metal surface defect detection method based on two-stage convolution neural network

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113674225A (en) * 2021-07-30 2021-11-19 南京信息工程大学 Power equipment fault detection method based on convolutional neural network
CN114240948A (en) * 2021-11-10 2022-03-25 西安交通大学 Intelligent segmentation method and system for structural surface damage image
CN114240948B (en) * 2021-11-10 2024-03-05 西安交通大学 Intelligent segmentation method and system for structural surface damage image
CN114782333A (en) * 2022-03-30 2022-07-22 中国民航大学 CFRP damage detection method based on U-net neural network model
CN114782333B (en) * 2022-03-30 2024-09-10 中国民航大学 CFRP damage detection method based on U-net neural network model
CN116883444A (en) * 2023-08-02 2023-10-13 武汉理工大学 Automobile damage detection method based on machine vision and image scanning
CN116883444B (en) * 2023-08-02 2024-01-12 武汉理工大学 Automobile damage detection method based on machine vision and image scanning
CN117011295A (en) * 2023-10-07 2023-11-07 西南科技大学 UHPC prefabricated member quality detection method based on depth separable convolutional neural network
CN117011295B (en) * 2023-10-07 2024-01-23 西南科技大学 UHPC prefabricated member quality detection method based on depth separable convolutional neural network
CN118097662A (en) * 2024-02-29 2024-05-28 东北大学 CNN-SPPF and ViT-based pap smear cervical cell image classification method
CN118097662B (en) * 2024-02-29 2024-09-27 东北大学 CNN-SPPF and ViT-based pap smear cervical cell image classification method

Similar Documents

Publication Publication Date Title
CN110570396B (en) Industrial product defect detection method based on deep learning
CN108961235B (en) Defective insulator identification method based on YOLOv3 network and particle filter algorithm
CN111563473B (en) Remote sensing ship identification method based on dense feature fusion and pixel level attention
CN113096085A (en) Container surface damage detection method based on two-stage convolutional neural network
US11429818B2 (en) Method, system and device for multi-label object detection based on an object detection network
CN109376792B (en) Photovoltaic cell appearance defect classification method based on multi-channel residual error neural network
CN111179217A (en) Attention mechanism-based remote sensing image multi-scale target detection method
CN114092389A (en) Glass panel surface defect detection method based on small sample learning
CN113610822B (en) Surface defect detection method based on multi-scale information fusion
CN112800838A (en) Channel ship detection and identification method based on deep learning
CN111008632A (en) License plate character segmentation method based on deep learning
CN113256624A (en) Continuous casting round billet defect detection method and device, electronic equipment and readable storage medium
CN114581782A (en) Fine defect detection method based on coarse-to-fine detection strategy
CN108932471B (en) Vehicle detection method
CN115147418B (en) Compression training method and device for defect detection model
CN111062381A (en) License plate position detection method based on deep learning
CN111310827A (en) Target area detection method based on double-stage convolution model
CN114565824B (en) Single-stage rotating ship detection method based on full convolution network
CN112837281B (en) Pin defect identification method, device and equipment based on cascade convolution neural network
CN113313678A (en) Automatic sperm morphology analysis method based on multi-scale feature fusion
CN117495825A (en) Method for detecting foreign matters on tower pole of transformer substation
CN116740572A (en) Marine vessel target detection method and system based on improved YOLOX
CN111126173A (en) High-precision face detection method
CN115984219A (en) Product surface defect detection method and device, electronic equipment and storage medium
CN113435480B (en) Method for improving long tail distribution visual recognition capability through channel sequential switching and self-supervision

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210709

RJ01 Rejection of invention patent application after publication