Disclosure of Invention
The invention aims to solve the technical problem of providing a bar steel bending detection method aiming at the defects in the prior art.
In order to achieve the technical purpose, the invention adopts the following technical scheme:
a bar steel bending detection method comprises the following steps:
Step S1, fixing a high-temperature-resistant network camera above a bar steel material obliquely, and collecting an image of the steel material on a conveyor belt in real time;
S2, inputting the acquired images into a segmentation network based on deep learning, and segmenting images of bars in the images in real time;
s3, performing edge detection on the segmented steel material image by using an edge detection algorithm to extract steel material boundary characteristics and three side edge characteristics;
s4, detecting whether the steel is bent or not based on the three side edge characteristics;
and S5, sending an alarm to the front end when the bending of the steel is detected, and preventing the bent steel from being sent into the heating furnace.
In order to optimize the technical scheme, the specific measures adopted further comprise:
further, in the step S1, the high temperature resistant network camera collects two side surfaces and three side edges of the steel material.
Further, the step S2 specifically includes:
S21, inputting image data into a segmentation network based on deep learning, and judging whether each pixel belongs to steel materials or not;
s22, selecting all pixels judged to belong to the steel material in the image to form a steel material image;
S23, calculating the distance between the two farthest pixels in the steel image, and when the distance is smaller than a certain threshold value, judging that the steel does not completely enter the shooting visual field, and detecting the next image by turning to S21.
Further, the deep learning-based segmentation network in step S21 includes the steps of:
S211, extracting each pixel characteristic of the image by using a multi-layer sensor;
s212, carrying out maximum pooling on a3 multiplied by 3 neighborhood, a5 multiplied by 5 neighborhood and a 7 multiplied by 7 neighborhood which take each pixel as a center to obtain local features of 3 scales of each pixel, and linking the three features to form a multi-scale local feature of each pixel;
s213, extracting high-dimensional features of the multi-scale local features of each pixel by using a multi-layer perceptron, and then maximally pooling the high-dimensional features of all pixels to obtain global features;
S214, extracting weight from the high-dimensional feature of each pixel, linking the multi-scale local feature and the global feature of each pixel, and multiplying the multi-scale local feature and the global feature with the weight to obtain weighted features;
S215, the weighted characteristic of each pixel is reduced to one dimension through the full connection layer, the segmentation probability of each pixel is obtained through calculation by using a sigmoid function, a cross entropy loss function is calculated for training, and whether each pixel belongs to the pixel of steel materials or not is judged.
Further, the step S3 specifically includes:
s31, extracting boundary pixels from the segmented steel material image by using an edge detection algorithm, and constructing a minimum spanning tree by using a kruskal algorithm, wherein the boundary pixels are used as nodes of the tree;
s32, calculating a pixel unit normal vector according to the nearest k neighborhood of each boundary pixel;
S33, selecting one pixel in boundary pixels, and traversing all boundary pixels to obtain all break points when the absolute value of the inner product of the unit normal vector of any pixel in the k neighborhood of the pixel and the unit normal vector of the pixel is smaller than a set threshold value;
And S34, dividing the minimum spanning tree into a plurality of subtrees by all break points, and selecting three subtrees with the most nodes as three side edge features.
Further, step S4 specifically includes:
s41, respectively carrying out straight line detection on three side edge characteristics by using a RANSAC algorithm;
step S42, calculating the distance between all pixel points in the three side edge features and corresponding straight lines, and judging that the boundary line corresponding to the pixel is bent when the pixel with the distance larger than the set threshold exists;
And S43, bending the steel material when any one of the three side edge characteristics is bent.
Further, step S5 is specifically that an alarm is sent to the front end controller when the bending of the steel is detected, the steel conveyor belt is interrupted to transmit, and after the bent steel is taken down, the conveyor belt continues to convey the steel, and the next steel is detected.
The invention has the beneficial effects that:
The invention provides a method and a device for detecting steel bar bending based on an image segmentation algorithm and an image edge detection technology of deep learning. According to the method, an image of conveying steel materials is acquired by a high-temperature-resistant camera, the steel materials are segmented by a deep learning image segmentation algorithm, and the bending degree of the steel materials is detected by extracting boundary characteristics of the steel materials by an edge detection algorithm, so that the problem of steel material bending detection before the steel materials are conveyed into a heating furnace is solved, and subsequent accidents caused by conveying the bent steel materials into the heating furnace are avoided.
Detailed Description
Embodiments of the present invention are described in further detail below with reference to the accompanying drawings.
As shown in fig. 1, the invention provides a bar steel bending detection method, which comprises the following steps:
Step S1, fixing a high-temperature-resistant network camera above a bar steel material obliquely, and collecting an image of the steel material on a conveyor belt in real time;
Because the detection environment is located beside the heating furnace, the environment temperature is higher, in order not to influence the image acquisition effect, the DS-NXCN A204 CMOS star light level high-temperature-resistant air-cooled barrel type network camera is used for acquiring images, when steel materials are bent, at least one surface (two side edges) is bent, so that whether the steel materials are bent or not can be judged by detecting three steel materials from the four side edges, a camera is fixed above a conveying belt of the steel materials of the bar, the two side surfaces (three side edges) of the steel materials can be completely located in the visual field of the camera, after the images are acquired, due to limited wireless transmission speed and higher environment temperature, special high-temperature-resistant cables are required to be used for transmitting image data, and fig. 2 is a schematic diagram of the shooting position of the high-temperature-resistant camera.
S2, inputting the acquired images into a segmentation network based on deep learning, and segmenting images of bars in the images in real time;
Inputting image data into a segmentation network based on deep learning, judging whether each pixel belongs to steel materials, then selecting all pixels judged to belong to the steel materials to form a steel material image, calculating the distance between the two farthest pixels in the steel material image, judging that the steel materials do not enter a shooting visual field completely when the distance is smaller than a certain threshold value, judging that the steel material image shooting is incomplete, and continuously detecting the next image, wherein fig. 3 is a segmentation network structure schematic diagram based on the deep learning;
wherein the deep learning based segmentation network comprises the steps of:
Step (1) extracting each pixel characteristic of an image by using a multi-layer sensor;
Step (2) carrying out maximum pooling on a3×3 neighborhood, a5×5 domain and a 7×7 domain which take each pixel as a center to obtain local features of 3 scales of each pixel, and linking the three features to form a multi-scale local feature of each pixel;
extracting high-dimensional features of multi-scale local features of each pixel by using a multi-layer perceptron, and then maximally pooling the high-dimensional features of all pixels to obtain global features;
Step (4) extracting weight from the high-dimensional feature of each pixel, linking the multi-scale local feature and the global feature of each pixel, and multiplying the multi-scale local feature and the global feature with the weight to obtain weighted features;
and (5) reducing the weighted characteristic of each pixel to one dimension through a full connection layer, obtaining the segmentation probability of each pixel by using a sigmoid function, calculating a cross entropy loss function for training, and judging whether each pixel belongs to the pixel of the steel material.
S3, performing edge detection on the segmented steel material image by using an edge detection algorithm to extract steel material boundary characteristics and three side edge characteristics;
Extracting boundary pixels from the segmented steel material image by using an edge detection algorithm, constructing a minimum spanning tree by using a kruskal algorithm, taking the boundary pixels as nodes of the tree, calculating the unit normal vector of the pixel according to the nearest k neighborhood of each boundary pixel, selecting one pixel in the boundary pixels, taking the pixel as a breakpoint when the inner product absolute value of the unit normal vector of any pixel in the k neighborhood of the pixel and the unit normal vector of the pixel is smaller than a set threshold value, traversing all the boundary pixels to obtain all the breakpoints, dividing the minimum spanning tree into a plurality of subtrees by all the breakpoints, and selecting three subtrees with the most nodes as three side edge features.
S4, detecting whether the steel is bent or not based on the three side edge characteristics;
the method comprises the steps of respectively carrying out straight line detection on three side edge features by using a RANSAC algorithm, calculating the distance between all pixel points in the three side edge features and corresponding straight lines, judging that a boundary line corresponding to a pixel is bent when the pixel with the distance larger than a set threshold exists, and bending steel materials when any one of the three side edge features is bent.
And S5, sending an alarm to the front-end controller when the bending of the steel is detected, interrupting the transmission of the steel conveyor belt, and continuously conveying the steel by the conveyor belt after the bent steel is taken down, so as to detect the next steel.
The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention. It should be noted that modifications and adaptations to the invention without departing from the principles thereof are intended to be within the scope of the invention as set forth in the following claims.