A metal surface quality evaluation method and device based on pattern recognition and a medium
Patent Information
- Application Number
- CN202610931001.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]因此,本发明提供了一种基于模式识别的金属表面质量评估方法解决解决金属表面同一表面位置与合格表面之间难以形成稳定可比的模式表征以及局部异常区域识别结果难以与工艺分区及整面质量状态建立统一对应关系的问题
[0037]本发明有益效果为:通过对全部图像进行辐照校正和刚性配准,建立同批次合格表面模式基准,实现了待测金属工件与同批次合格工件在相同表面位置上的稳定对应,提升了表面状态比较稳定性,通过有效模式断裂区内表面响应模式片段的变化形态判定异常类型,并结合工艺分区、区域质量损失量及整面质量保持度确定质量评估结果,实现了局部异常区域识别结果向整面质量状态的统一传递,增强了整面质量评估完整性。
Smart Images

Figure CN123015369A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision inspection technology for metal surfaces, and in particular to a method, device and medium for metal surface quality assessment based on pattern recognition. Background Technology
[0002] Metal surface quality assessment technology has significant application value in fields such as steel rolling, machining, welding, coating pretreatment, and precision component manufacturing. The assessment results directly affect subsequent assembly accuracy, surface protection effect, and service reliability. In existing technologies, common practices include manual visual inspection, industrial camera acquisition under fixed lighting conditions, image processing based on grayscale and texture features, and comparison with standard samples to identify and determine scratches, corrosion, residues, roughness, unevenness, and local contour anomalies on metal surfaces. These methods are characterized by being non-contact, having high detection efficiency, being easy to integrate online, and having good repeatability. Furthermore, with the development of machine vision and pattern recognition technologies, the automated analysis of surface conditions using image information has become an important technical direction for metal surface inspection and quality control.
[0003] In practical applications, existing technologies still suffer from a lack of stable and comparable characterization methods between the same surface location and qualified surfaces under different lighting responses and local reflection differences. This leads to relatively unstable surface conditions and a lack of a unified characterization path to transfer the identification results of local abnormal areas to the overall surface quality assessment results, resulting in insufficient correlation between the quality assessment basis and the quality assessment results. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a metal surface quality assessment method based on pattern recognition to solve the problems of difficulty in forming stable and comparable pattern representations between the same surface location and qualified surfaces, and difficulty in establishing a unified correspondence between the identification results of local abnormal areas and the overall surface quality status.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides a method for assessing the quality of metal surfaces based on pattern recognition, comprising:
[0008] Acquire co-located surface images of the metal workpiece under different lighting directions, perform the same acquisition on qualified workpieces in the same batch, and perform irradiation correction and rigid registration on the co-located surface images to establish a model benchmark for qualified surfaces in the same batch.
[0009] The metal workpiece under test and the qualified surface pattern reference of the same batch are divided into continuous local partitions. The directional response, texture undulation and spatial transition of each local partition under different lighting directions are used as surface response pattern fragments, and the mode fracture index is calculated.
[0010] The initial fracture partitions are determined based on the fracture index of the model. The initial fracture partitions are then connected and aggregated to obtain the effective model fracture zone. The anomaly type is determined by the change morphology of the surface response model fragments within the effective model fracture zone.
[0011] Based on the process zone where the effective fracture zone is located, the amount of regional quality loss, and the overall surface quality retention, the quality assessment basis and quality assessment results of the metal workpiece to be tested are determined.
[0012] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the steps of acquiring co-located surface images of the metal workpiece under different lighting directions and performing the same acquisition on qualified workpieces in the same batch are as follows:
[0013] A black-and-white industrial camera, a fixed-focus lens, and four low-angle strip light sources distributed circumferentially along the optical axis of the lens are set at the inspection station. The placement posture of the metal workpiece to be tested is defined by a positioning fixture.
[0014] Under the conditions that the imaging distance, exposure time, gain, lens status, and the lighting sequence of the four illumination directions remain consistent, the corresponding surface images under the first illumination direction, the second illumination direction, the third illumination direction, and the fourth illumination direction are acquired sequentially, and corresponding surface images are acquired for qualified workpieces of the same batch under the same conditions.
[0015] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the specific steps for performing irradiation correction and rigid registration on co-located surface images to establish a benchmark for qualified surface patterns in the same batch are as follows:
[0016] Irradiation correction and rigid registration are performed on the surface images of the metal workpiece under test and the qualified workpieces in the same batch. Dark field images and uniform reflection reference images are acquired for each illumination direction. Irradiation correction is based on the dark field images and uniform reflection reference images of each illumination direction. Dark field removal is performed on the surface images of the same location, and proportional correction is performed according to the reference gray level at the same image position.
[0017] Rigid registration uses the intersection of two boundaries on the positioning fixture and the end turning point of the stable contour of the surface under inspection as common registration references to translate and rotate the images of the same surface under each illumination direction.
[0018] After completing irradiation correction and rigid registration of the surface images of all qualified workpieces in the same batch, the median value is taken at each surface position in each illumination direction. The median values corresponding to each surface position under each illumination direction are used to form the reference for the qualified surface pattern in the same batch.
[0019] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the specific steps of dividing the metal workpiece to be tested and the qualified surface pattern reference of the same batch into continuous local partitions are as follows:
[0020] Starting from the surface position corresponding to the upper left corner of the co-located surface image, the area is divided into non-overlapping continuous local partitions in order from left to right and from top to bottom. For the remaining part whose edge is not large enough to be a complete size, the actual coverage of the remaining part is used to form a continuous local partition.
[0021] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the specific steps of taking the directional response, texture undulation, and spatial transition of each local partition under different lighting directions as surface response pattern fragments and calculating the pattern breakage index are as follows:
[0022] Normalized directional responses are extracted from continuous local partitions and the order of each pair of directions is compared to obtain the degree of consistency of directional responses.
[0023] The degree of texture undulation deviation is obtained based on the average grayscale image of the co-located surface image under four lighting directions.
[0024] The degree of spatial transition deviation is obtained based on the normalized directional response difference between the current continuous local partition and the previous continuous local partition under four lighting directions.
[0025] The degree of consistency of directional response, the degree of deviation of texture undulation, and the degree of deviation of spatial transition are used together as surface response mode fragments, and the mode breakage index is calculated.
[0026] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the specific steps of determining the initial fracture partition based on the pattern fracture index and performing connectivity aggregation on the initial fracture partition to obtain the effective pattern fracture region are as follows:
[0027] Arrange the mode fracture indices of all continuous local partitions in ascending order of value, and select the positions between two adjacent mode fracture indices as candidate boundary positions in the arrangement results. For any candidate boundary position, the mode fracture index before the candidate boundary position is regarded as the low fracture part, and the mode fracture index after the candidate boundary position is regarded as the high fracture part. Take the first mode fracture index after the candidate boundary position as the candidate boundary value corresponding to the current candidate boundary position.
[0028] The candidate boundary value corresponding to the candidate boundary position that maximizes the separation between the low-fracture part and the high-fracture part is selected as the mode fracture boundary value. The continuous local partition with a mode fracture index not less than the mode fracture boundary value is determined as the initial fracture partition. The initial fracture partition is then connected and aggregated to obtain the effective mode fracture zone.
[0029] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the specific steps for determining the anomaly type by analyzing the changes in the surface response pattern fragments within the effective pattern fracture zone are as follows:
[0030] Read all surface response pattern fragments within the effective pattern fracture zone and their corresponding directional response consistency, texture undulation deviation, and spatial transition deviation. Extract the extension morphology along the continuous local partition arrangement direction, the concentrated morphology of inconsistent directional order, and the dominant relationship between texture undulation deviation and spatial transition deviation. Then, classify the effective pattern fracture zone into scratch type, welding residue type, corrosion type, insufficient treatment type, or mixed abnormal type.
[0031] As a preferred embodiment of the pattern recognition-based metal surface quality assessment method of the present invention, the specific steps for determining the quality assessment basis and quality assessment result of the metal workpiece under test based on the process zone where the effective pattern fracture zone is located, the regional quality loss, and the overall surface quality retention are as follows:
[0032] The continuous local partitions where the end turning point is located, as well as the continuous local partitions directly adjacent to the left, right, upper and lower sides, are designated as turning process partitions. The continuous local partitions that are in direct contact with the stable contour, as well as the continuous local partitions directly adjacent to the left, right, upper and lower sides that are not part of the turning process partitions, are designated as edge process partitions. The remaining continuous local partitions are designated as main process partitions.
[0033] The effective mode fracture zone is mapped to the process zone, and the regional quality loss is determined according to the coverage ratio and average fracture level of the effective mode fracture zone in the process zone. The overall surface quality retention is determined according to the quality retention part corresponding to all effective mode fracture zones. The process zone, coverage location, anomaly type, coverage ratio, average fracture level, regional quality loss, change morphology results and overall surface quality retention of the effective mode fracture zone are summarized to form the basis for quality assessment of the metal workpiece under test.
[0034] When no valid mode fracture zone exists, the metal workpiece to be tested is determined to be qualified. When a valid mode fracture zone exists, it is determined whether any valid mode fracture zone is located in the transition process zone or the edge process zone and the abnormality type is scratch, any valid mode fracture zone has an abnormality type of welding residue, any valid mode fracture zone has an abnormality type of insufficient treatment, and the largest area quality loss among all valid mode fracture zones is not less than the overall surface quality retention. When any of these situations exist, the metal workpiece to be tested is determined to be reworked. When no of these situations exist but a valid mode fracture zone exists, the metal workpiece to be tested is determined to be re-inspected.
[0035] In a second aspect, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, wherein the computer program, when executed by the processor, implements any step of the pattern recognition-based metal surface quality assessment method as described in the first aspect of the present invention.
[0036] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the pattern recognition-based metal surface quality assessment method as described in the first aspect of the present invention.
[0037] The beneficial effects of this invention are as follows: by performing irradiation correction and rigid registration on all images, a benchmark for qualified surface patterns in the same batch is established, achieving a stable correspondence between the metal workpiece under test and qualified workpieces in the same batch at the same surface position, thus improving the stability of surface condition comparison. The abnormality type is determined by the change morphology of surface response pattern fragments in the effective pattern fracture zone, and the quality assessment result is determined by combining process zoning, regional quality loss, and overall surface quality retention. This realizes the unified transmission of local abnormal area identification results to the overall surface quality status, enhancing the integrity of the overall surface quality assessment. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a flowchart of a pattern recognition-based method for assessing the quality of metal surfaces.
[0040] Figure 2 This is a flowchart for calculating the mode fracture index.
[0041] Figure 3 The flowchart shows the effective mode fracture zone aggregation and anomaly type determination.
[0042] Figure 4 This is a flowchart for quality assessment based on process zoning. Detailed Implementation
[0043] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0044] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0045] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0046] Reference Figures 1-4 This is one embodiment of the present invention, which provides a method for assessing the quality of metal surfaces based on pattern recognition, comprising the following steps:
[0047] S1. Acquire co-position surface images of the metal workpiece under different lighting directions. Perform the same acquisition on qualified workpieces in the same batch, and perform irradiation correction and rigid registration on the co-position surface images to establish a benchmark for qualified surface patterns in the same batch.
[0048] A monochrome industrial camera, a fixed-focus lens, and four low-angle strip light sources distributed circumferentially along the lens optical axis are set up at the inspection station. The four illumination directions remain unchanged throughout the entire batch inspection process. The placement posture of the metal workpiece under test is limited by the positioning fixture, so that the surface position and imaging posture of the metal workpiece under test remain stable during the acquisition process. The imaging distance, exposure time, gain, lens status, and lighting sequence of the four illumination directions of the industrial camera are kept consistent within the same batch.
[0049] When collecting data on the metal workpiece to be tested, the workpiece is placed in a positioning fixture so that the surface to be tested enters the field of view. The strip light source is lit sequentially in the order of the first illumination direction, the second illumination direction, the third illumination direction, and the fourth illumination direction. A surface image is collected during the illumination of each illumination direction to obtain the same-position surface image of the metal workpiece under different illumination directions.
[0050] Co-located surface images refer to surface images acquired under different lighting directions that correspond to the same surface position, the same imaging posture, and the same field of view of the metal workpiece under test, with only the lighting direction changing.
[0051] After the metal workpiece to be tested is collected, from the same batch of workpieces that have undergone the same process and have been confirmed as qualified by manual final inspection, the qualified workpieces of the same batch (e.g., 20 pieces) are selected in the order of entering the testing station, and each piece is placed into the same positioning fixture so that the inspected surface of each batch of qualified workpieces and the inspected surface of the metal workpiece to be tested fall into the same field of view. Under the same imaging distance, exposure time, gain, lens state, lighting direction sequence and field of view as the metal workpiece to be tested, the same surface images under different lighting directions are collected.
[0052] After obtaining the corresponding surface images of the metal workpiece under test and qualified workpieces from the same batch, all images are irradiated. Before formal acquisition, dark field images and uniform reflection reference images are acquired for each illumination direction. After formal acquisition, dark field removal is performed on each position of each corresponding surface image to obtain the corresponding surface image after dark field removal. Then, using the uniform reflection reference image under the corresponding illumination direction as the brightness reference, the reference gray level of the uniform reflection reference image at the same image position under the corresponding illumination direction is read for each position in the corresponding surface image after dark field removal and proportional correction is performed. When any position is brighter in the uniform reflection reference image, it indicates that the current position is under strong light, so the gray level response of the formally acquired image at the current position is correspondingly lowered. When any position is darker in the uniform reflection reference image, it indicates that the current position is under weak light, so the gray level response of the formally acquired image at the current position is correspondingly raised. After proportional correction is performed point by point according to position, the corresponding surface images under different illumination directions are unified to the same brightness reference basis.
[0053] Dark field images refer to background images captured by an industrial camera when the camera parameters are consistent with the actual acquisition, the bar light source corresponding to the illumination direction is turned off, there are no obstructions in front of the lens, and no metal workpiece to be tested is placed at the inspection station.
[0054] A uniform reflection reference image refers to a reference image acquired by an industrial camera when the camera parameters are consistent with the actual acquisition, the strip light source corresponding to the illumination direction is lit, and a standard diffuse reflection plate with uniform surface reflection and no texture undulation is placed on the positioning fixture.
[0055] Dark field removal refers to using the difference between the gray value of the current position in the co-located surface image and the gray value of the dark field image at the same position under the corresponding lighting direction as the co-located surface image after dark field removal.
[0056] After completing the irradiation correction, all images are rigidly registered. The two boundary intersections on the positioning fixture and the end turning point of the stable contour of the inspected surface are used as common registration references. Without changing the image scale, the images of the same surface acquired under the four illumination directions are adjusted by translation and rotation to make them correspond one-to-one at the same surface position. The same processing is performed on the images of the same surface of qualified workpieces in the same batch.
[0057] After completing the irradiation correction and rigid registration of the surface images of all qualified workpieces in the same batch, the correction results of 20 qualified workpieces in the same batch were read one by one according to the same lighting direction and the same surface position. The median value was taken at each surface position under each lighting direction. The median values corresponding to each surface position under each lighting direction were used to form the reference for the qualified surface pattern of the same batch.
[0058] S2. Divide the metal workpiece to be tested and the qualified surface pattern reference of the same batch into continuous local partitions. Take the directional response, texture undulation and spatial transition of each local partition under different lighting directions as surface response pattern fragments, and calculate the pattern fracture index.
[0059] Starting from the top left corner of the corresponding surface image, the metal workpiece under test and the qualified surface pattern reference of the same batch are synchronously divided into continuous local partitions in the order from left to right and from top to bottom. The continuous local partitions in the internal area cover a fixed number of pixels (e.g., 32 rows of pixels and 32 columns of pixels). Adjacent continuous local partitions do not overlap. For the remaining part whose edge is not complete in size, the actual coverage of the remaining part is used to form a continuous local partition of the edge. The continuous local partitions of the edge are formed in the metal workpiece under test and the qualified surface pattern reference of the same batch according to the same edge position and the same coverage.
[0060] After completing the continuous local partitioning, the directional response is extracted for each continuous local partition. The total grayscale response of the current continuous local partition under the first, second, third, and fourth illumination directions is summed to obtain the total grayscale response for each of the four illumination directions. The ratio of the total grayscale response for any illumination direction to the sum of the total grayscale responses of the current continuous local partition under the four illumination directions is used as the normalized directional response for the current illumination direction. The same processing is performed on continuous local partitions at the same surface position in the same batch of qualified surface model references to obtain the corresponding normalized directional responses. The normalized directional responses of the metal workpiece under test and the qualified surface model references in the same batch under the four illumination directions are compared pairwise in the following order: For comparisons between the first and second lighting directions, the first and third lighting directions, the first and fourth lighting directions, the second and third lighting directions, the second and fourth lighting directions, and the third and fourth lighting directions, if the normalized directional responses of the corresponding two directions in any one comparison show that the former direction is greater than the latter direction, the former direction is less than the latter direction, or the former direction and the latter direction are equal, it is considered that the directional order is consistent. If the normalized directional responses of the tested metal workpiece and the qualified surface pattern reference of the same batch show that one direction is greater than the latter direction and the other direction is less than the latter direction, it is considered that the directional order is inconsistent. The proportion of the number of groups with consistent directional order to the total of the six comparison results is used as the degree of consistency of the directional response of the current continuous local partition.
[0061] After the directional response extraction is completed, texture undulations are extracted for the same continuous local partition. First, the corresponding surface images of the current continuous local partition under the four illumination directions are averaged point by point to obtain the average grayscale image of the current continuous local partition. The same processing is performed on continuous local partitions at the same surface position in the same batch of qualified surface pattern references to obtain the corresponding reference average grayscale images. In the average grayscale image, the absolute value of the grayscale difference between each position and its right adjacent position, as well as the absolute value of the grayscale difference between the current position and its lower adjacent position, are read. The average of all the absolute values of grayscale differences is then taken to obtain the current continuous local partition. The strength of texture undulation in a local partition is determined by performing the same processing on the corresponding continuous local partitions of the qualified surface pattern reference in the same batch to obtain the strength of the reference texture undulation. The absolute value of the difference between the strength of the current continuous local partition and the strength of the reference texture undulation is used as the ratio of the strength of the current continuous local partition and the sum of the strength of the reference texture undulation to determine the degree of texture undulation deviation of the current continuous local partition. For the position in the rightmost column of the current continuous local partition, it is not included in the calculation of the grayscale difference between the adjacent positions to the right. For the position in the bottommost column of the current continuous local partition, it is not included in the calculation of the grayscale difference between the adjacent positions below.
[0062] After texture undulation extraction is completed, spatial transitions are extracted for the same continuous local partition. All continuous local partitions are numbered sequentially from left to right and top to bottom. Prioritizing the directly adjacent continuous local partition to the left of the current continuous local partition, the preceding continuous local partition is determined. If the current continuous local partition has no directly adjacent continuous local partition to the left, the directly adjacent continuous local partition to the top is determined as the preceding continuous local partition. If the current continuous local partition has neither directly adjacent continuous local partitions to the left nor to the top, the preceding continuous local partition is still the current continuous local partition itself. The current continuous local partition and the preceding continuous local partition of the metal workpiece under test are read separately. The normalized directional response difference of the area under four illumination directions is calculated, and the normalized directional response difference of two consecutive local areas corresponding to the qualified surface pattern reference of the same batch under four illumination directions is read. According to the illumination direction, the absolute value of the difference between the normalized directional response difference between the current consecutive local area and the previous consecutive local area of the test metal workpiece and the normalized directional response difference between the two consecutive local areas corresponding to the qualified surface pattern reference of the same batch is taken. The sum of the absolute values under four illumination directions is taken as the total variation difference. The sum of the absolute values of all normalized directional response differences of the test metal workpiece and the qualified surface pattern reference of the same batch under four illumination directions is taken as the total variation reference. The ratio of the total variation difference to the total variation reference is taken as the degree of spatial transition deviation of the current consecutive local area.
[0063] Left-side direct adjacency refers to consecutive local partitions that share a common boundary with the current consecutive local partition on the left.
[0064] "Directly adjacent on the upper side" refers to a continuous local partition that shares a common boundary with the current continuous local partition on the upper side.
[0065] The degree of directional response consistency, the degree of texture undulation deviation, and the degree of spatial transition deviation are collectively used as the surface response mode fragment of the current continuous local partition. A mode breakage index is calculated for each continuous local partition, expressed as: ;
[0066] in, Indicates the first Pattern fracture index of a continuous local partition. Indicates the first The degree of consistency in directional response among consecutive local partitions Indicates the first The degree of texture undulation deviation in a continuous local partition Indicates the first The degree of spatial transition deviation of a continuous local partition Indicates the sequential number of consecutive local partitions.
[0067] After the mode fracture index of all continuous local partitions is calculated, the corresponding surface response mode fragments and mode fracture indices are saved in the original order of the continuous local partitions.
[0068] S3. Determine the initial fracture partition based on the mode fracture index, connect and aggregate the initial fracture partition to obtain the effective mode fracture region, and determine the anomaly type by the change morphology of the surface response mode fragments within the effective mode fracture region.
[0069] Read the model fracture indices of all continuous local partitions in the original order from left to right and top to bottom. Rearrange all model fracture indices in ascending order of value. Select the positions between two adjacent model fracture indices as candidate boundary positions. For any candidate boundary position, define the model fracture indices before the boundary position as the low-fracture portion and the model fracture indices after the boundary position as the high-fracture portion. Calculate the arithmetic mean of the model fracture indices for both the low-fracture and high-fracture portions as the average fracture level for the corresponding portion. Calculate the relationship between each model fracture index and its corresponding average value in both the low-fracture and high-fracture portions. The absolute value of the difference in fracture levels is averaged to represent the dispersion of the corresponding part. The ratio of the absolute value of the average fracture level difference between the low and high fracture parts to the sum of the dispersion of the low and high fracture parts is used as the separation degree corresponding to the candidate boundary position. When the sum of the dispersion of the low and high fracture parts is zero, the absolute value of the average fracture level difference between the low and high fracture parts is used as the separation degree corresponding to the candidate boundary position. For each candidate boundary position, the first mode fracture index after the current candidate boundary position is taken as the candidate boundary value corresponding to the current candidate boundary position.
[0070] After processing all candidate boundary positions, the candidate boundary position that maximizes the separation between the low-fracture portion and the high-fracture portion is selected as the model fracture boundary position. When two or more candidate boundary positions correspond to the same degree of separation, the candidate boundary position with the smallest candidate boundary value is selected as the model fracture boundary position. The candidate boundary value corresponding to the model fracture boundary position is determined as the model fracture boundary value. The model fracture index of each continuous local partition is compared with the model fracture boundary value. When the model fracture index of the current continuous local partition is not less than the model fracture boundary value, the current continuous local partition is determined as the initial fracture partition. When the model fracture index of the current continuous local partition is less than the model fracture boundary value, the current continuous local partition is not determined as the initial fracture partition. When the model fracture indices of all continuous local partitions are the same, or when the difference between the average fracture level of the low-fracture portion and the average fracture level of the high-fracture portion corresponding to all candidate boundary positions is zero, the initial fracture partition is not determined.
[0071] After the initial fracture partitions are determined, connectivity aggregation is performed on them. All continuous local partitions are scanned one by one in the order of left to right and top to bottom. When any initial fracture partition is scanned and has not yet been included in any aggregation result, the current initial fracture partition is used as the starting position. The initial fracture partitions directly adjacent to the current initial fracture partition on the left, right, top, bottom and four diagonal positions are read and included in the same aggregation result as the starting position. The same process is repeated for the newly included initial fracture partitions until no new directly adjacent initial fracture partitions are found. The aggregation result is determined as a valid pattern fracture region. The scanning of subsequent initial fracture partitions that have not yet been included in any aggregation result is continued, and new valid pattern fracture regions are formed by the same process.
[0072] After all effective mode fracture zones are formed, the anomaly type is determined by the change morphology of surface response mode fragments within the effective mode fracture zone. For each effective mode fracture zone, according to the continuous local partition position covered by the effective mode fracture zone, all surface response mode fragments within the current effective mode fracture zone are read, and the corresponding directional response consistency, texture undulation deviation, and spatial transition deviation are read simultaneously. Change morphology information is extracted from the current effective mode fracture zone. The change morphology information includes the extension morphology along the continuous local partition arrangement direction, the concentrated morphology with inconsistent directional order, and the dominant relationship between the texture undulation deviation and the spatial transition deviation.
[0073] The extension pattern along the direction of continuous local partitions refers to the number of consecutive rows and columns occupied by the continuous local partitions covered by the current effective model fault zone in the row direction and column direction, respectively. When the larger of the number of consecutive rows and consecutive columns is twice or more than the smaller of the two, the current effective model fault zone is determined to have a slender extension pattern; otherwise, the current effective model fault zone has a blocky expansion pattern.
[0074] The concentrated pattern of inconsistent directional order refers to the number of consecutive local partitions with inconsistent directional order in six sets of directional comparisons within the current effective mode fault zone. These comparisons are performed between the first and second lighting directions, the first and third lighting directions, the first and fourth lighting directions, the second and third lighting directions, the second and fourth lighting directions, and the third and fourth lighting directions. If the number of consecutive local partitions with inconsistent directional order in any one set of comparisons is not less than half the total number of consecutive local partitions within the current effective mode fault zone, then the current effective mode fault zone is determined to have a concentrated pattern of inconsistent directional order. Otherwise, the current effective mode fault zone has a dispersed pattern of inconsistent directional order.
[0075] The dominant relationship between texture undulation deviation and spatial transition deviation refers to calculating the average results of texture undulation deviation and spatial transition deviation for all continuous local partitions within the fracture zone of the current effective mode. When the average result of texture undulation deviation is not lower than the average result of spatial transition deviation, texture undulation deviation is determined to be dominant. When the average result of spatial transition deviation is higher than the average result of texture undulation deviation, spatial transition deviation is determined to be dominant.
[0076] When the fracture zone of the effective pattern is elongated and extended, has an inconsistent and concentrated shape, and the degree of texture undulation deviation is dominant, the fracture zone of the current effective pattern is classified as a scratch.
[0077] When the effective mode fracture zone is elongated and extended, exhibits an inconsistent and concentrated directional order, and is dominated by spatial transition deviation, the current effective mode fracture zone is classified as welding residue.
[0078] When the fracture zone of the effective mode is in a blocky unfolding form, or in a dispersed form with inconsistent directional order, and the texture undulation deviation of adjacent continuous local partitions within the current effective mode fracture zone includes both continuous local partitions with texture undulation deviation higher than the average result of texture undulation deviation of the current effective mode fracture zone and continuous local partitions with texture undulation deviation lower than the average result of texture undulation deviation of the current effective mode fracture zone, and at least once in the original order of the continuous local partitions changes from higher than the average result of texture undulation deviation to lower than the average result of texture undulation deviation, or changes from lower than the average result of texture undulation deviation to higher than the average result of texture undulation deviation, the fracture zone of the current effective mode is determined to be corrosion type.
[0079] When the effective mode fracture region exhibits a blocky unfolding shape, a concentrated shape with inconsistent directional order, and the average result of the consistency of directional response within the current effective mode fracture region remains high while the degree of texture fluctuation deviation is dominant, the current effective mode fracture region is classified as insufficiently processed.
[0080] The average result of the directional response consistency remains high, which means that the number of continuous local partitions in the fault zone of the current effective model that maintain at least five sets of directional order consistency in the six sets of directional comparisons is not less than half of the total number of continuous local partitions in the fault zone of the current effective model.
[0081] If none of the conditions are met, the fracture zone of the current valid mode is classified as a mixed anomaly.
[0082] S4. Based on the process zone where the effective fracture zone is located, the amount of regional quality loss, and the overall surface quality retention, determine the quality assessment basis and quality assessment results of the metal workpiece to be tested.
[0083] Read the end transition points of the stable profile of the inspected surface. The continuous local partitions where the end transition points are located, and the continuous local partitions directly adjacent to the end transition points on the left, right, top, and bottom sides, are designated as transition process partitions. The continuous local partitions directly in contact with the stable profile, and the continuous local partitions directly in contact with the stable profile on the left, right, top, and bottom sides that are not part of the transition process partitions, are designated as edge process partitions. The remaining continuous local partitions are designated as main process partitions. Each effective mode fracture zone is mapped to a process partition. When any effective mode fracture zone simultaneously covers two or more process partitions, it is divided into multiple effective mode fracture zones according to the process partition to which the continuous local partitions within the effective mode fracture zone belong. Each divided effective mode fracture zone retains the anomaly type and change morphology results corresponding to the original effective mode fracture zone.
[0084] The continuous local partition where the end turning point is located refers to the continuous local partition that includes the surface position of the end turning point.
[0085] A continuous local partition that is in direct contact with a stable profile refers to a continuous local partition that includes the surface location of the stable profile.
[0086] After determining the process zone where the effective mode fracture zone is located, the regional mass loss of each effective mode fracture zone is calculated. The number of continuous local zones contained in the current effective mode fracture zone and the total number of continuous local zones contained in the process zone where the current effective mode fracture zone is located are counted. The ratio of the number of continuous local zones contained in the current effective mode fracture zone to the total number of continuous local zones contained in the process zone where the current effective mode fracture zone is located is taken as the coverage ratio of the current effective mode fracture zone in the process zone. The arithmetic mean of the mode fracture index of all continuous local zones in the current effective mode fracture zone is taken as the average fracture level of the current effective mode fracture zone. The square root of the product of the coverage ratio and the average fracture level is taken as the regional mass loss of the current effective mode fracture zone.
[0087] After determining the regional mass loss of all effective mode fracture zones, the overall surface mass retention of the metal workpiece to be tested is determined. The mass loss of all regions is read sequentially according to the original order of the effective mode fracture zones. The complementary value with the current region mass loss is taken as the mass retention part corresponding to the current effective mode fracture zone. The mass retention parts corresponding to all effective mode fracture zones are multiplied one by one in the original order to obtain the overall surface mass retention. When there is no effective mode fracture zone, the overall surface mass retention is recorded as the complete retention state.
[0088] After obtaining the regional quality loss and overall surface quality retention, the quality assessment basis for the metal workpiece under test is generated. According to the original order of the effective mode fracture zones, the process zone, coverage location, anomaly type, coverage ratio, average fracture level, regional quality loss, and change morphology of the current effective mode fracture zone are recorded for each effective mode fracture zone. The process zone, coverage location, anomaly type, coverage ratio, average fracture level, regional quality loss, and change morphology of all effective mode fracture zones are summarized together with the overall surface quality retention to form the quality assessment basis for the metal workpiece under test.
[0089] The quality assessment criteria are used to describe the surface location of the abnormality in the metal workpiece under test, the process zone in which the abnormality is located, the type of abnormality, the magnitude of the quality loss in the affected area, and how much of the overall surface quality is still retained.
[0090] When no valid mode fracture zone exists, the metal workpiece to be tested is determined to be qualified. When a valid mode fracture zone exists, it is determined whether any valid mode fracture zone is located in the transition process zone or the edge process zone and the abnormality type is scratch, any valid mode fracture zone has an abnormality type of welding residue, any valid mode fracture zone has an abnormality type of insufficient treatment, and the largest area quality loss among all valid mode fracture zones is not less than the overall surface quality retention. When any of these situations exist, the metal workpiece to be tested is determined to be reworked. When no of these situations exist but a valid mode fracture zone exists, the metal workpiece to be tested is determined to be re-inspected.
[0091] Scratches, welding residues, and insufficient treatment located in transition or edge process zones, as well as anomalies where the regional quality loss is no less than the overall surface quality retention, are all treated as the dominant anomalies that directly affect the quality status of the metal workpiece under test.
[0092] Once the quality assessment results are determined, the quality assessment basis and the quality assessment results will be output together as the final quality assessment result of the metal workpiece to be tested. The quality assessment result includes qualified, rework, or re-inspection.
[0093] This embodiment also provides a computer device applicable to the pattern recognition-based metal surface quality assessment method, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the pattern recognition-based metal surface quality assessment method proposed in the above embodiment.
[0094] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0095] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the pattern recognition-based metal surface quality assessment method proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0096] In summary, this invention achieves stable correspondence between the tested metal workpiece and qualified workpieces in the same batch at the same surface position by performing irradiation correction and rigid registration on all images, thus improving the stability of surface condition comparison. It determines the anomaly type by the change morphology of surface response pattern fragments within the effective pattern fracture zone, and determines the quality assessment result by combining process zoning, regional quality loss, and overall surface quality retention. This enables the unified transmission of local anomaly area identification results to the overall surface quality status, enhancing the completeness of the overall surface quality assessment.
[0097] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for assessing the quality of metal surfaces based on pattern recognition, characterized in that, include: Acquire co-position surface images of the metal workpiece under different lighting directions, perform the same acquisition on qualified workpieces in the same batch, and perform irradiation correction and rigid registration on the co-position surface images to establish a model benchmark for qualified surfaces in the same batch. The metal workpiece under test and the qualified surface pattern reference of the same batch are divided into continuous local partitions. The directional response, texture undulation and spatial transition of each local partition under different lighting directions are used as surface response pattern fragments, and the pattern fracture index is calculated. The initial fracture partition is determined based on the fracture index of the model. The initial fracture partition is then connected and aggregated to obtain the effective model fracture region. The anomaly type is determined by the change morphology of the surface response model fragments within the effective model fracture region. Based on the process zone where the effective fracture zone is located, the amount of regional quality loss, and the overall surface quality retention, the quality assessment basis and quality assessment results of the metal workpiece to be tested are determined.
2. The metal surface quality assessment method based on pattern recognition as described in claim 1, characterized in that, The process involves acquiring in-situ surface images of the metal workpiece under different lighting directions, and performing the same acquisition process on qualified workpieces from the same batch. The specific steps are as follows: A black and white industrial camera, a fixed-focus lens, and four low-angle strip light sources distributed circumferentially along the optical axis of the lens are set at the inspection station. The placement posture of the metal workpiece to be tested is defined by a positioning fixture. Under the conditions that the imaging distance, exposure time, gain, lens status, and the lighting sequence of the four illumination directions remain consistent, the corresponding surface images under the first illumination direction, the second illumination direction, the third illumination direction, and the fourth illumination direction are acquired sequentially, and corresponding surface images are acquired for qualified workpieces of the same batch under the same conditions.
3. The metal surface quality assessment method based on pattern recognition as described in claim 2, characterized in that, The specific steps for performing irradiation correction and rigid registration on co-located surface images to establish a benchmark for qualified surface patterns in the same batch are as follows: Irradiation correction and rigid registration are performed on the surface images of the metal workpiece under test and the qualified workpieces in the same batch. Dark field images and uniform reflection reference images are acquired for each illumination direction. Irradiation correction is based on the dark field images and uniform reflection reference images of each illumination direction. Dark field removal is performed on the surface images of the same location, and proportional correction is performed according to the reference gray level at the same image position. Rigid registration uses the intersection of two boundaries on the positioning fixture and the end turning point of the stable contour of the surface under inspection as common registration references to translate and rotate the images of the same surface under each illumination direction. After completing irradiation correction and rigid registration of the surface images of all qualified workpieces in the same batch, the median value is taken at each surface position in each illumination direction. The median values corresponding to each surface position under each illumination direction are used to form the reference for the qualified surface pattern in the same batch.
4. The pattern recognition-based metal surface quality assessment method as described in claim 1 or 3, characterized in that, The specific steps for dividing the metal workpiece to be tested and the qualified surface pattern reference of the same batch into continuous local partitions are as follows: Starting from the surface position corresponding to the upper left corner of the co-located surface image, the area is divided into non-overlapping continuous local partitions in order from left to right and from top to bottom. For the remaining part whose edge is not large enough to be a complete size, the actual coverage of the remaining part is used to form a continuous local partition.
5. The metal surface quality assessment method based on pattern recognition as described in claim 4, characterized in that, The specific steps for using the directional response, texture undulation, and spatial transition of each local partition under different lighting directions as surface response mode fragments and calculating the mode breakage index are as follows: Normalized directional responses are extracted from continuous local partitions and the pairwise directional order is compared to obtain the degree of consistency of directional responses. The degree of texture undulation deviation is obtained based on the average grayscale image of the co-located surface image under four lighting directions. Based on the normalized directional response difference between the current continuous local partition and the previous continuous local partition under four lighting directions, the degree of spatial transition deviation is obtained. The degree of consistency of directional response, the degree of deviation of texture undulation, and the degree of deviation of spatial transition are used together as surface response mode fragments, and the mode breakage index is calculated.
6. The pattern recognition-based metal surface quality assessment method as described in claim 1 or 5, characterized in that, The steps for determining the initial fracture partition based on the mode fracture index and then performing connectivity aggregation on the initial fracture partition to obtain the effective mode fracture region are as follows: Arrange the mode fracture indices of all continuous local partitions in ascending order of value, and select the positions between two adjacent mode fracture indices as candidate boundary positions in the arrangement results. For any candidate boundary position, the mode fracture index before the candidate boundary position is regarded as the low fracture part, and the mode fracture index after the candidate boundary position is regarded as the high fracture part. Take the first mode fracture index after the candidate boundary position as the candidate boundary value corresponding to the current candidate boundary position. The candidate boundary value corresponding to the candidate boundary position that maximizes the separation between the low-fracture part and the high-fracture part is selected as the mode fracture boundary value. The continuous local partition with a mode fracture index not less than the mode fracture boundary value is determined as the initial fracture partition. The initial fracture partition is then connected and aggregated to obtain the effective mode fracture zone.
7. The metal surface quality assessment method based on pattern recognition as described in claim 6, characterized in that, The specific steps for determining the anomaly type by analyzing the changes in surface response mode fragments within the effective mode fracture zone are as follows: Read all surface response pattern fragments within the effective pattern fracture zone and their corresponding directional response consistency, texture undulation deviation, and spatial transition deviation. Extract the extension morphology along the continuous local partition arrangement direction, the concentrated morphology of inconsistent directional order, and the dominant relationship between texture undulation deviation and spatial transition deviation. Then, classify the effective pattern fracture zone into scratch type, welding residue type, corrosion type, insufficient treatment type, or mixed abnormal type.
8. The metal surface quality assessment method based on pattern recognition as described in claim 1 or 7, characterized in that, The steps for determining the quality assessment criteria and results of the metal workpiece under test based on the process zone where the effective fracture zone is located, the regional quality loss, and the overall surface quality retention are as follows: The continuous local partitions where the end turning point is located, as well as the continuous local partitions directly adjacent to the left, right, upper and lower sides, are designated as turning process partitions. The continuous local partitions that are in direct contact with the stable contour, as well as the continuous local partitions directly adjacent to the left, right, upper and lower sides that are not part of the turning process partitions, are designated as edge process partitions. The remaining continuous local partitions are designated as main process partitions. The effective mode fracture zone is mapped to the process zone, and the regional quality loss is determined according to the coverage ratio and average fracture level of the effective mode fracture zone in the process zone. The overall surface quality retention is determined according to the quality retention part corresponding to all effective mode fracture zones. The process zone, coverage location, anomaly type, coverage ratio, average fracture level, regional quality loss, change morphology results and overall surface quality retention of the effective mode fracture zone are summarized to form the basis for quality assessment of the metal workpiece under test. When no valid mode fracture zone exists, the metal workpiece to be tested is determined to be qualified. When a valid mode fracture zone exists, it is determined whether any valid mode fracture zone is located in the transition process zone or the edge process zone and the abnormality type is scratch, any valid mode fracture zone has an abnormality type of welding residue, any valid mode fracture zone has an abnormality type of insufficient treatment, and the largest area quality loss among all valid mode fracture zones is not less than the overall surface quality retention. When any of these situations exist, the metal workpiece to be tested is determined to be reworked. When no of these situations exist but a valid mode fracture zone exists, the metal workpiece to be tested is determined to be re-inspected.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the pattern recognition-based metal surface quality assessment method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the pattern recognition-based metal surface quality assessment method according to any one of claims 1 to 8.
