Disclosure of Invention
The high-resolution image object surface defect detection method based on deep learning effectively improves the target detection range and detection precision and provides a basis for large-scale target nondestructive detection.
In order to achieve the purpose, the invention adopts the following technical scheme:
a high-resolution image object surface defect detection method based on deep learning comprises the following steps:
s1: fixing a plurality of high-resolution cameras right above an object, collecting images on the surface of the object by the cameras, and splicing the images to obtain high-resolution images;
s2: preprocessing the high-resolution image to detect the edge of the suspected defect part, obtaining an area with a remarkable edge, partitioning the area with the remarkable edge by adopting a circumscribed rectangle fitting mode, and corresponding to the original image to obtain an edge image area and an original image area;
s3: inputting the edge image area and the original image area into a deep convolutional neural network for feature fusion and identification of target area classification;
s4: the type of surface crack and the probability of belonging to that type are output.
Preferably, the image stitching in step S1 includes image preprocessing, image feature point matching, image registration, and image fusion.
Preferably, the image preprocessing comprises operations of image ray correction, image denoising and camera distortion correction;
the image feature point matching adopts an image matching method based on image features, and comprises a corner point detection method, image registration based on contour features and image matching based on SIFT;
after image feature point matching, the image registration calculates a space model among a plurality of images and carries out space transformation, so that the overlapped parts of the two images are aligned in space and are the key for image splicing;
the image fusion aims to obtain a seamless high-quality image, eliminate the difference between seams and brightness on the premise of not losing original image information and realize smooth transition of a splicing boundary.
Preferably, the spatial transformation between the multiple images in the image registration comprises: translation, rotation, scaling, affine transformation, projective transformation.
Preferably, the projective transformation is more generalized than the translation, rotation, scaling and affine transformations;
if an image
、
If the projective transformation relation exists, the homogeneous equation is used for expressing:
wherein: m is0、m1、m3And m4Collectively representing a rotation angle and a zoom scale; m is2And m5Respectively representing the translation amount in the x direction and the y direction; m is6And m7The deformation quantities in the x direction and the y direction are respectively expressed, and the key of image registration is to determine the parameters of a space transformation model M by using a homogeneous equation.
Preferably, in step S2, an edge operator is used to perform image edge preprocessing on the high-resolution image, detect the edge of the suspected defect portion, obtain an area with a significant edge, perform blocking processing on the area with a significant edge by using a circumscribed rectangle fitting method, and perform area correspondence with the original image, so as to obtain an edge image area and an original image area.
Preferably, the edge operator adopts any one of a Canny edge detection operator, a laplacian operator, a Prewitt operator and a Sobel operator.
Preferably, the convolutional neural network structure in step S3 adopts a modified NIN network.
Preferably, the feature fusion uses a softmax function to map the output scalar to the probability distribution of the corresponding category of the image, and the objective function is:
in the formula (I), the compound is shown in the specification,
in order to train the number of samples,
for the actual class of the sample,
which represents the predicted output of the sample(s),
as are the parameters of the network model,
arranged to prevent overfitting during network training
The regularization term, as shown in equation,
value 0.00005;
compared with the prior art, the invention has the beneficial effects that: the invention provides a high-resolution image object surface defect detection method based on deep learning, which aims at the problems that the field angle of large-scale targets is limited by adopting a single camera or the detection efficiency of multiple cameras is low, adopts a large-scale object surface crack detection method based on deep learning, effectively improves the target detection range and detection precision, and provides a basis for the nondestructive detection of the large-scale targets.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
In the description of the present invention, "a plurality" means two or more unless otherwise specified; the terms "upper", "lower", "left", "right", "inner", "outer", "front", "rear", "head", "tail", and the like, indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are only for convenience in describing and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed in a particular orientation, and be operated, and thus, should not be construed as limiting the invention. Furthermore, the terms "first," "second," "third," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it is to be noted that, unless otherwise explicitly specified or limited, the terms "connected" and "connected" are to be interpreted broadly, e.g., as being fixed or detachable or integrally connected; can be mechanically or electrically connected; may be directly connected or indirectly connected through an intermediate. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Example 1
Referring to fig. 1 and 2, a method for detecting surface defects of a high-resolution image object based on deep learning includes the following steps:
s1: fixing a plurality of high-resolution cameras right above an object, collecting images on the surface of the object by the cameras, and splicing the images to obtain high-resolution images;
s2: preprocessing the image edge detection of the high-resolution image to obtain an area with obvious edge and a corresponding original image area;
s3: inputting the region with obvious edge and the original gray image into a deep convolution neural network for feature fusion and identification of target region classification;
s4: the type of surface crack and the probability of belonging to that type are output.
The image stitching in step S1 includes image preprocessing, image feature point matching, image registration, and image fusion.
The image preprocessing comprises basic operations of image light correction, image denoising and camera distortion correction.
The image feature point matching adopts an image matching method based on image features, only uses partial information of the image, such as features of contours, corners and the like, and mainly adopts a corner point detection method, image registration based on contour features and image registration based on SIFT.
After image registration is matched through image feature points, a space model among a plurality of images is calculated and space transformation is carried out, so that the overlapped parts of the two images are aligned in space and are the key of image splicing.
The spatial transformation between the multiple images in image registration includes: translation, rotation, scaling, affine transformation, projective transformation. Where projective transformations are more prevalent than translation, rotation, scaling and affine transformations.
Hypothetical image
、
If the projective transformation relation exists, the homogeneous equation is used for expressing:
wherein: m is0、m1、m3And m4Collectively representing a rotation angle and a zoom scale; m is2And m5Respectively representing the translation amount in the x direction and the y direction; m is6And m7The deformation quantities in the x direction and the y direction are respectively expressed, and the key of image registration is to determine the parameters of a space transformation model M by using a homogeneous equation.
The purpose of image fusion is to obtain a seamless high-quality image, eliminate the difference between seams and brightness on the premise of not losing original image information, and realize smooth transition of a splicing boundary.
Example 2
Referring to fig. 1 and 3, a method for detecting surface defects of a high-resolution image object based on deep learning includes the following steps:
s1: fixing a plurality of high-resolution cameras right above an object, collecting images on the surface of the object by the cameras, and splicing the images to obtain high-resolution images;
s2: preprocessing the image edge detection of the high-resolution image to obtain an area with obvious edge and a corresponding original image area;
s3: inputting the region with obvious edge and the original gray image into a deep convolution neural network for feature fusion and identification of target region classification;
s4: the type of surface crack and the probability of belonging to that type are output.
In step S2, an edge operator is used to perform image edge preprocessing on the high-resolution image, because the target surface defect is generally obvious, an edge operator is used to perform image preprocessing to detect the edge of the suspected defect portion, wherein the edge operator can be any one of Canny edge detection, laplacian operator, Prewitt operator and Sobel operator to obtain a region with a significant edge, and finally, a circumscribed rectangle fitting manner is used to perform blocking processing on the region with a significant edge, and the region corresponds to the original image to obtain an edge image region and an original image region.
In step S3, the convolutional neural network structure adopts an improved NIN network, and the network layer is shown in table 1:
TABLE 1 improved NIN network
The NIN Network does not contain a full-connection layer, and the improved NIN Network is a Network In Network published In 2014, wherein the full-connection layer is introduced on the basis of the Network In Network, an image with the size of 32x32 is subjected to forward propagation layer by layer, ReLU is taken as an activation function, and two characteristic diagrams with the size of 8x8 are output at the last convolutional layer. And modifying the last two layers, and introducing a full connection layer, so that the original characteristic diagram of 8x8 is output and converted into a vector of 64 dimensions.
The feature fusion adopts a softmax function to map the output scalar quantity into the probability distribution of the corresponding category of the image, and the target function is as follows:
in the formula (I), the compound is shown in the specification,
in order to train the number of samples,
for the actual class of the sample,
which represents the predicted output of the sample(s),
as are the parameters of the network model,
arranged to prevent overfitting during network training
The regularization term, as shown in equation,
value 0.00005;
the above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be able to cover the technical scope of the present invention and the equivalent alternatives or modifications according to the technical solution and the inventive concept of the present invention within the technical scope of the present invention.