Nonferrous metal rolling quality detection method and system based on machine vision

By calculating the local feature intensity of each pixel point and dynamically adjusting the search range of seed points, the problem that fixed seed points cannot capture local feature changes is solved, and the accuracy of non-ferrous metal calendered image segmentation and quality detection accuracy are improved.

CN118397014BActive Publication Date: 2024-11-05BAOJI SHUANGHUI NEW MATERIAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410870347.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-11-05
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

In the prior art, setting fixed seed points using superpixel segmentation algorithm cannot effectively capture local feature changes at different positions in the non-ferrous metal calendered image, resulting in insufficient segmentation details and affecting the accuracy of quality detection.

Method used

By calculating the local feature intensity of each pixel point, and adaptively adjusting the local feature intensity of all pixel points within the search range of the seed point, dynamically adjusting the search range of the seed point, combining the European-style distance and grayscale value difference to make two Confirm the accuracy of superpixel segmentation.

Benefits of technology

The accuracy and stability of superpixel segmentation are improved, making the quality detection results of non-ferrous metals after rolling are more accurate, and the problems of excessive or under-segmentation are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397014B_ABST
    Figure CN118397014B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a method and system for detecting the quality of rolled nonferrous metals based on machine vision. The method comprises: collecting rolled nonferrous metal images, preprocessing the rolled nonferrous metal images, and obtaining a target image; obtaining the local feature intensity of each pixel point; calculating the search range of the seed point after one adjustment according to the local feature intensity of all pixels within the search range of the seed point; adjusting the search range of each seed point after one adjustment, and obtaining the final search range of each seed point, thereby segmenting the target image to obtain a segmented target image; and performing quality detection on the rolled nonferrous metal according to the segmented target image. The present invention improves the segmentation accuracy of the target image, so that the quality detection result of the rolled nonferrous metal obtained according to the segmented target image is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for detecting the quality of non-ferrous metal rolling based on machine vision. Background Art

[0002] Nonferrous metal rolling is an important metal processing method, which is widely used in manufacturing industries such as aviation, automobiles, and construction. In the process of nonferrous metal rolling, in order to ensure the quality of the product, it is necessary to perform quality inspection on it. When using machine vision technology to perform quality inspection on nonferrous metals after rolling, in order to improve the efficiency of quality inspection of nonferrous metals after rolling, superpixel segmentation of the nonferrous metal images after rolling is usually performed first.

[0003] For example, in the authorization announcement number CN113298809B "Composite material ultrasonic image defect detection method based on deep learning and superpixel segmentation", it is pointed out that the image is segmented by presetting a fixed-size search range of seed points, so that quality detection can be performed based on the segmented image, which greatly reduces the amount of calculation.

[0004] During the rolling process, metal materials are subjected to multiple stresses. Due to the plastic behavior of metals, certain plastic deformation and local displacement will occur after each stress. As the rolling process proceeds, these displacements will gradually accumulate, causing differences in the local features of the rolled nonferrous metals, resulting in different distribution patterns of pixels in different areas of the collected rolled nonferrous metal images. Using a fixed-size search range to perform superpixel segmentation on the rolled nonferrous metal images cannot capture the local feature changes at different locations in the rolled nonferrous metal images, resulting in inaccurate segmentation details, which affects the quality inspection of the rolled nonferrous metals. Summary of the invention

[0005] The purpose of the present invention is to provide a method and system for detecting the quality of non-ferrous metal rolling based on machine vision, so as to solve the problem that the local feature changes at different positions in the non-ferrous metal image after rolling cannot be well captured by setting fixed seed points using a superpixel segmentation algorithm, thus resulting in inaccurate segmentation details.

[0006] In the first aspect, the present invention provides a non-ferrous metal rolling quality detection method based on machine vision, which adopts the following technical solution:

[0007] The non-ferrous metal rolling quality detection method based on machine vision includes the following steps:

