Disclosure of Invention
The invention provides a defect detection method and system based on multi-angle imaging, and aims to solve the problem that defect detection cannot be performed based on multi-angle images of products in the prior art.
According to a first aspect of the embodiments of the present application, there is provided a defect detection method based on multi-angle imaging, including the following steps:
acquiring an original image of a product to be detected;
obtaining the class information of a product to be detected according to the original image; acquiring the actual position coordinates of a product to be detected according to the original image; establishing a multi-angle parameter library for multi-angle photographing;
obtaining a multi-angle image of the product to be detected according to the category information, the actual position coordinate and the multi-angle parameter library;
and obtaining a defect detection result of the product to be detected according to the multi-angle image.
Optionally, the obtaining of the category information of the original image according to the original image specifically includes:
constructing a classification network model;
training a classification network model by taking the manual labeling data of the product to be detected as a training sample to obtain a trained classification network model;
and inputting the original image of the product to be detected to the trained classification network model to obtain the class information of the product to be detected.
Optionally, obtaining the actual position coordinates of the product to be inspected according to the original image specifically includes:
constructing a positioning network model based on target detection;
training a positioning network model by taking the manual marking data of the product to be detected as a training sample to obtain a trained positioning network model;
inputting an original image of a product to be detected to a trained positioning network model to obtain a central point coordinate and direction angle information of the product to be detected;
and obtaining the actual position coordinate of the product to be detected based on the camera calibration principle according to the center point coordinate and the direction angle information of the product to be detected.
Optionally, the multi-angle parameter library includes multi-angle parameters of different types of products to be inspected, and the multi-angle parameters include initial angles, front shooting angles, left shooting angles and right shooting angles of original images in one-to-one correspondence.
Optionally, the multi-angle image of the product to be inspected is obtained according to the type information of the original image, the actual position coordinate of the product to be inspected and the multi-angle parameter library, and the method specifically includes:
calling multi-angle coordinates required by multi-angle photographing imaging under the corresponding product class of the multi-angle parameter library according to the product class information of the product to be detected;
calculating a plurality of angular displacements of the hand-eye calibration robot for photographing imaging according to the actual position coordinates of the product to be detected and multi-angle coordinates required by multi-angle photographing imaging;
the hand-eye calibration robot carries out self-adaptive multi-angle imaging shooting according to the plurality of angular displacements of the shooting imaging to obtain a multi-angle image of a product to be detected.
Optionally, the defect detection result of waiting to examine the product is obtained according to waiting to examine the multi-angle image of examining the product, specifically includes:
constructing a defect segmentation network model;
training a defect segmentation network model by taking the manual marking data of the product to be detected as a training sample to obtain a trained defect segmentation network model;
and inputting the multi-angle image of the product to be detected to the trained defect segmentation network model to obtain a defect segmentation result of the product to be detected, and further obtaining a defect detection result of the product to be detected.
Optionally, the defect segmentation network is a PSPNet semantic segmentation network, a SegNet semantic segmentation network, a fullyconditional densnet semantic segmentation network, or a U-Net semantic segmentation network.
According to a second aspect of the embodiments of the present application, a defect detection system based on multi-angle imaging is provided, which specifically includes:
an original image acquisition module: the method comprises the steps of obtaining an original image of a product to be detected;
an original image analysis module: the system is used for acquiring the class information of a product to be detected according to the original image; the system is used for acquiring the actual position coordinates of a product to be detected according to the original image;
multi-angle parameter library module: the system comprises a parameter database, a parameter database and a parameter database, wherein the parameter database is used for establishing a multi-angle parameter database for multi-angle photographing;
a multi-angle image module: the multi-angle parameter library is used for obtaining a multi-angle image of the product to be detected according to the category information, the actual position coordinate and the multi-angle parameter library;
a defect detection module: and obtaining a defect detection result of the product to be detected according to the multi-angle image.
According to a third aspect of the embodiments of the present application, there is provided a defect detection terminal, including: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform a defect detection method based on multi-angle imaging.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium having a computer program stored thereon; the computer program is executed by a processor to implement a defect detection method based on multi-angle imaging.
By adopting the defect detection method and system based on multi-angle imaging in the embodiment of the application, the original image of the product to be detected is obtained firstly; then, acquiring the class information of the product to be detected according to the original image, acquiring the actual position coordinate of the product to be detected according to the original image and establishing a multi-angle parameter library for multi-angle photographing; then, obtaining a multi-angle image of the product to be detected according to the type information of the original image, the actual position coordinate of the product to be detected and a multi-angle parameter library; and finally, obtaining a defect detection result of the product to be detected according to the multi-angle image of the product to be detected. The method and the device realize the self-adaptive intelligent quality inspection of the products in the production mode of small batches and multiple batches of products, realize the multi-angle imaging of the three-dimensional multi-surface structure of the products and carry out more accurate defect detection based on the multi-angle imaging, and solve the problem that the defect detection of the multiple batches of products based on the multi-angle imaging cannot be realized in the prior art.
Example 1
In order to better explain the defect detection method based on multi-angle imaging in the embodiment of the present application, a convolutional neural network, an image classification network, target detection, and image segmentation adopted in the embodiment of the present application are first described.
Regarding the convolutional neural network, the convolutional neural network is a kind of feedforward neural network including convolutional calculation and having a deep structure, and is one of the representative algorithms of deep learning. The convolutional neural network has the capability of feature learning, and can carry out translation invariant classification on input information according to the hierarchical structure of the convolutional neural network. The artificial neuron can respond to peripheral units in a part of coverage range, has excellent performance on large-scale image processing, and comprises a convolutional layer and a pooling layer, wherein the convolutional layer is used for carrying out feature extraction on a small region and a small region on an original input image to obtain a feature map; the pooling layer is used for further feature compression of the feature map. The convolutional neural network is commonly used in visual tasks such as image classification, target detection, semantic segmentation and the like, and most of the tasks utilize the convolutional neural network to extract different features, then construct different tasks, then utilize a large number of labeled training samples to learn, and continuously adjust parameters in the network in the learning process so as to achieve the purpose of minimizing prediction errors.
With respect to image classification networks, which are a relatively wide research direction in the field of computer vision, the core of image classification is the task of assigning a label to a given image from a given classification set.
An example image classification network application according to the present application is shown in fig. 1. Referring to fig. 1, the image classification model reads picture feature information and generates a tag probability that the picture belongs to the image set { cat, dog, hat, mug }. For the computer, the image is a large three-dimensional array of numbers, in this example the image size of a cat is 248 pixels wide and 400 pixels high, with 3 channels of color, red, green and blue (i.e., RGB). Thus, the image contains 248X400X 3-297600 numbers, each number ranging from an integer between 0 and 255, where 0 represents all black and 255 represents all white. The task of image classification is to turn these numbers into a simple image label "cat".
Regarding target detection, target detection is a technology used for identifying specific objects in an image and object positions in computer vision, and an algorithm is required to determine not only the category of the objects in the image, but also the position coordinates of the objects in the image. The location information for object detection generally consists of two formats: the upper left corner of the picture is taken as the origin (0,0), one is represented by polar coordinates, and the polar coordinates are (xmin, ymin, xmax, ymax). Wherein xmin and ymin respectively represent the minimum value of x and y coordinates, and xmax and ymax respectively represent the maximum value of the x and y coordinates; another is the center point coordinate, which is (x _ center, y _ center, w, h). Wherein, x _ center, y _ center represents the center point coordinate of the target detection frame, and w, h represents the width and height of the target detection frame. However, the conventional target detection method is insufficient for detecting the surface defects of the product to be detected in the real scene, because the product to be detected in the real scene is not horizontally placed and the surface of the product to be detected is an irregular curved surface, the shot product to be detected often has some angle deviation or other side interference areas. Aiming at the problems in the prior art, the embodiment of the application adopts a rotating target detection network RRPN based on text detection, generates a candidate region with an angle by setting rotating candidate frames with different proportions, and calculates the actual deflection angle of a product to be detected by using the generated candidate region angle so as to better adapt to the surface defect region of the product to be detected in reality and realize the self-adaptive shooting of a hand-eye calibration robot.
With respect to image segmentation, image segmentation is a technique and process that divides an image into several specific regions with unique properties and extracts an object of interest. The image segmentation is a task of distributing semantic labels to each pixel in an image, so that the features in the same sub-region have certain similarity, and the features of different sub-regions show obvious differences. From a mathematical point of view, image segmentation is a process of dividing an image into mutually disjoint regions.
An example image segmentation application according to the present application is shown in fig. 2. As shown in fig. 2, the objects, horses and people in the picture are segmented and identified with different colors. Through image segmentation, objects in the image can be simply and clearly identified, the image can be greatly simplified, and the main attention objects can be highlighted.
Based on the technical understanding, fig. 3 is a flowchart illustrating the steps of a defect detection method based on multi-angle imaging according to an embodiment of the present application.
As shown in fig. 3, the defect detection method based on multi-angle imaging of the present embodiment specifically includes the following steps:
s101: and acquiring an original image of the product to be detected.
S102: obtaining the class information of a product to be detected according to the original image; acquiring the actual position coordinates of a product to be detected according to the original image; and establishing a multi-angle parameter library for multi-angle photographing.
S103: and obtaining a multi-angle image of the product to be detected according to the category information, the actual position coordinate and the multi-angle parameter library.
S104: and obtaining a defect detection result of the product to be detected according to the multi-angle image.
In detail, in S101, an original image of a product to be inspected is acquired. Firstly, a plurality of batches of products to be detected are respectively placed on a detection table of the products to be detected, initial photographing is carried out by utilizing a hand-eye calibration robot, and an original image is obtained by initial photographing.
In step S102, the method for obtaining the category information of the original image according to the original image specifically includes the following steps:
first, a classification network model is constructed.
The method for classifying the product pictures comprises the steps of obtaining different batches of product information from multiple batches of product pictures to be detected by adopting a deep learning-based classification network method.
A schematic structural diagram of a classification network according to an embodiment of the present application is shown in fig. 4. As shown in fig. 4, the structure is characterized in that:
(1) a 3 channel RGB raw image of size 448 x 448 pixels is input.
(2) The input image is respectively subjected to convolution operation and down-sampling operation for 3 times, and then a compressed image feature map is obtained.
The convolution layer is used for processing the picture, so that the characteristic with higher robustness can be learned; the down-sampling mode is to adopt a maximum pooling mode to take the maximum value of the feature points in the neighborhood, the maximum pooling can reduce the parameter scale and reduce the parameter complexity, and finally the feature map with the reduced size and the increased channel number can be obtained.
(3) The feature map after the convolutional layer is fed into the fully-connected layer, which maps the learned features to the sample space, and then computes the probability of one class using the softmax activation function. Since the convolution kernel of 1x1 does not change the size of the image, a convolution layer of 1x1 is used instead of the full link layer.
(4) Training speed can be accelerated by Batch Normalization before the convolutional layer, generalization capability of the network is improved, and a Re L U activation function is used after the convolutional layer to improve the nonlinear relation between the convolutional layers and prevent over-training.
Secondly, training the constructed classification network model by taking the manual marking data of the product to be detected as a training sample, and finally obtaining the trained classification network model.
The method specifically comprises the following steps:
the convolutional neural network is used as a classification network, and one characteristic of the convolutional neural network is that a large amount of manual labeling data is required to be used as a training sample.
Acquiring and labeling training data of a classification network, namely firstly, shooting a large number of defect sample pictures by using a hand-eye calibration robot; and then, manually labeling the defect photos: naming the images of each different category as different IDs under the corresponding category; then, the labeled data are divided into a training set, a testing set and a verification set according to the proportion of 5:1:1 and are used for classification network training. And marking the area of the product to be detected in each image by using a rectangular frame, and recording the coordinates of the rectangular frame for the target detection network.
After obtaining a training sample and obtaining a classification network, starting inputting the training sample to train the classification network, wherein the related operations in the training process are as follows:
firstly, using transform's Resize method to reset the training data to 600 mm in length and 600 mm in width; then, randomly and horizontally turning the image, randomly cutting out 448 x 448 images from the image, and loading training data;
in the training process, the size of the used batchsize is set to be 16, and the initial learning rate is 0.001;
during training, a random gradient descent method with momentum is used. In other methods, optimization methods such as Adagrad, RMSprop, Adam and the like can be adopted, and a random gradient descent method with momentum can be used in the training method to achieve relatively better training effect;
during training, an N LLL oss loss function is used;
during the training process, the test is performed every 5 epochs of training until the model is trained to converge.
And finally, based on the trained classification network, performing class prediction on the product to be detected by using the classification network based on deep learning. And inputting the original image of the product to be detected to the trained classification network model to obtain the class information of the product to be detected.
Specifically, after the classification network is trained, the trained classification network is used for predicting the product to be detected, and the image shot by the hand-eye calibration robot is sent into the trained classification model for prediction only by loading the trained classification network model without using an optimizer and a loss function.
After the classification network obtains the category information of a plurality of batches of products to be detected, the position coordinates of the products to be detected on the detection platform are required to be obtained so as to realize self-adaptive multi-angle imaging, and therefore a positioning network based on target detection is required to be further introduced to obtain the actual position coordinates of the products to be detected.
In step S102, obtaining the actual position coordinates of the product to be detected according to the original image, specifically comprising the following steps:
firstly, a positioning network model based on target detection is constructed.
The positioning network based on target detection in the embodiment of the present application adopts an RRPN target detection network based on text detection, and fig. 5 shows a schematic structural diagram of the target detection network according to the embodiment of the present application.
As shown in fig. 5, the network structure is characterized in that:
(1) a 3-channel RGB image of size 448 x 448 pixels is input.
(2) The input image passes through 5 convolutional layers and 2 downsampling layers, the 2 downsampling layers are respectively behind the first convolutional layer and the second convolutional layer, and then an image feature map is formed.
(3) Then go through RRPN module, which contains anchor points (anchors) with different sizes, aspect ratios and-
0,
And finally generating a candidate area with an inclined angle by six different rotation angles, so that the candidate frame can be more accurately adapted to the direction of the area of the product to be detected.
(4) Then, the images pass through an RROIPooling layer, the input layer of the RROIPooling layer is the output of conv5 and a region propofol, the number of the region propofol is about 2000, and features corresponding to each RoI are extracted from a feature map by RoI Pooling L eye.
(5) Finally, through a fully connected layer with 4096 dimensions of two outputs (output), one is classified output and the other is regression output.
Secondly, training the constructed target detection positioning network model by taking the manual marking data of the product to be detected as a training sample to obtain the trained target detection network model.
The method specifically comprises the following steps:
a convolutional neural network is used as a target detection network, and one characteristic of the convolutional neural network is that a large amount of manually labeled data is required to be used as a training sample.
Acquiring and labeling training data of a target detection network, firstly, shooting a large number of defect sample pictures by using a hand-eye calibration robot; and then, manually labeling the defect photos: naming the images of each different category as different IDs under the corresponding category; then, dividing the labeled data into a training set, a testing set and a verification set according to the proportion of 5:1:1, and training the labeled data for the target detection network.
After a training sample is obtained and a target detection network is obtained, the training sample is input to train the target detection network, and the related operations in the training process are as follows:
first, the Resize method is used to reset the training data to the size of 600 a, then the image is randomly flipped horizontally, then 448 x 448 images are randomly cropped from the image, and the training data is loaded.
In the training process, a plurality of loss functions are selected for testing regression output of the position of a product to be tested, the loss functions comprise focal loss, skrinkage loss, loss triple loss and reporting loss, and finally the focal loss function with the best test result is selected from the loss functions to serve as a final loss function.
During training, for any one RoI, calculating the softmax loss value of the RoI belonging to the background area and the regression value of the RoI not belonging to the background.
In the training process, the training strategy adopts 4-step alternating training until the loss function is converged.
And then, based on the trained target detection network, positioning the product to be detected by using the network based on the target detection. And inputting an original image of the product to be detected to a trained positioning network model based on target detection to obtain the coordinate of the central point and the direction angle information of the product to be detected.
And finally, obtaining the actual position coordinate of the product to be detected based on the camera calibration principle according to the center point coordinate and the direction angle information of the product to be detected.
The specific process is as follows:
1) inputting a training sample for target detection into a trained target detection network, outputting coordinates of a center point of a regressed product to be detected and generating a toolInclination angle of direction angle information of product to be detected
2) And obtaining the actual position coordinates of the product to be detected on the detection platform from the space points and the corresponding pixel points according to the camera calibration principle.
The camera calibration principle is as follows:
and establishing a camera coordinate system by taking one point O as an origin. Where point Q (X, Y, Z) is a point in the camera coordinate system space that is projected by the ray onto the image plane at point Q (X, Y, f). The image plane is perpendicular to the optical axis z-axis and the distance from the projected center point is f (f is the focal length of the camera). According to the triangular proportional relation, the following can be obtained: x/f is X/Z Y/f is Y/Z, that is, X fX/Z Y is fY/Z, and a process of mapping a Q point having coordinates (X, Y, Z) to a Q point having coordinates (X, Y) on a projection plane is called projection transformation.
The above Q point to Q point transformation relationship can be expressed by a 3 × 3 matrix as: q is MQ, wherein,
then, a perspective projective transformation matrix can be computed:
the matrix M is called an intrinsic parameter matrix of the camera, and the units are all physical dimensions.
By the above method, the camera coordinate system can be converted into physical units [ i.e., (X, Y, Z) → (X, Y) ] like the image coordinate system.
The traditional target detection method is not enough for detecting the surface defects of the product to be detected in the real scene, because the product to be detected in the real scene is not horizontally placed, and the surface of the product to be detected is an irregular curved surface, the shot product to be detected often has some angle deviation or other side interference areas. The embodiment of the application adopts the rotating target detection network RRPN based on text detection, generates the candidate area with the angle by setting the rotating candidate frames with different proportions, and calculates the actual deflection angle of the product to be detected by using the generated candidate area angle so as to better adapt to the surface defect area of the product to be detected in reality and realize the self-adaptive shooting of the hand-eye calibration robot.
In step S102, a multi-angle parameter library for multi-angle photographing is established. The multi-angle parameter library comprises multi-angle parameters of different types of products to be detected, and the multi-angle parameters comprise initial angles, front shooting angles, left shooting angles and right shooting angles of original images in one-to-one correspondence.
In step S103, a multi-angle image of the product to be detected is obtained according to the type information of the original image, the actual position coordinates of the product to be detected and the multi-angle parameter library. The method specifically comprises the following steps:
firstly, calling multi-angle coordinates required by multi-angle photographing imaging under a product class corresponding to a multi-angle parameter library according to the product class information of a product to be detected.
And then, calculating a plurality of angular displacements of the hand-eye calibration robot for photographing and imaging according to the actual position coordinates of the product to be detected and the multi-angle coordinates required by multi-angle photographing and imaging.
And finally, the hand-eye calibration robot carries out self-adaptive multi-angle imaging shooting according to the plurality of angular displacements of the shooting imaging to obtain a multi-angle image of the product to be detected.
Before the adaptive multi-angle imaging is realized, we complete the following three tasks through step S102, summarized as:
(1) predicting different types of information under multiple batches by utilizing a classification network, namely firstly enabling a computer to determine which product to be detected a picture shot by a current hand-eye calibration robot belongs to;
(2) after the category of the current product to be detected is determined, the coordinate of the central point of the current product to be detected on the picture is regressed by using a positioning neural network based on target detection, and then the actual position of the product to be detected on the detection table is calculated by using a camera calibration principle.
(3) And establishing a multi-angle parameter library comprising various categories of products to be detected. Aiming at different products to be detected, an initial shooting angle and multi-angle parameters are preset by taking the lower left corner of a detection table as an original point (unit cm), so that a multi-angle parameter library of the products to be detected is formed.
Wherein, the initial shooting angle is used for shooting an initial photo for the classification network to use; the multi-angle parameters are some multi-angle parameters preset for different products to be detected to have different three-dimensional structures. Table 1 is an example of a multi-angle parameter library.
Product category to be inspected
|
Initial shooting angle
|
Front shooting angle
|
Left side shooting angle
|
Right side shooting angle
|
Product to be inspected 1
|
(25,25,45°)
|
(25,25,45°)
|
(-25,18,-135°)
|
(38,24,25°)
|
Product to be inspected 2
|
(30,20,45°)
|
(32,22,45°)
|
(-28,23,-140°)
|
(35,22,30°)
|
…
|
…
|
…
|
…
|
…
|
Product n to be inspected
|
(28,26,45°)
|
(30,26,45°)
|
(-20,25,-145°)
|
(39,20,20°) |
TABLE 1 Multi-Angle parameter library example
In S103, a multi-angle image of the product to be detected is obtained according to the type information of the original image, the actual position coordinates of the product to be detected and a multi-angle parameter library, and the specific implementation calculation process is as follows:
assuming that the coordinates of a preset fixed placing position of a product to be detected on a detection table are (a, b, theta), and the coordinate of an angle required to be imaged on a certain surface of the product to be detected is
The actual position coordinate positioned by the target detection network is (x, y, theta');
calculating the deviation between the current placing position of the product to be detected and a preset position as (a-x, b-y, theta-theta');
given that the same product to be inspected is placed according to the appointed surface (namely, the product to be inspected is only placed horizontally, can not be placed vertically, and is only slightly deviated in the horizontal direction when being placed), the hand-eye calibration robot needs to move the coordinates and the rotation angle of m and n
In the same way, the coordinate deviation value to which the hand-eye calibration robot needs to move is equal to the calculated deviation value (a-x, b-y, theta-theta') of the to-be-detected product and the actual preset placing position;
inclination angle of direction angle of product to be detected returned by target detection network
Namely, it is
Finally, the coordinate position of the movement of the hand-eye calibration robot is obtained as
And then the multi-angle image of the hand-eye calibration robot can be driven.
In step S104, a defect detection result of the product to be detected is obtained according to the multi-angle image of the product to be detected. After the self-adaptive multi-angle imaging shooting, the defect images of the product to be detected under multiple angles are obtained, and the defect segmentation and detection are carried out on the defect images under multiple angles by adopting a defect segmentation network based on semantic segmentation.
The defect detection process according to the defect segmentation network specifically comprises the following steps:
first, a defect segmentation network model is constructed.
The embodiment of the application adopts a multilayer convolution segmentation network PSPNet to segment target defects from the photos. A schematic structural diagram of a defect segmentation network according to an embodiment of the present application is shown in fig. 6.
As shown in fig. 6, the structure is characterized in that:
(1) fig. 6(a) is an input picture of 3 channels RGB with an image size of 448 × 448 pixels.
(2) Fig. 6(b) is a pre-trained residual network by applying dilation convolution, which includes a series of convolution and pooling operations, where the convolution operation can extract image features, the pooling operation can compress the image features, and finally the output feature map is 1/8 size of the input original image.
(3) In fig. 6(c), the pyramid pooling module is used to aggregate context information, the pyramid level is 4 levels, and for the four levels of feature maps, overfitting can be prevented by convolution layer, Batch Normalization by Batch wise normalized by Re L U activation function, thereby improving the network generalization capability.
(4) For the feature maps of the four levels, the spatial size of each feature map is reduced to the spatial size of the input of the pyramid pooling module through up-sampling (linear interpolation) respectively.
(5) And connecting the feature maps of the four levels and the input of the pyramid pooling module in series, then combining the previous pyramid feature map with the original feature map concat, and finally obtaining the final predicted feature map through the convolution layer.
Secondly, training the constructed defect segmentation network model by taking the manual marking data of the product to be detected as a training sample to obtain the trained defect segmentation network model.
The method specifically comprises the following steps:
in the defect segmentation network, a convolutional neural network is used, and one characteristic of the convolutional neural network is that a large amount of manual labeling data is required to be used as a training sample. Firstly, a hand-eye calibration robot is used for shooting a large number of defect sample pictures; and then, manually labeling the defect photos: naming the images of each different category as different IDs under the corresponding category; these annotation data were then divided into a training set, a test set, and a validation set on a 5:1:1 scale. Wherein, each defect in the photo is observed manually, the defect area is identified according to the pixel level, and the final form of the label is a mask image with the same size as the original photo and is used for a defect segmentation network.
After a training sample is obtained and a defect segmentation network is constructed, the training sample is input to train the defect segmentation network, and the related operations in the training process are as follows:
first, the training data is loaded and randomly shuffled, scaling the training set photos and labeled defect mask images to 448 long and 448 wide dimensions.
In the training process, a focal loss function is selected for testing segmentation loss, an auxiliary loss function is added, and the weight of the auxiliary loss function is 0.4 to balance final loss and auxiliary loss.
In the training process, an Adam optimizer is used, the initial learning rate is 0.01, and the model is evaluated once after each epoch by using class intersection and comparison until the model converges.
And finally, inputting the multi-angle image of the product to be detected to the trained defect segmentation network model to obtain a defect segmentation result of the product to be detected, and further obtaining a defect detection result of the product to be detected.
Specifically, in order to complete the detection of the surface defects of the product to be detected, the following operations are required:
1) and loading a trained semantic segmentation network, and scaling the original images of the product to be detected at a plurality of surface angles, which are shot by the hand-eye calibration robot, to the size of 448 the length and 448 the width.
2) And (4) sending the original image into a defect segmentation network based on semantic segmentation, and finally obtaining a predicted probability distribution map.
In other embodiments, the defect segmentation network may be a SegNet semantic segmentation network, a Fully conditional DenseneNet semantic segmentation network, or a U-Net semantic segmentation network in addition to the PSPNet semantic segmentation network.
Described further, a flowchart of a defect detection method based on multi-angle imaging according to another embodiment of the present application is shown in fig. 7.
Referring to the quality inspection flow chart of fig. 7, firstly, a plurality of batches of products to be inspected are respectively placed on a detection platform of the products to be inspected, and initial photographing is carried out by using a hand-eye calibration robot; secondly, judging the class of the current product to be detected by using a classification network based on deep learning, and positioning the actual position coordinate of the current product to be detected by using a positioning network based on target detection; then, a self-adaptive multi-angle imaging system is used for carrying out multi-angle imaging photographing; and finally, performing defect segmentation by using a defect segmentation network based on semantic segmentation. And finally, performing multi-angle self-adaptive defect detection on the surface of the product to be detected.
In the classification Network, the target detection Network and the semantic segmentation Network, a convolutional neural Network is adopted in the embodiment of the application, and a Capsule Network (Capsule Network) and the like can be used in other embodiments.
The target detection network in the embodiment of the present application adopts an RRPN network, and other mainstream target detection networks may also be used in other embodiments, for example: r3Det network, Gliding Vertex network, RSDet network, etc.
The defect segmentation network in the embodiment of the present application adopts a PSPNet semantic segmentation network, and other embodiments may also adopt other mainstream semantic segmentation networks, for example: SegNet, Fully conditional DenseNet and U-Net.
The product of waiting to examine of this application is not limited to a certain product of waiting to examine, equally also is applicable to the multiple product that has three-dimensional structure and need carry out multi-angle formation of image, for example: wood boards, socket bars, packaging boxes and the like.
The defect detection method of the embodiment of the application comprises the following steps: firstly, placing a plurality of batches of products to be detected on a detection table, carrying out primary photographing by using a hand-eye calibration robot, carrying out class identification on the plurality of batches of products to be detected by using a deep learning-based classification network, and determining class information of the current product; then, a plurality of imaging angle parameters under different products to be detected are called, and position coordinate estimation is carried out on the current product to be detected by using a target detection network to determine the actual position coordinate of the current product to be detected; and then, calculating the position value of the hand-eye calibration robot by utilizing a camera calibration algorithm and combining the estimated actual position coordinates of the product to be detected and a plurality of angle parameters of the called different products to be detected. And finally, realizing multi-angle self-adaptive imaging of the surface defects of the product to be detected. And finally, performing defect segmentation prediction on the obtained multi-angle imaging image by using a defect segmentation network based on semantic segmentation.
The beneficial effects of the defect detection method based on multi-angle imaging in the embodiment of the application can be summarized as follows:
1. and a classification network method based on deep learning is used for realizing the classification task of multiple batches of products to be detected.
2. And determining the position coordinates of the product to be detected on the detection table according to the image of the product to be detected by a target detection positioning method.
3. The self-adaptive multi-angle imaging system based on deep learning obtains the category information of a plurality of batches of products to be detected according to a classification network, and then calls a plurality of self-adaptive shooting angles under different categories in multi-angle parameters; and then the actual position coordinates of the product to be detected are obtained according to the target detection network, and finally the hand-eye calibration robot can realize self-adaptive multi-angle shooting imaging.
4. By the defect segmentation method based on semantic segmentation, defect areas are segmented from the shot multi-angle pictures, so that the quality inspection result of the product to be inspected is more accurate.