Method and device for measuring the size of sheared scrap from rolled bar and wire rod

By segmenting the shearing waste images using the UNet neural network model, the accuracy and robustness issues of shearing waste size measurement for rolled bars and wire rods were resolved, achieving efficient size detection and improved material utilization.

CN116612176BActive Publication Date: 2025-11-21HUAZHONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310649323.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2025-11-21
Estimated Expiration
2043-05-31

AI Technical Summary

Technical Problem

Existing technologies cannot accurately obtain the length and dimensions of the deformed and regular sections of the sheared waste from rolled bars and wires, and traditional visual measurement methods have poor robustness in high-temperature environments and are difficult to adapt to environmental changes.

Method used

The UNet neural network model is used to segment images of sheared waste. Through preprocessing and partitioning of the training dataset, combined with binarized labels and cross-entropy loss function optimization, complete segmented images of sheared waste are obtained. The boundary points are determined by the minimum bounding rectangle and offset, and the sizes of irregular and regular segments are calculated.

Benefits of technology

It achieves accurate and automatic detection of shear waste size under high temperature environment, improves material utilization, and the model has high robustness and high efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116612176B_ABST
    Figure CN116612176B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of automatic detection, and specifically discloses a kind of measurement method and device of rolling bar wire cutting waste size, method includes: obtaining the original image of bar wire cutting waste and pre-processing;The contour of pre-processing image is marked to generate corresponding binary label, and is divided into multiple image-label subgraphs of the same size;Image-label subgraph is divided into training data set and verification data set, and neural network model is trained and verified;The image of sample to be measured is pre-processed and input into the trained neural network model to output multiple segmentation subgraphs;Based on the position information of segmentation subgraph, the complete segmentation image of sample to be measured is obtained after merging segmentation subgraph;The minimum circumscribed rectangle of complete segmentation image is obtained, and the demarcation point of irregular section and regular section on sample to be measured is determined by means of minimum circumscribed rectangle, and the size of irregular section of sample to be measured is obtained based on demarcation point.The present application has higher detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of automatic detection, and more particularly relates to a kind of measurement method and device for the size of sheared waste of rolled bar wire. BACKGROUND

[0002] The short stress rolling mill applied in current production line in China has low degree of automation, and generally the roll gap is finely adjusted by manual, so that only fixed-length shearing can be realized. Under this condition, in view of production safety, the setting of production parameters often leads to a large surplus of the length of sheared waste, so that the utilization rate of raw materials is relatively low. Therefore, the size of sheared waste is a key indicator for realizing the automatic control of rolling mill, and it is necessary to measure it on line.

[0003] At present, the common size measurement of bar and wire mainly focuses on the diameter measurement of products, such as the application of diameter measuring instrument and other equipment, and there is relatively lack of attention to the size and characteristics of sheared waste including length.

[0004] In the process of on-line measurement, the temperature of sheared waste output by production equipment can reach above 800℃, and radiation light in a specific wavelength range can also be generated. The visual measurement means with the aid of filter is better in line with the application requirements under this scene without contacting the measured object. The prerequisite for measuring the size of sheared waste is to separate it from the background image, although the traditional algorithms such as threshold segmentation algorithm and edge detection algorithm can achieve this goal, but the parameters need to be set by human, so it is difficult to adapt to the changes of shooting environment, and the robustness is poor and the deployment is difficult. At the same time, the inherent characteristics of sheared waste make it difficult to measure its size by visual means. On the one hand, the scale of sheared waste in the length direction is much larger than that in the diameter direction, although increasing the object distance and focal length can expand the shooting field of view, but it will also cause the resolution to decrease, so it is difficult to obtain the complete shape image by one image acquisition under the premise of ensuring the resolution. On the other hand, due to the existence of shearing deformation and rolling deformation at both ends of sheared waste, the whole sheared waste can be divided into shearing deformation section, regular section and rolling deformation section along the length direction, and obtaining and reducing the length of regular section is an important breakthrough point to improve the utilization rate of materials; but at the same time, the existence of deformation section makes the irregularity of different sheared waste profiles higher and the shape difference larger, which brings challenges to distinguish and obtain the length of deformation section and regular section. SUMMARY

[0005] In view of the defects of the prior art, the purpose of the present application is to provide a kind of measurement method and device for the size of sheared waste of rolled bar wire, to solve the problem that the existing method cannot accurately obtain the length of deformation section and regular section of sheared waste of rolled bar wire.

[0006] To achieve the above object, the application provides a measuring method for the size of rod and wire cutting waste, which comprises the following steps:

[0007] S1, obtaining an original image of the rod and wire cutting waste and preprocessing to obtain a preprocessed image;

[0008] S2, performing contour labeling on the preprocessed image to generate a corresponding binary label, and dividing the preprocessed image after contour labeling into a plurality of image-label subgraphs with the same size;

[0009] S3, dividing the image-label subgraph into a training data set and a validation data set, training a UNet neural network model using the training data set, and verifying the UNet neural network model after training using the validation data set;