[0008] Preprocessing the rolled nonferrous metal image to obtain a target image;

[0009] Calculating the local feature strength of the pixel point based on the grayscale difference between the pixel point in the target image and the pixel points in its neighborhood and the grayscale fluctuation degree, wherein the local feature strength is positively correlated with the grayscale difference and negatively correlated with the grayscale fluctuation degree;

[0010] The search range of the seed point is adjusted once according to the local characteristic intensity of the pixel point;

[0011] Obtain the pixel points that need to be confirmed twice according to the search range after the seed point is adjusted once, and calculate the degree of belonging of the pixel points that need to be confirmed twice according to the Euclidean distance between the pixel points that need to be confirmed twice and the candidate seed point to which they belong, and the gray value difference between the pixel points and all the pixel points within the search range of the candidate seed point, wherein the degree of belonging is negatively correlated with the Euclidean distance and the gray value difference;

[0012] Normalize the degree of belonging to obtain the normalized degree of belonging; adjust the search range of the seed point twice according to the normalized degree of belonging to obtain the final search range of each seed point;

[0013] According to the final search range of each seed point, the target image is segmented, and the quality of the rolled nonferrous metal is inspected according to the segmented target image.

[0014] The present invention calculates the local feature intensity of each pixel point and adaptively adjusts the range of each seed point according to the local feature intensity of all pixel points within the search range of the seed point, so as to make the superpixel segmentation result more accurate, thereby making the system's quality inspection result of the rolled non-ferrous metal more accurate.

[0015] Furthermore, by performing a secondary adjustment on the search range of the seed point, the problem that the search range after the primary adjustment cannot cover the entire image can be avoided. By performing a secondary adjustment on the search range of the seed point, the result of the superpixel segmentation can be made more accurate.

[0016] In one embodiment, the local feature strength satisfies the expression:

[0017] ;

[0018] in, Indicates The local feature intensity of each pixel, Indicates the sequence number of the pixel in the target image; Indicates The serial number of the pixel within the neighborhood of a pixel; Indicates The gray value of each pixel; Indicates The first pixel in the neighborhood of The gray value of each pixel; Indicates A pixel point and its neighborhood The Euclidean distance between pixels; Indicates The mean gray value of all pixels in the neighborhood of a pixel; Represents the normalization function.

[0019] By calculating the grayscale difference between each pixel and the pixels in its neighborhood, the changes and features of the pixels in the local area can be captured. Not only the grayscale value of the pixel, but also the overall changes of the surrounding pixels are taken into account. For areas with obvious texture or boundary, the local feature intensity will be relatively high, making the processing of texture areas and boundary areas in the image more sensitive and accurate.

[0020] In one embodiment, the search range of the seed point after one adjustment satisfies the expression:

[0021] ;

[0022] Take any seed point as the target seed point, where Indicates the side length of the search range after the target seed point is adjusted once; Indicates the side length of the search range before the target seed point is adjusted once; Indicates the total number of pixels within the search range before the target seed point is adjusted once; Indicates the sequence number of the pixel point in the search range before the target seed point is adjusted once; Indicates the number of target seed points in the search range before the target seed point is adjusted. The local feature intensity of each pixel; To preset hyperparameters; represents the ceiling function; represents the hyperbolic tangent function.

[0023] According to the average difference of local feature strength, the search range of seed points is dynamically adjusted. If the local feature changes little, that is, the average difference If is negative, the search range is increased to capture more details; on the contrary, if the local features change greatly, that is, If it is a positive number, the search range is narrowed to ensure the accuracy of superpixel segmentation. By dynamically adjusting the search range, the superpixel segmentation algorithm can be more effective in processing complex images and avoid over-segmentation or under-segmentation problems.

[0024] In one embodiment, the method for obtaining the pixel points that require secondary confirmation is:

[0025] For each seed point, all pixel points within the search range of the seed point after adjustment are obtained according to the position of the seed point and the search range of the seed point after adjustment, and are used as searchable points of the seed point respectively; the union of the searchable points of all seed points is obtained, and the pixel points in the target image that are not in the union are used as pixel points that need to be confirmed again.

[0026] In one embodiment, the method for obtaining the candidate seed point is:

[0027] For any pixel that needs to be reconfirmed, the nearest pixel to the pixel that needs to be reconfirmed seed points as candidate seed points for the pixel point that needs secondary confirmation; The preset number of nearest seed points.

[0028] In one embodiment, the expression of the degree of belonging satisfies:

[0029] ;

[0030] in, Indicates The pixel that needs to be confirmed twice is The degree to which each candidate belongs to the seed point; Indicates The pixel that needs to be confirmed twice The side length of the search range after the seed point to which the candidate belongs is adjusted once; Indicates The gray value of the pixel that needs to be confirmed twice; Indicates The pixel that needs to be confirmed twice The candidate seed point is the first one in the search range after the adjustment The gray value of each pixel; Indicates The pixel that needs to be confirmed twice is The Euclidean distance between the seed points to which the candidates belong; Expressed as a natural constant The exponential function with base ; Represents the absolute value symbol.

[0031] By comprehensively considering the spatial distance between the pixel points that need to be reconfirmed and the candidate seed points as well as the difference in grayscale values, the degree of association between the pixel points that need to be reconfirmed and each of their candidate seed points is effectively evaluated, which improves the accuracy and stability of superpixel segmentation and makes the segmentation results more refined.

[0032] In one embodiment, the final search range of each seed point is obtained by:

[0033] If within the four neighborhoods of any pixel point on the search range boundary after the seed point is adjusted once, there are pixels that need to be confirmed twice, and the normalized degree of belonging to the seed point is greater than or equal to the preset threshold , then the pixel point that needs secondary confirmation is included in the search range of the seed point;

[0034] The search range of the seed point after adjustment is repeatedly updated until the search range of the seed point does not change any more, and the search range of the seed point after the last update is recorded as the final search range of the seed point.

[0035] Through secondary confirmation and normalized degree of belonging, the search range from pixel points to seed points can be divided more accurately, avoiding the problem of incomplete initial segmentation and effectively improving the accuracy and robustness of image segmentation.

[0036] In a second aspect, the present invention provides a non-ferrous metal rolling quality detection system based on machine vision, which adopts the following technical solutions:

[0037] A non-ferrous metal rolling quality detection system based on machine vision includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the non-ferrous metal rolling quality detection method based on machine vision is implemented.

[0038] By adopting the above technical solution, the above-mentioned non-ferrous metal rolling quality detection method based on machine vision is generated into a computer program and stored in a memory to be loaded and executed by a processor, so that a terminal device is made according to the memory and the processor for easy use.

[0039] The present invention has the following technical effects: the present invention adaptively adjusts the search range size of each seed point according to the local feature intensity of different areas in the target image, so that when the target image is segmented according to each seed point, the local features of different areas can be better met. Furthermore, by performing a secondary adjustment on the search range of the seed point, the pixel points that are not within the search range of the seed point can also be included in the search range of the seed point, so that the segmentation result of the target image is more accurate, thereby making the quality detection result of the rolled non-ferrous metal obtained based on the segmented target image more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts.

[0041] Figure 1 It is a flow chart of the method for detecting quality of non-ferrous metal rolling based on machine vision in an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0043] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.

[0044] The embodiment of the present invention discloses a method for detecting the quality of non-ferrous metal rolling based on machine vision, referring to Figure 1 , including steps S001 to S007:

[0045] S001: collecting the rolled nonferrous metal image, and preprocessing the rolled nonferrous metal image to obtain a target image.

[0046] The RGB image of the rolled nonferrous metal is captured by a camera, and the RGB image is converted into a grayscale image for the convenience of subsequent processing.