[0010] S4, preprocessing the image of the sample to be measured and dividing it into subgraphs, and then inputting the subgraphs into the UNet neural network model trained in step S3 for segmentation to obtain a plurality of segmented subgraphs;

[0011] S5, based on the position information of the segmented subgraphs in step S4, merging the segmented subgraphs obtained in step S4 to obtain a complete segmented image of the sample to be measured;

[0012] S6, obtaining the minimum bounding rectangle of the complete segmented image, taking the pixel points of the complete segmented image at a first offset distance from both ends of the minimum bounding rectangle as the starting point, traversing a preset number of pixel points in the horizontal coordinate direction to determine the dividing point between the irregular and regular sections on the sample to be measured, and obtaining the size of the irregular section of the sample to be measured based on the dividing point.

[0013] Further, in step S1, the preprocessing of the original image comprises:

[0014] The original image is subjected to size normalization, histogram normalization and down-sampling processing respectively.

[0015] Further, the size normalization processing of the original image comprises: when the size of the original image is greater than a preset size, cropping the edges of the original image until the preset size is met; when the size of the original image is smaller than the preset size, a black mask of the preset size is made, and the original image is filled in the mask.

[0016] Further, in step S3, the UNet neural network model is trained with a binary cross-entropy loss function as the optimization objective and an average intersection over union as an auxiliary observation index.

[0017] Further, in step S6, the preset number of pixel points traversed along the abscissa direction is greater than or equal to 300.

[0018] Further, the first offset is greater than or equal to 10 pixel points.

[0019] Further, in step S6, the specific steps of determining the demarcation point of the irregular shape section and the regular shape section on the sample to be measured include:

[0020] S61, the minimum circumscribed rectangle of the complete segmented image is obtained, a preset number of pixel points are traversed along the abscissa direction of the minimum circumscribed rectangle, when traversing, the perpendicular line of the horizontal median line of the minimum circumscribed rectangle at each pixel point is determined, and the position information of the left and right two pairs of pixel points closest to the perpendicular line on the contour of the complete segmented image is obtained, wherein each pair of pixel points is located on the upper and lower sides of the horizontal median line.

[0021] S62, based on the position information, the vertical distance between any one pair of pixel points is calculated.

[0022] S63, it is judged whether the vertical distance is less than a preset reference diameter: if less, it is determined that the pixel point at the perpendicular line is the demarcation point; if greater than or equal to, the pixel point at the perpendicular line is not the demarcation point.

[0023] Further, after step S63, the following steps are further executed:

[0024] S64, the second offset of the midpoint of the connecting line of any one pair of pixel points relative to the horizontal median line is calculated.

[0025] S65, it is judged whether the second offset is greater than a preset reference offset: if greater, it is judged that the pixel point at the perpendicular line is the demarcation point; if less than or equal to, the pixel point at the perpendicular line is not the demarcation point.

[0026] Further, it is judged whether the number of pixel points determined as the demarcation point exceeds a preset patience value: if exceeding, the first pixel point determined as the demarcation point is taken as the final demarcation point of the normal shape section and the irregular shape section; if not exceeding, the pixel point making the length of the irregular shape section longer among all the demarcation points is selected as the demarcation point.

[0027] Further, after step S6, the diameter of the regular shape section of the sample to be measured is further calculated, and the calculation steps include: selecting the midpoint of the sample to be measured and two pixel points respectively located on the left and right sides of the midpoint and having a third offset distance from the midpoint; calculating the diameter of the sample to be measured at the midpoint and the two pixel points on both sides thereof and averaging to obtain the diameter of the regular shape section of the sample to be measured.

[0028] According to another aspect of the present application, a measuring device capable of realizing the measuring method of the size of the shearing scrap of the rolled bar and wire rod is also disclosed, comprising:

[0029] A three-dimensional motion assembly and an image acquisition module arranged thereon, the image acquisition module being capable of moving up and down, forward and backward, and left and right along the three-dimensional motion assembly;

[0030] A positioning baffle arranged on the three-dimensional motion assembly and located below the image acquisition module, the positioning baffle being used for placing the sample to be measured;

[0031] A pneumatic overturning module arranged below the positioning baffle and capable of rotating and overturning the sample to be measured by the positioning baffle by a certain angle;

[0032] An external data analysis processing module connected with the image acquisition module; the image acquisition module is used for acquiring an original image of the sample to be measured and transmitting the original image to the external data analysis processing module; the external data analysis processing module is used for judging the demarcation point between the regular section and the irregular section of the sample to be measured based on the original image, and further determining the size of the irregular section.

[0033] Compared with the prior art, the above technical scheme conceived by the present application mainly has the following advantages:

[0034] 1. The present application collects a large number of complete original images of the shearing scrap of the rolled bar and wire rod and performs preprocessing. Since the image size after preprocessing cannot be directly used for training the UNet neural network model, the original image after preprocessing is made into an image-label subgraph as a sample data set, which can increase the number of training samples while reducing the size of the training image. Then the sample data set is divided into a training data set and a verification data set, the training data set is input into the UNet neural network model for training, the verification data set is input into the trained UNet neural network model for verification, and then the image of the sample of the shearing scrap of the rolled bar and wire rod to be detected is preprocessed and input into the trained UNet neural network model for image segmentation, so as to obtain the complete image of the sample to be measured and its background after segmentation. Then the minimum circumscribed rectangle of the complete image is obtained, and the length of the irregular section corresponding to the rolling deformation or shearing deformation at both ends of the sample to be measured is determined according to the minimum circumscribed rectangle image and the first offset set in advance, and the result is output online, so as to realize the accurate automatic detection and online output of the size of the sample of the shearing scrap of the rolled bar and wire rod to be detected.

[0035] 2. The application obtains the required training image by comprehensive pretreatment of multiple cases, and trains a high-precision UNet neural network model with the training image, which can be used for repeated and accurate detection of various rod and wire sizes. Specifically, since the size of the merged picture is not uniform, size normalization is required; the gray difference between the measured rod and wire cutting waste and the surrounding environment in the original image is small, which is not conducive to image segmentation, and the features of the bright parts are not necessary to be retained, therefore, global histogram normalization is adopted to improve the contrast between the measured rod and wire and the background; considering that the merged image is quite large along the pixel size, down-sampling is adopted to reduce the image, thereby ensuring the completeness and clarity of the measured rod and wire cutting waste image.

[0036] 3. The application uses binary cross-entropy loss function as the optimization target, and uses average intersection over union as an auxiliary observation index to train the UNet neural network model. As the training proceeds, the loss functions of the training set and the validation set both maintain a downward trend and gradually converge to 0, and the average intersection over union of the validation set maintains an upward trend and gradually converges to 1, indicating that the network has achieved good fitting to the training set; the trained UNet neural network model has high robustness and can accurately obtain the complete image of the segmented measured rod and wire cutting waste and its background, and the whole detection method is simple to operate and has high processing efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0037] Figure 1 is a process flow diagram of a rolling rod and wire cutting waste size measurement method provided by the application;

[0038] Figure 2 is a schematic diagram of an original image collected in embodiment 1 of the application;

[0039] Figure 3 is a schematic diagram of an image after original image correction and merging in embodiment 1 of the application;

[0040] Figure 4 is a schematic diagram of an image after size normalization, histogram normalization and down-sampling processing of the merged image in embodiment 1 of the application;

[0041] Figure 5 is a schematic diagram of the change of training loss function, validation loss function and average intersection over union in the training process of the UNet neural network model in embodiment 1 of the application;

[0042] Figure 6 is a subgraph to be predicted in embodiment 1 of the application;

[0043] Figure 7 is a subgraph prediction result in embodiment 1 of the application;

[0044] Figure 8is the complete image to be predicted before blocking in embodiment 1 of the present application;

[0045] Figure 9 is the complete segmented image after merging in embodiment 1 of the present application;

[0046] Figure 10 is the minimum circumscribed rectangle and the contour diagram of the sample of the rod wire shearing scrap to be measured in embodiment 1 of the present application;

[0047] Figure 11 is a structural diagram of a measuring device for the size of the rolling rod wire shearing scrap provided in embodiment 2 of the present application;

[0048] Figure 12 is a side view structural diagram of a measuring device for the size of the rolling rod wire shearing scrap provided in embodiment 2 of the present application.

[0049] In the figure: 1-base, 2-Z-axis screw rod, 3-power distribution cabinet, 4-X-axis screw rod, 5-Y-axis screw rod, 6-industrial camera, 7-fixed baffle, 8-cylinder, 9-light source, 10-touch screen. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0051] In the description of the present application, it should be understood that the terms "center", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application.

[0052] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.

[0053] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting", "fixing" and the like should be understood broadly, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium, or it can be connected inside two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0054] The embodiment of the present application provides a kind of measurement method of rolling bar wire cutting waste size, measurement method includes the following steps:

[0055] S1 obtains the original image of bar wire cutting waste and pre-processes, obtains pre-processing image;

[0056] Specifically, multiple on-site photos are taken along the length direction of the bar wire cutting waste, the number of photos depends on the length of the bar wire to be measured, all photos need to completely cover the shape of the bar wire to be measured, and there is a certain overlap between adjacent two photos to be measured, the original image is corrected and merged using camera parameter matrix, since the size, pixels and difference with the surrounding environment of the merged picture do not meet the requirements, the pre-processed image with appropriate size needs to be obtained by further pre-processing the merged image;

[0057] S2 contour labeling is carried out on the training image to generate corresponding binary label, the training image and its corresponding binary label are divided into multiple training sub-images with the same size as training data set;

[0058] Specifically, the training image obtained after pre-processing is contour labeled to generate corresponding binary label, wherein the background is black and the detection target is white;Then, the image-label pair is divided into sub-blocks with the same size as sample data for subsequent network model;More specifically, contour labeling can be carried out using Labelme software, and the generated.json file contains the coordinates of the contour points, and the.json file can be used to generate the label image of the instance, wherein the target object is represented by color, and the global threshold value is used to convert it into a black and white binary image;Then, the black and white binary image is divided into multiple training sub-images without overlapping from left to right, and the corresponding binary label image is also processed to obtain sample data set, which can further increase the number of samples in the sample data set while reducing the size of the training image.

[0059] S3 divides the sample data set into training data set and validation data set, trains UNet neural network model using the training data set, and verifies the trained UNet neural network model using the validation set;

[0060] Specifically, the image-label subgraph obtained in step two is divided into a training set and a validation set (i.e., a training data set and a validation data set) at a ratio of 9:1, the UNet neural network model is trained using the training set, the validation set loss function is calculated after the end of each training period, the network training process is monitored, and the model parameters at the lowest validation set loss are saved as the trained neural network model.

[0061] S4The to-be-measured sample is pretreated in the same manner as before, and then input into the UNet neural network model trained in step S3 for segmentation to obtain a plurality of segmentation subgraphs.

[0062] Specifically, after the UNet neural network model is trained, if other rod and wire shearing scrap is measured again, only the pre-processing of the test image except for the contour annotation in steps S1 and S2 is required, and then the pre-processed image of the to-be-measured sample is input into the pre-trained UNet neural network model for segmentation to obtain a plurality of segmentation subgraphs.

[0063] S5Based on the position information of the segmentation subgraph in step S4, the segmentation subgraphs obtained in step S4 are merged to obtain a complete segmentation image of the rod and wire shearing scrap.

[0064] Specifically, the segmentation results (i.e., position information of the segmentation subgraph) of the corresponding sub-blocks in step S4 are spliced to obtain a complete segmentation image of the to-be-measured rod and wire shearing scrap and the background.

[0065] S6The minimum bounding rectangle of the complete segmentation image is obtained, and the pixel points of the complete segmentation image at a first offset distance from both ends of the minimum bounding rectangle are taken as the starting points. A preset number of pixel points are traversed in the horizontal coordinate direction to determine the dividing point between the irregular and regular sections on the rod and wire shearing scrap. Based on the dividing point, the irregular section size of the rod and wire shearing scrap is obtained. In addition, the overall length, average diameter, and length of the irregular section of the to-be-measured rod and wire shearing scrap can also be calculated.

[0066] In the preferred embodiment, the step of pre-processing the original image in step S1 includes size normalization, histogram normalization, and down-sampling processing of the original image. Specifically, the to-be-measured rod and wire shearing scrap has a small gray scale difference with the surrounding environment, which is not conducive to image segmentation, and the features of the bright parts are not necessary to be retained. Therefore, global histogram normalization is used to improve the contrast between the to-be-measured rod and wire shearing scrap and the background. Considering that the pixel size of the merged image is quite large and difficult to use in the UNet neural network model, down-sampling processing is used to reduce the image.

[0067] In a more preferred embodiment, the step of performing size normalization on the original image comprises: when the size of the original image is greater than the preset size, cropping the edge of the original image until the preset size is met; when the size of the original image is less than the preset size, making a black mask of the preset size and filling the original image in it.

[0068] In a preferred embodiment, in step S3, when training the UNet neural network model, a binary cross-entropy loss function is used as the optimization objective, and the UNet neural network model is trained with the average intersection-over-union ratio as an auxiliary observation index.

[0069] Specifically, the binary cross-entropy loss function BCEWithLogitsLoss is used as the optimization objective, and RMSprop is used as the training optimizer. After each training epoch, the validation set loss function is calculated to monitor the network training process, and the average intersection-over-union ratio MIOU between the predicted label and the true label of the validation set subgraph is calculated to assist in displaying the network training effect. The model parameters at the lowest validation set loss are saved.

[0070] In a preferred embodiment, in step S6, the preset number of pixel points traversed along the horizontal coordinate direction is greater than or equal to 300.

[0071] In a more preferred embodiment, the first offset is greater than or equal to 10 pixel points, and the first offset is most preferably 10 pixel points.

[0072] In a preferred embodiment, in step S6, the specific steps of determining the dividing point between the irregular shape section and the regular shape section on the sample to be measured comprise:

[0073] S61 obtains the minimum circumscribed rectangle of the complete segmentation image, traverses a preset number of pixel points along the horizontal coordinate direction of the minimum circumscribed rectangle, and determines the vertical line of the horizontal median line of the minimum circumscribed rectangle at each pixel point during traversal, and obtains the position information of the left and right two pairs of pixel points closest to the vertical line on the contour of the complete segmentation image, wherein each pair of pixel points is located on the upper and lower sides of the horizontal median line.

[0074] S62 calculates the vertical distance between any pair of pixel points based on the position information.

[0075] S63 determines whether the vertical distance is less than a preset reference diameter: if it is less than, the pixel point at the vertical line is determined to be the dividing point; if it is greater than or equal to, the pixel point at the vertical line is not the dividing point.

[0076] In a more preferred embodiment, after step S63, the following steps are further performed:

[0077] S64 calculates a second offset of the midpoint of the connecting line of any pair of pixel points relative to the horizontal median line.

[0078] S65 judges whether the second offset is greater than a preset reference offset: if yes, the pixel point at the vertical line is determined as a demarcation point; if no, the pixel point at the vertical line is not a demarcation point.

[0079] In a more preferred embodiment, it is judged whether the number of the pixel points determined as the demarcation points exceeds a preset patience value: if yes, the first pixel point determined as the demarcation point is taken as the final demarcation point of the normal segment and the irregular segment of the outer shape; if no, the pixel point that makes the irregular segment of the outer shape longer is taken as the demarcation point from all the demarcation points.

[0080] In a preferred embodiment, after step S6, the diameter of the regular segment of the outer shape of the sample to be measured is calculated, and the calculation step comprises: selecting a midpoint of the sample to be measured and two pixel points respectively located on the left and right sides of the midpoint and having a third offset from the midpoint; calculating the diameters of the sample to be measured at the midpoint and the two pixel points on the left and right sides of the midpoint and taking an average value, thereby obtaining the diameter of the regular segment of the outer shape of the sample to be measured; in other more preferred embodiments, more pixel points on the left and right sides of the midpoint can also be obtained, and the diameters of the pixel points are taken to obtain a more accurate diameter of the sample to be measured.

[0081] According to another aspect of the present application, a measuring device capable of realizing the measuring method of the size of the shearing waste of the rolled bar and wire is also disclosed, and the device comprises:

[0082] The three-dimensional motion assembly and the image acquisition module arranged thereon, the image acquisition module can move up and down, forward and backward, and left and right along the three-dimensional motion assembly to obtain a complete image of the object to be measured located thereunder; the three-dimensional motion assembly is composed of a Z-axis lead screw fixed on a base, an X-axis lead screw arranged on the Z-axis lead screw, and a Y-axis lead screw arranged on the X-axis lead screw module; the image acquisition module is installed on the Y-axis lead screw and can move forward and backward along the Y-axis lead screw; the Y-axis lead screw can move left and right on the X-axis lead screw; and the X-axis lead screw can move up and down on the Z-axis lead screw.

[0083] The positioning baffle is arranged on the three-dimensional motion assembly and located below the image acquisition module, and the positioning baffle is used for placing the shearing waste of the bar and wire; specifically, the positioning baffle is arranged in front of the Z-axis lead screw, and the image acquisition module can move above the positioning baffle to obtain an original image of the object to be measured, such as the shearing waste of the bar and wire, placed on the positioning baffle.

[0084] The pneumatic overturning module is arranged below the positioning baffle and can rotate and overturn the shearing waste of the bar and wire by a certain angle with the positioning baffle, so as to cooperate with the image acquisition module to obtain images of the shearing waste of the bar and wire at various angles.

[0085] An external data analysis processing module is connected with the image acquisition module; the image acquisition module is used for acquiring an original image of the rod wire shearing scrap and transmitting the original image to the external data analysis processing module; the external data analysis processing module is used for judging the demarcation point of the regular section and the irregular section of the rod wire shearing scrap based on the original image, and then determining the size of the irregular section.

[0086] In order to better illustrate the implementation details of the present application, the following examples are provided to further illustrate the present application, and it should be clear that the following examples are only as the best implementation mode, and do not limit the protection scope of the present application.

[0087] Example 1

[0088] In combination Figure 1 As shown in the embodiment, a method for measuring the size of the rod wire shearing scrap is provided, including the following steps:

[0089] S1, shooting the original image of the rod wire shearing scrap to be measured and preprocessing

[0090] A plurality of on-site photos are taken along the length direction, and the number of photos depends on the length of the rod wire shearing scrap to be measured. All the photos taken need to completely cover the shape of the rod wire to be measured, and there is a certain overlapping area between the adjacent two photos.

[0091] In this embodiment, four gray scale images of the rod wire shearing scrap to be measured are taken, and the motion parameters of the three-dimensional motion assembly and the camera acquisition parameters are adjusted to obtain four original images, as shown in Figure 2 The original images are corrected and merged by using the camera parameter matrix, and the result is shown in Figure 3 Since the sizes of the merged pictures are not uniform, size normalization is needed. For the images with a size greater than the set size, the edges of the images are cropped to the target size; for the images with a size less than the set size, a black mask with the same size as the set size is made, and the existing image is filled in it.

[0092] In addition, the gray scale difference between the rod wire to be measured and the surrounding environment in the original image is small, which is not conducive to image segmentation, and the features of the parts with bright gray scale are not necessary to be retained, therefore, global histogram normalization is adopted to improve the contrast between the rod wire to be measured and the background.

[0093] Thirdly, considering that the size of the merged image is quite large along the pixel size, down-sampling is adopted to reduce the image. Finally, the preprocessed image result after size normalization, histogram normalization and down-sampling is shown in Figure 4

[0094] S2, making a sample data set