[0047] It should be noted that, since the rolled non-ferrous metal image contains not only the rolled non-ferrous metal but also the background, the present invention uses a semantic segmentation network to preprocess the grayscale image of the rolled non-ferrous metal to obtain a target image containing only the rolled non-ferrous metal.

[0048] The specific content of the semantic segmentation network is as follows: the input of the semantic segmentation network is the grayscale image of the rolled non-ferrous metal, and the output is the binary image of the rolled non-ferrous metal. The data set of the semantic segmentation network is a data set composed of grayscale images of rolled non-ferrous metals with different backgrounds. The labels are divided into two categories, rolled non-ferrous metals and background. The pixels belonging to the rolled non-ferrous metals are marked as 1, and the pixels belonging to the background are marked as 0. The loss function of the semantic segmentation network is the cross entropy loss.

[0049] The grayscale image of the rolled nonferrous metal is input into the trained semantic segmentation network, and the output result is multiplied by the grayscale image of the rolled nonferrous metal to obtain a target image containing only the rolled nonferrous metal.

[0050] So far, the preprocessing of the grayscale image of the rolled nonferrous metal has been achieved, and the target image has been obtained.

[0051] S002: Calculate the local feature intensity of each pixel in the target image based on the grayscale difference between each pixel and all pixels in its neighborhood.

[0052] It should be noted that the superpixel segmentation algorithm usually divides multiple adjacent pixels with similar features into the same block. However, during the continuous rolling process of non-ferrous metals, the metal materials are subjected to multiple stresses and undergo plastic deformation, which changes the original grain structure and the local features of the non-ferrous metals. The change in local features will cause the texture of the collected target image to change. The pixel distribution patterns in different areas are different, that is, there are different local features in different areas. Different local features will affect the segmentation accuracy of the superpixel segmentation algorithm. Therefore, the present invention calculates the local feature intensity of each pixel based on the difference between each pixel and the pixel in its local window.

[0053] In one embodiment, for each pixel in the target image, the local feature intensity of the pixel is calculated based on the difference between the pixel and all the pixels in its neighborhood:

[0054] ;

[0055] in, Indicates The local feature intensity of each pixel, Indicates the sequence number of the pixel in the target image; Indicates The serial number of the pixel within the neighborhood of a pixel; Indicates The gray value of each pixel; Indicates The first pixel in the neighborhood of The gray value of each pixel; Indicates A pixel point and its neighborhood The Euclidean distance between pixels; Indicates The mean gray value of all pixels in the neighborhood of a pixel; Represents the normalization function.

[0056] Indicates A pixel point and its neighborhood The grayscale difference of each pixel point, the larger its value, the more prominent the pixel point is in its neighborhood, that is, the stronger the local feature intensity of the pixel point is; and The ratio between To weaken the The first pixel in the neighborhood of Pixels and The Euclidean distance between pixels is the grayscale difference between the two The impact of The distance within the neighborhood of the pixel is The pixel further away from the The greater the grayscale difference of each pixel, Indicates The grayscale discreteness of all pixels in the neighborhood of a pixel is smaller, the smaller the value is, the The closer the grayscale values ​​of all pixels in the neighborhood of a pixel are, the closer the grayscale values ​​of all pixels in the neighborhood of a pixel are. The bigger, The smaller it is, the The greater the grayscale difference between a pixel and all the pixels in its neighborhood, and the closer the grayscale values ​​of all the pixels in its neighborhood, the The stronger the local feature strength of each pixel.

[0057] It should be noted that the neighborhood range in the present invention is 24 neighborhoods, and in other embodiments, implementers can set the neighborhood range according to actual implementation conditions.

[0058] Similarly, the local feature intensity of each pixel can be obtained.

[0059] S003: adjusting the search range of each seed point according to the local feature strength of all pixels within the search range of the seed point.