[0095] ​The pre-processed image is contour labeled to generate a corresponding binary label, obtaining an image-label pair, wherein the background is black and the detection target is white; the obtained image-label pair is divided into sub-blocks of the same size as sample data set.

[0096] Specifically, the Labelme software is used for contour labeling, and the generated.json file contains the coordinates of the contour points. The.json file can be used to generate a label image of an instance, wherein the target object is represented by a color. A global threshold value is used to convert it into a black and white binary image, as shown in formula 1:

[0097]

[0098] wherein thresh is set to 0 and maxVal is set to 255, which means that the color pixel points corresponding to the detection target are converted to white, and the remaining pixel points representing the background are converted to black.

[0099] In this embodiment, the image size after downsampling is 1600 pixels x 400 pixels, which is relatively large compared to the UNet network, so it is difficult to train. Therefore, it is divided into 4 equal subgraphs of 400 pixels x 400 pixels without overlapping from left to right. The binary label image corresponding to the image is also processed in the same way. This can reduce the size of the training image while increasing the number of training samples. Considering the excellent performance of UNet in small sample data set processing, the network training can be realized by collecting a small amount of images, and the work efficiency is higher.

[0100] S3 builds and trains a neural network

[0101] The training set and the validation set are divided by using the sample data in step S2, and the specific division ratio is 9:1. The UNet neural network model is trained by using the training set data, the binary cross-entropy loss function is used as the optimization objective, and the average intersection over union is used as the auxiliary observation index. The training set loss function, the validation set loss function and the validation set average intersection over union in the training process are shown in (a)-(c) of FIG. 6, respectively. The results show that with the training, the loss functions of the training set and the validation set remain a downward trend and gradually converge to 0, and the average intersection over union of the validation set remains an upward trend and gradually converges to 1, indicating that the network has a good fitting to the training set. Figure 5

[0102] S4 uses the pre-trained UNet neural network model to segment the sample image to be tested

[0103] ​Specifically, the image of the sample to be measured (i.e., the rod wire shearing scrap to be measured) is preprocessed in S1 and S2 except for contour labeling, i.e., after size normalization, histogram normalization, and downsampling processing, it is input into the UNet neural network model trained in S3 to obtain the target segmentation result of four subgraphs; then the segmentation result is spliced according to the sub-block position in step S4, and after merging, the complete segmentation image of the measured rod wire shearing scrap and the background is obtained as shown in Figure 9 As shown in Figures 6-9 As shown in

[0104] S5 calculates the boundary points of the regular section and the irregular section to determine the size of the sample to be measured

[0105] Based on the complete segmentation image in step S4, the contour and the minimum circumscribed rectangle of the sample to be measured are extracted, and on this basis, the overall length of the sample to be measured is calculated, and according to the set threshold, the length of the irregular section of the rolling deformation or shearing deformation at both ends of the sample to be measured and the diameter of the sample to be measured are output.

[0106] First, the overall length of the sample to be measured is calculated. Based on Figure 9 The contour of the sample to be measured is obtained based on the binary result shown in Figure 10 The length of the long side of the minimum circumscribed rectangle is the overall length of the rod wire shearing scrap, as shown in

[0107] Then, the length of the irregular section of the rod wire shearing scrap to be measured is calculated. By traversing and analyzing the horizontal coordinates x of the pixel points within a certain range at both ends of the rod wire to be measured, the boundary points of the irregular section and the normal section on the sample to be measured are calculated. Since only the two ends of the contour need to be detected, and the pixel points within a small range at both ends may be in a special vertical arrangement form, which may interfere with the actual measurement, it is necessary to specify the number of x to be traversed and the first offset.

[0108] In this embodiment, the number of pixel points on the horizontal coordinate to be traversed is set to 300; the first offset is set to 10 pixel points, i.e., from the position 10 pixel points away from the end point, 300 pixel points corresponding to the x value in the direction of the midpoint of the axis are selected as the points to be traversed subsequently.

[0109] For each x value, a vertical line of the center axis is made through the pixel point on the center axis, four pixel points on the contour profile closest to the vertical line are determined, and the relative positions of the four pixel points are determined, two points located at the upper left and lower left of the vertical line are selected, and the vertical distance between the two points (the upper and lower points) is calculated. The vertical distance is the diameter of the rod material at the horizontal coordinate x, and the offset of the midpoint of the line connecting the upper and lower points relative to the center axis is also calculated.

[0110] The vertical distance and the offset calculated above are verified by two preset reference thresholds (i.e., a reference diameter and a reference offset) to determine whether the pixel points at the corresponding vertical line are the dividing points of the required regular and irregular shape segments. The specific determination method is as follows:

[0111] First, the diameter at the midpoint of the center axis is taken as the reference, and the shape at the midpoint is often very ideal compared to the irregular shape segments at both ends. A first threshold threshold 1 (reference diameter) is reduced by n pixels based on the diameter at the midpoint, and in this embodiment, n is 3. Whether the vertical distance calculated at the corresponding x position (i.e., the suspected dividing point) is less than threshold 1 is determined to determine whether the x position belongs to the irregular shape segment.