[0060] In one embodiment, for a target image, the number of preset seed points is , and make all seed points evenly distributed in the target image, and then get the distance between any two adjacent seed points , and preset the search range of any seed point to Among them, the present invention is There is no specific limitation, and the implementers can set it according to the actual situation, for example It should be noted that, in the target image, since the seed points are uniformly distributed, the distance between any two adjacent seed points in the image is the same.

[0061] It should be noted that in superpixel segmentation, since the consistency of the internal pixels of the superpixel block obtained by the superpixel segmentation algorithm is strong, and the center of each superpixel block is the seed point, the pixels near it should have high similarity in color, texture, etc. Due to the different stress levels of non-ferrous metals during the rolling process, the metal at the roll gap will be subject to a greater degree of strain, while the metal outside the roll gap will be subject to a smaller strain, which leads to differences in the grain structure of different parts, so different regions have different performance characteristics. Therefore, the use of a fixed search range for each seed point in the superpixel segmentation algorithm may result in too coarse divisions in areas with drastic feature changes, and too fine divisions in areas with gentle feature gradients. Therefore, the present invention dynamically adjusts the search range of each seed point according to the local feature intensity of all pixels within the search range of each seed point, and flexibly adapts to the characteristics of different regions in the target image to improve segmentation accuracy.

[0062] In one embodiment, any seed point in the target image is used as the target seed point.

[0063] Adjust the search range of the target seed point once according to the local feature strength of all pixels within the search range of the target seed point:

[0064] ;

[0065] in, Indicates the side length of the search range after the target seed point is adjusted once; Indicates the side length of the search range before the target seed point is adjusted once; Indicates the total number of pixels within the search range before the target seed point is adjusted once; Indicates the sequence number of the pixel point in the search range before the target seed point is adjusted once; Indicates the first number of target seed points in the search range before adjustment. The local feature intensity of each pixel; To preset hyperparameters; represents the upward rounding function; tanh() represents the hyperbolic tangent function; Used to Mapped in within the scope of Used to Mapped in It should be noted that is a preset hyperparameter used to represent the local feature intensity reference value of the search range of the target seed point. There is no specific limitation, and the implementers can set it according to the actual situation, for example .

[0066] In the formula, Represents the average difference between the local feature intensity of all pixels within the search range of the target seed point and the local feature intensity reference value. If the average difference between the local feature intensity of all pixels within the search range of the target seed point and the local feature intensity reference value is a negative number, it means that the local feature intensity of all pixels within the search range of the target seed point is low at this time, that is, the local feature changes of all pixels within the search range of the target seed point are relatively gentle, that is, there are fewer details in the search range of this pixel point, and a larger search range can be used; conversely, if the average difference between the local feature intensity of all pixels within the search range of the target seed point and the local feature intensity reference value is a positive number, it means that the local feature intensity of all pixels within the search range of the target seed point is high at this time, that is, the local feature changes of all pixels within the search range of the target seed point are relatively drastic, that is, there are more details in the search range of this pixel point, and in order to prevent the division from being too coarse, a smaller search range needs to be used.

[0067] Similarly, the side length of the search range after each seed point is adjusted once can be obtained.

[0068] S004: Obtain the pixel points that need to be confirmed twice, and calculate the degree to which the pixel points that need to be confirmed twice belong to the candidate seed points.

[0069] It should be noted that after the search range of each seed point is adjusted in the above steps, if the search ranges of two adjacent seed points are narrowed, there may be some pixels that are not within the search range of any seed point, that is, when using superpixel segmentation, there will be some pixels that cannot be segmented. Therefore, the present invention refers to the pixels that cannot be segmented as pixels that require secondary confirmation, and obtains the pixels that require secondary confirmation based on the adjusted search range of all seed points.

[0070] In one embodiment, for each seed point, all pixel points within the search range of the seed point after the first adjustment are obtained according to the position of the seed point and the search range of the seed point after the first adjustment, and are respectively used as searchable points of the seed point. The union of the searchable points of all seed points is obtained, and the pixel points in the target image that are not in the union are used as pixel points that need to be confirmed again.

[0071] At this point, all pixels that require secondary confirmation have been obtained.

[0072] It should be noted that, for any pixel point that requires secondary confirmation, the pixel point does not belong to the search range of any seed point, and the pixel point cannot be segmented into any area during superpixel segmentation. Therefore, the present invention analyzes each pixel point that requires secondary confirmation and calculates the degree of belonging of each pixel point that requires secondary confirmation and its adjacent seed points.

[0073] In one embodiment, for any pixel point that needs secondary confirmation, the pixel closest to the pixel point that needs secondary confirmation is seed points as candidate seed points for the pixel point that needs to be confirmed twice. is the number of the nearest seed points preset, the present invention There is no specific limitation, and implementers can set it according to the actual implementation situation, for example .

[0074] Calculate the degree to which each pixel that needs to be confirmed twice belongs to each candidate seed point:

[0075] ;

[0076] in, Indicates The pixel that needs to be confirmed twice is The degree of belonging of the candidate seed point; a represents the sequence number of the pixel point that needs to be confirmed twice; b represents the sequence number of the subsequent seed point to which the pixel point that needs to be confirmed twice belongs; Indicates The pixel that needs to be confirmed twice The side length of the search range after the candidate seed point is adjusted; Indicates The pixel that needs to be confirmed twice The sequence number of the pixel points in the search range after the adjustment of the seed point to which the candidate belongs; Indicates The gray value of the pixel that needs to be confirmed twice; Indicates The pixel that needs to be confirmed twice The first candidate seed point after an adjustment of the search range The gray value of each pixel; Indicates The pixel that needs to be confirmed twice is The Euclidean distance between the seed points to which the candidates belong; Expressed as a natural constant The exponential function with base ; Represents the absolute value symbol.

[0077] Indicates The pixel that needs to be confirmed twice is The gray value difference of all seed points in the search range after the first adjustment of the seed point to which the candidate belongs is greater, indicating that the pixel point that needs to be confirmed twice is closer to the first pixel point. The greater the difference between the seed points in the search range after the first adjustment of the seed point to which the candidate belongs, the greater the difference between the seed points in the search range after the first adjustment, that is, the pixel point that needs to be confirmed twice is The lower the degree of belonging to the seed point to which the candidate belongs; The pixel that needs to be confirmed twice is The Euclidean distance between the seed points to which the candidates belong The larger the value is, the farther the distance between the two is. The lower the degree to which a candidate belongs to the seed point.

[0078] The first The pixel that needs to be confirmed twice is The degree of belonging of the candidate seed point is the same as that of the The ratio of the pixel point that needs to be confirmed twice to the sum of the degrees of all its candidate seed points is taken as the first The pixel that needs to be confirmed twice is The normalized degree of belonging of the seed point to which the candidate belongs.

[0079] Similarly, the normalized degree of belonging of all pixel points that need secondary confirmation to each candidate seed point can be obtained.

[0080] S005: Perform a second adjustment on the search range of the seed point after the first adjustment to obtain a final search range of the seed point.

[0081] It should be noted that, for any pixel point that needs secondary confirmation, the higher the normalized degree of belonging of the pixel point to its candidate seed point, the better the segmentation effect is when the pixel point is divided into the search range after the seed point is adjusted once. Therefore, the present invention makes a secondary adjustment to the search range of each seed point after the primary adjustment according to the normalized degree of belonging of each pixel point that needs secondary confirmation to each candidate seed point.

[0082] In one embodiment, if within the four neighborhoods of any pixel point on the search range boundary after the seed point is adjusted once, there are pixels that need to be confirmed twice whose normalized degree of belonging to the seed point is greater than or equal to a preset threshold , then the pixel point that needs to be confirmed twice is included in the search range of the seed point; where, is a preset threshold value of belonging degree, the present invention There is no specific limitation, and implementers can set it according to the actual implementation situation, for example .