[0112] Second, the irregular shape of the sample also exhibits bending, so a second threshold threshold 2 (i.e., a reference offset) is given. Whether the offset of the midpoint of the line connecting the upper and lower points relative to the center axis is greater than threshold 2 is determined to determine whether the x position belongs to the irregular shape segment.

[0113] Specifically, in this embodiment, threshold 1 is set to n pixels, which is 3, and threshold 2 offset is also 3. In particular, considering the characteristics that the diameter of the rod material to be tested often gradually increases from both ends to the middle, and the bending often gradually increases from the middle to both ends, taking the left irregular segment of the rod material scrap sample to be tested as an example: according to threshold 1, the horizontal coordinates x corresponding to the 300 pixel points are traversed in order from left to right; according to threshold 2, the horizontal coordinates x corresponding to the 300 pixel points are traversed in order from right to left; correspondingly, when judging the right irregular segment, the order is reversed: according to threshold 1, the horizontal coordinates x corresponding to the 300 pixel points are traversed in order from right to left; according to threshold 2, the horizontal coordinates x corresponding to the 300 pixel points are traversed in order from left to right. By traversing the x coordinates of the above pixel points, at least one dividing point can be determined.

[0114] Then it is further needed to judge whether the foregoing determined demarcation point meets the requirement by the following way:

[0115] A patience value is set, when the number of x coordinates of the continuous normal segment positions is more than patience, it is considered that the x coordinate corresponding to the first normal position point is the demarcation point between the normal segment and the irregular segment of the profile; in this embodiment, patience is set to 3, finally, in the two demarcation points calculated according to threshold 1 and threshold 2, the x making the irregular segment longer is selected as the final demarcation point; for the same rod wire scrap to be detected, the detection device can be controlled to rotate at different angles for multiple measurements, and the x coordinate making the irregular segment longer is selected as the final demarcation point (one end is a regular segment and the other end is an irregular segment) among the corresponding multiple measurement results.

[0116] The method for calculating the diameter of the sample to be detected is as follows: selecting a midpoint on the axis of the rod wire cutting scrap sample to be detected and two points on the left and right sides of the midpoint and a distance offset from the midpoint, a total of three x coordinates, calculating the average value of the diameters of the rod wire at the three positions, and taking the average value as the average diameter of the regular segment of the rod wire profile, in this embodiment, the offset of the left and right calculation points from the midpoint of the axis (i.e. the third offset) is 100 pixels.

[0117] Embodiment 2

[0118] This embodiment discloses a measuring device for measuring the size of a rolled rod wire cutting scrap, which is combined with the measuring method for measuring the size of a rolled rod wire cutting scrap disclosed in Figure 11 and Figure 12 The device comprises:

[0119] A base 1 is vertically provided with a Z-axis lead screw 2, the top end of the Z-axis lead screw 2 is fixed on one side of a power distribution cabinet 3 for supplying power to the entire measuring device, the other side of the top end of the Z-axis lead screw 2 is provided with an X-axis lead screw 4 which can slide up and down on the Z-axis lead screw 2; the X-axis lead screw 4 is further provided with a Y-axis lead screw 5 which can slide left and right on the X-axis lead screw 4; the X-axis lead screw, the Y-axis lead screw and the Z-axis lead screw form a three-dimensional motion assembly.

[0120] The lower side of the Y-shaft 5 is provided with an industrial camera 6 (i.e. an image acquisition module), which can move up and down, forward and backward, and left and right along the three-dimensional motion assembly; a fixed baffle 7 is arranged on the base 1 directly below the industrial camera 6, and a gas cylinder 8 is arranged on one side of the fixed baffle 7 as a pneumatic overturning module; the gas cylinder 8 can drive the fixed baffle 7 to overturn within a certain angle, so that the sample to be measured on the fixed baffle 7 can be relatively overturned, thereby enabling the industrial camera 6 to take multiple-angle photos of the sample to be measured; the lens of the industrial camera 6 in the embodiment is also provided with a light source 9 directly below, to assist in taking clearer sample images; in addition, the base 1 is also provided with a touch screen 10, which is connected with the industrial camera, the three-dimensional motion assembly and an external computer, and is used for inputting manual instructions and displaying the working parameters of each motion mechanism; the industrial camera 6 is also connected with the external computer (i.e. an external data analysis and processing module), after the industrial camera 6 acquires the original image of the rod wire cutting waste, the original image is transmitted to the external computer, and the external computer is loaded with programs and algorithms corresponding to the detection method in Embodiment 1, which can judge the demarcation point between the regular section and the irregular section of the rod wire cutting waste based on the original image, and further determine the size of the irregular section.