[0083] The search range of the seed point after adjustment is repeatedly updated until the search range of the seed point does not change any more, and the search range of the seed point after the last update is recorded as the final search range of the seed point.

[0084] At this point, the secondary adjustment of the search range of the seed point that needs secondary adjustment of the search range is completed after the primary adjustment, and the secondary adjusted search range of the seed point that needs secondary adjustment of the search range is obtained.

[0085] S006: Segment the target image using superpixels according to the adjusted search range of each seed point.

[0086] In one embodiment, the target image is segmented using superpixel segmentation according to each seed point and the final search range of each seed point to obtain a segmented target image.

[0087] It should be noted that the traditional superpixel segmentation algorithm first presets the number of seed points and the search range of each seed point, and makes all the seed points evenly distributed in the target image, then calculates the similarity measure based on each seed point and all the pixels within its search range, and assigns pixels to each seed point based on the similarity measure between the two, thereby obtaining an area similar to the seed point, which is called a superpixel block, and then calculates the centroid of each superpixel block, and uses the centroid of the superpixel block as the new seed point of the superpixel block, repeats the above steps, continues to assign pixels to the seed point, obtains a new superpixel block, and continuously iterates the above allocation and acquisition of superpixel blocks until the clustering result no longer changes significantly. Compared with the traditional superpixel segmentation algorithm, in the present invention, in each round of iteration of the superpixel segmentation algorithm, the pixel points within its search range are segmented according to the final search range of each seed point, and the segmented target image is obtained by continuously iterating the segmentation.

[0088] At this point, the superpixel segmentation of the target image is achieved, and the segmented target image is obtained.

[0089] S007: Use the segmented target image to build a neural network and perform quality inspection on the rolled nonferrous metals.

[0090] The present invention utilizes a neural network to identify defects of rolled nonferrous metals in a segmented target image.

[0091] The specific contents of the neural network are as follows: the neural network adopts the Yolo network, the input is the segmented target image, and the output is the coordinates of the center point of the bounding box, the width and height of the bounding box, and the defect category corresponding to the bounding box. The data set is a data set composed of images of different rolled non-ferrous metal images segmented by the method of the present invention, and the labels are the bounding boxes corresponding to different defects of the rolled non-ferrous metal in the segmented target, including the coordinates of the center point of the bounding box, the width and height of the bounding box, and the defect category of the rolled non-ferrous metal corresponding to the bounding box, and the defect categories include: scratches, pits, and cracks.

[0092] The segmented target image is input into the trained neural network to obtain the defect category and defect location of the rolled non-ferrous metal.

[0093] Through the above steps, the quality inspection of nonferrous metals after rolling is achieved.

[0094] An embodiment of the present invention also discloses a non-ferrous metal rolling quality detection system based on machine vision, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the non-ferrous metal rolling quality detection method based on machine vision according to the present invention is implemented.

[0095] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.

[0096] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory, a dynamic random access memory, a static random access memory, an enhanced dynamic random access memory, a high bandwidth memory, a hybrid storage cube, etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of the device or accessible or connectable to the device.

[0097] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