[0121] The above only describes the preferred embodiments of the present application and is not used to limit the present application, and any modification, equivalent replacement and improvement within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for measuring the dimensions of sheared scrap from rolled bar and wire rod, characterized in that, The measurement method includes the following steps: S1 acquires the original image of the bar and wire shearing waste and preprocesses it to obtain a preprocessed image; S2 performs contour annotation on the preprocessed image to generate corresponding binary labels, and divides the preprocessed image after contour annotation into multiple image-label sub-images of the same size; S3 divides the image-label sub-image into a training dataset and a validation dataset, and uses the training dataset to train the UNet neural network model, and uses the validation dataset to validate the trained UNet neural network model; S4 preprocesses the image of the sample to be tested and divides it into sub-images, then inputs it into the UNet neural network model trained in step S3 for segmentation to obtain multiple segmented sub-images. S5 merges the segmented sub-images obtained in step S4 based on the position information of the segmented sub-images in step S4, thereby obtaining a complete segmented image of the sample to be tested; S6 obtains the minimum bounding rectangle of the complete segmented image. Starting from the pixel point of the complete segmented image at the first offset from both ends of the minimum bounding rectangle, a preset number of pixels are traversed along the horizontal axis to determine the boundary point between the irregular and regular segments on the sample to be tested. The size of the irregular segment of the sample to be tested is obtained based on the boundary point.

2. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 1, characterized in that, Step S1, the preprocessing step of the original image includes: The original image is subjected to size normalization, histogram normalization, and downsampling processing, respectively.

3. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 2, characterized in that, The steps for normalizing the size of the original image include: when the size of the original image is larger than a preset size, cropping the edges of the original image until it conforms to the preset size; when the size of the original image is smaller than the preset size, creating a black mask of the preset size and filling the original image therein.

4. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 1, characterized in that, In step S3, the UNet neural network model is trained using the binary cross-entropy loss function as the optimization objective and the average crossover-union ratio as the auxiliary observation index.

5. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 1, characterized in that, In step S6, the preset number of pixels traversed along the horizontal axis is no less than 300.

6. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 1, characterized in that, The first offset is not less than 10 pixels.

7. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 1, characterized in that, Step S6, the specific steps for determining the boundary points between irregular and regular segments on the sample to be tested include: S61 obtains the minimum bounding rectangle of the complete segmented image, traverses a preset number of pixels along the horizontal coordinate direction of the minimum bounding rectangle, and during traversal, determines the perpendicular line of the horizontal central axis of the minimum bounding rectangle at each pixel, and obtains the position information of the two pairs of pixels closest to the perpendicular line on the outline of the complete segmented image, wherein each pair of pixels is located on the upper and lower sides of the horizontal central axis. S62 calculates the vertical distance between any pair of pixels based on the location information; S63 determines whether the longitudinal distance is less than a preset reference diameter: if it is less, then the pixel at the vertical line is determined to be the dividing point; if it is not less, then the pixel at the vertical line is not the dividing point.

8. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 7, characterized in that, After step S63, the following steps are also performed: S64 calculates the second offset of the midpoint of the line connecting any pair of pixels relative to the horizontal central axis; S65 determines whether the second offset is greater than the preset reference offset: if it is greater, then the pixel at the vertical line is determined to be the dividing point; If the value is less than or equal to the value, then the pixel at the vertical line is not the boundary point.

9. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 8, characterized in that, Determine whether the number of pixels identified as the boundary point exceeds a preset tolerance value: if it does, then the first pixel identified as the boundary point is taken as the final boundary point between the normal shape segment and the abnormal shape segment. If the value does not exceed a certain threshold, then the pixel that makes the irregular segment of the shape longer among all the dividing points is selected as the dividing point.

10. The method for measuring the dimensions of sheared scrap from rolled bar and wire as described in claim 1, characterized in that, After step S6, the diameter of the regular segment of the sample to be tested is also calculated. The calculation steps include: selecting the midpoint of the sample to be tested, and two pixels located on the left and right sides of the midpoint and at a distance of the third offset from the midpoint; calculating the diameter of the sample to be tested corresponding to the midpoint and the two pixels on both sides and averaging the values, thereby obtaining the diameter of the regular segment of the sample to be tested.

11. A measuring device capable of implementing the method for measuring the dimensions of sheared scrap from rolled bar and wire as described in any one of claims 1-10, characterized in that, include: A three-dimensional motion component and an image acquisition module disposed thereon, wherein the image acquisition module is capable of moving up and down, forward and backward, and left and right along the three-dimensional motion component; A positioning baffle is disposed on the three-dimensional motion component and located below the image acquisition module, and the positioning baffle is used to place the sample to be tested. A pneumatic flipping module is located below the positioning baffle and can cause the positioning baffle to rotate and flip the sample to be tested by a certain angle. An external data analysis and processing module is connected to the image acquisition module; the image acquisition module is used to acquire the original image of the sample to be tested and transmit the original image to the external data analysis and processing module; the external data analysis and processing module is used to determine the boundary point between the regular and irregular segments of the sample to be tested based on the original image, and then determine the size of the irregular segments.

Citation Information

Patent Citations

  • Stator bar sectional dimension detection system based on machine vision

    CN105865335A

  • Conveyor belt deviation detection method based on UNet network

    CN114655655A