[0098] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A non-ferrous metal rolling quality detection method based on machine vision, characterized in that: include: Preprocessing the rolled nonferrous metal image to obtain a target image; Calculate the local feature intensity of the pixel: ; Indicates The local feature intensity of each pixel, Indicates the sequence number of the pixel in the target image; Indicates The serial number of the pixel within the neighborhood of a pixel; Indicates The gray value of each pixel; Indicates The first pixel in the neighborhood of The gray value of each pixel; Indicates A pixel point and its neighborhood The Euclidean distance between pixels; Indicates The mean gray value of all pixels in the neighborhood of a pixel; represents the normalization function; Take any seed point as the target seed point, and adjust the search range of the target seed point according to the local feature strength of all pixels within the search range of the target seed point: ; Indicates the side length of the search range after the target seed point is adjusted once; Indicates the side length of the search range before the target seed point is adjusted once; Indicates the total number of pixels within the search range before the target seed point is adjusted once; Indicates the sequence number of the pixel point in the search range before the target seed point is adjusted once; Indicates the number of target seed points in the search range before the target seed point is adjusted. The local feature intensity of each pixel; To preset hyper parameters; represents the ceiling function; represents the hyperbolic tangent function; Obtain the pixel points that need to be confirmed twice according to the search range after the seed point is adjusted once, and calculate the degree of belonging of the pixel points that need to be confirmed twice according to the Euclidean distance between the pixel points that need to be confirmed twice and the candidate seed point to which they belong, and the gray value difference between the pixel points and all the pixel points within the search range of the candidate seed point, wherein the degree of belonging is negatively correlated with the Euclidean distance and the gray value difference; Normalize the degree of belonging to obtain the normalized degree of belonging; The search range of the seed point is adjusted twice according to the normalized degree to obtain the final search range of each seed point; According to the final search range of each seed point, the target image is segmented, and the quality of the rolled nonferrous metal is inspected according to the segmented target image.

2. The non-ferrous metal rolling quality detection method based on machine vision according to claim 1 is characterized in that: The method for obtaining the pixel points that need secondary confirmation is: For each seed point, all pixel points within the search range of the seed point after adjustment are obtained according to the position of the seed point and the search range of the seed point after adjustment, and are used as searchable points of the seed point respectively; the union of the searchable points of all seed points is obtained, and the pixel points in the target image that are not in the union are used as pixel points that need to be confirmed again.

3. The non-ferrous metal rolling quality detection method based on machine vision according to claim 1 is characterized in that: The method for obtaining the seed point to which the candidate belongs is: For any pixel that needs to be reconfirmed, the nearest pixel to the pixel that needs to be reconfirmed seed points as candidate seed points for the pixel point that needs secondary confirmation; The preset number of nearest seed points.

4. The non-ferrous metal rolling quality detection method based on machine vision according to claim 1 is characterized in that: The expression of the degree of belonging satisfies: ; in, Indicates The pixel that needs to be confirmed twice is The degree to which each candidate belongs to the seed point; Indicates The pixel that needs to be confirmed twice The side length of the search range after the seed point to which the candidate belongs is adjusted once; Indicates The gray value of the pixel that needs to be confirmed twice; Indicates The pixel that needs to be confirmed twice The candidate seed point is the first one in the search range after the adjustment The gray value of each pixel; Indicates The pixel that needs to be confirmed twice is The Euclidean distance between the seed points to which the candidates belong; Indicated by natural constant The exponential function with base ; Represents the absolute value symbol.

5. The non-ferrous metal rolling quality detection method based on machine vision according to claim 1, characterized in that: The method for obtaining the final search range of each seed point includes: If within the four neighborhoods of any pixel point on the search range boundary after the seed point is adjusted once, there are pixels that need to be confirmed twice, and the normalized degree of belonging to the seed point is greater than or equal to the preset threshold , then the pixel point that needs secondary confirmation is included in the search range of the seed point; The search range of the seed point after adjustment is repeatedly updated until the search range of the seed point does not change any more, and the search range of the seed point after the last update is recorded as the final search range of the seed point.

6. The non-ferrous metal rolling quality inspection system based on machine vision is characterized by: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the non-ferrous metal rolling quality detection method based on machine vision according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • A Defect Detection Method for Composite Materials Using Ultrasonic Images Based on Deep Learning and Superpixel Segmentation

    CN113298809B

  • Deep-buried anchorage device sealing detection method based on computer vision

    CN115690106A

  • Method for digitally detecting concrete surface defects

    CN118097310A

  • Machine vision-based machine tool part online inspection method

    WO2023134793A2