Method and device for intelligently identifying and classifying alumite surface defects
By using image enhancement and feature extraction technology in electrochemical surface detection and combining the classification model of the fruit fly algorithm, the problems of light changes and defect morphology complexity are solved, and efficient and accurate identification and classification of surface defects of electrochemical aluminum are achieved.
Patent Information
- Application Number
- CN202411930687.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the detection of surface defects of electrochemical aluminum, it is difficult to overcome complex factors such as changes in lighting conditions, a wide variety of defects and different shapes, resulting in inaccurate identification and difficult to meet the real-time detection needs on actual production lines.
The camera was used to take the surface image of the electrochemical aluminum, which was decomposed into three color channels: red primary color, green primary color and blue primary color. The MSR image enhancement algorithm was used to process and merge it. The area of interest was extracted in block processing, converted into defect areas, and the shape and texture characteristics were calculated. The classification model was established based on the fruit fly algorithm to achieve accurate identification and classification of defects.
Through image enhancement and feature extraction, the impact of light changes on detection is reduced, the accuracy and stability of defect detection is improved, and the needs of real-time detection are met, so as to achieve efficient and accurate identification and classification of surface defects of electrochemical aluminum.
Smart Images

Figure CN119942183A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electroplated aluminum detection technology, and in particular to an electroplated aluminum surface defect intelligent recognition and classification method and device. Background Art
[0002] In the production and processing of anodized aluminum materials, timely detection and accurate classification of surface defects are crucial to ensure product quality. However, the traditional method of detecting surface defects of anodized aluminum mainly relies on manual visual inspection, which is not only inefficient but also easily affected by human factors, making it difficult to ensure the accuracy and consistency of the detection results. With the continuous development of machine vision technology, it has become possible to use image processing technology to realize intelligent recognition and classification of surface defects of anodized aluminum.
[0003] Although some surface defect detection methods based on machine vision have been proposed, these methods still face many challenges in practical applications. For example, factors such as the changing lighting conditions on the surface of anodized aluminum, the wide variety of defects with different shapes, and the interference of background noise all make it difficult to accurately identify defects. When dealing with these problems, traditional image processing algorithms often find it difficult to balance detection speed and detection accuracy at the same time, making them difficult to be widely used in actual production lines.
[0004] Therefore, there is an urgent need for an intelligent method that can efficiently and accurately identify and classify surface defects of electroplated aluminum. This method needs to be able to overcome the influence of complex factors such as changes in lighting conditions and diverse defect morphologies, and achieve accurate detection and classification of defects, thereby improving the quality control level of electroplated aluminum products. At the same time, the method should also have a high processing speed to meet the real-time detection needs on the actual production line. Summary of the invention
[0005] In view of the shortcomings of the prior art mentioned above, the purpose of the present invention is to provide a method and device for intelligent identification and classification of surface defects of electroplated aluminum to solve the problems in the prior art such as inaccurate identification of electroplated aluminum caused by changes in lighting conditions, a wide variety of defects and different shapes.
[0006] To achieve the above-mentioned purpose and other related purposes, the present invention provides an intelligent identification and classification method for anodized aluminum surface defects, comprising: S1. Use a camera to shoot the surface of the anodized aluminum, decompose the collected image into three color channel components: red primary color R, green primary color G, and blue primary color B, and use an image enhancement algorithm to process the three color channel components, and then merge them to obtain an enhanced image; S2, processing the enhanced image in blocks to extract the region of interest of the enhanced image; S3, converting the region of interest into a defect region, and obtaining texture features and shape features of the defect region, wherein the shape features include area ratio, aspect ratio and roundness, and the texture features include contrast, entropy and inverse moment; S4. Establish a surface defect classification model for electroplated aluminum, input shape features and texture features, and realize the classification and identification of different defects.
[0007] Optionally, decomposing the acquired image into three color channel components of red primary color R, green primary color G, and blue primary color B, and processing the three color channel components using an MSR image enhancement algorithm, and then merging them to obtain an enhanced image, specifically includes: The collected image is decomposed into three color channel components: red primary color R, green primary color G, and blue primary color B. The formula is as follows: In the formula, For any color, The primary color is red. Green is the primary color. The original color is blue. , and They are the composite weight coefficients of the three color channel components respectively; Apply the MSR image enhancement algorithm to each color channel to process the three color channel components, and then merge them to obtain the enhanced image. The formula is as follows: In the formula, For the original image The pixel value at is the reflection component, which represents the reflection characteristics of the image after removing the influence of lighting. are Gaussian convolution functions of different sizes, used to simulate illumination changes of different sizes. are weights of different sizes, used to balance the contribution of different scales to the final result. is the total number of scales, indicating how many Gaussian convolution functions of different scales are used for processing. is the convolution operation, which means applying the Gaussian convolution function to the original image; , For scale The two-dimensional information entropy represents the amount of information of the image at this scale. For scale The amount of information in the image when it is 1.
[0008] Optionally, the processing of dividing the enhanced image into blocks to extract the region of interest of the enhanced image specifically includes: The size of the enhanced image I is set to m×n; The enhanced image I is divided into three sub-blocks by row, named I1, I2 and I3, where I1 contains the first 1 / 3 rows of the image, I2 contains the middle 1 / 3 rows of the image, and I3 contains the last 1 / 3 rows of the image; The enhanced image I is divided into three sub-blocks by column, named I4, I5 and I6 respectively, where I4 contains the first 1 / 3 columns of the image, I5 contains the middle 1 / 3 columns of the image, and I6 contains the last 1 / 3 columns of the image; For the three sub-blocks I1, I2 and I3, the pixel mean of each column is calculated respectively to form three n-column mean vectors, and the three n-column mean vectors are arranged in rows to form a 3×n mean matrix MN; For the three sub-blocks I4, I5 and I6, the pixel mean of each row is calculated respectively to form three mean vectors of m rows, and the three mean vectors of m rows are arranged in columns to form an m×3 mean matrix MM; Calculate the second-order difference of pixels in adjacent columns in the mean matrix MN: for each pair of adjacent columns in MN, calculate the difference of corresponding elements, and then square the difference to form a second-order difference. Arrange the second-order differences by column to form a new 3×(n-1) difference matrix ND2; in the difference matrix ND2, find the column position corresponding to the grayscale change area in the image, and determine the left boundary minL and the right boundary maxR of the area of interest; Calculate the second-order difference of pixels in adjacent rows in the mean matrix MM: for each pair of adjacent rows in MM, calculate the difference of the corresponding elements, and then square the difference to form a second-order difference, and arrange the second-order differences by row to form an m×(3-1) difference matrix MD2; in the difference matrix MD2, find the row position corresponding to the grayscale change area in the image, and determine the upper boundary minU and the lower boundary maxD of the area of interest; The corresponding region of interest is extracted from the enhanced image I according to the boundary values minL, maxR, minU and maxD.
[0009] Optionally, converting the region of interest into a defect region specifically includes: S31, selecting an initial value as a global threshold; S32, segmenting the region of interest using the current global threshold, treating pixels with grayscale values greater than the global threshold as foreground, and treating pixels with grayscale values less than or equal to the global threshold as background; S33, respectively calculating the average grayscale values of the foreground and background pixels; S34, adding the average grayscale values of the foreground and background and dividing by 2 to obtain a new global threshold; S35, repeating steps S31 to S34 until the difference between the new global threshold and the previous global threshold is less than a predetermined threshold; S36. After the iteration is completed, the region of interest is segmented using the final global threshold to obtain a final defect region.
[0010] Optionally, the method for calculating the shape feature specifically includes: The area ratio is calculated as follows: In the formula, is the defect area, is the image height, is the image width; The aspect ratio is calculated as follows: In the formula, is the length of the rectangular frame, is the width of the rectangular frame; The calculation formula of roundness is as follows: In the formula, is the perimeter of the defect.
[0011] Optionally, the method for calculating the texture feature specifically includes: For any pixel point of the enhanced image, the horizontal direction of the pixel point is defined as 0°, and the counterclockwise rotation is defined as 45°, 90°, and 135°, and the grayscale values along these four angles are counted as , pixel pairs with a distance of d, to obtain four different gray-level co-occurrence matrices, and calculate the eigenvalues of the gray-level co-occurrence matrices: contrast, entropy and inverse moment, where: The contrast ratio is calculated as follows: In the formula, The elements in the gray-level co-occurrence matrix represent the frequency or probability of two pixel pairs with gray-level values i and j appearing in a specified direction and distance d; The calculation formula of entropy is as follows: In the formula, To take the logarithm of the probability value, it is used to measure the randomness of the probability distribution in the calculation of entropy; The calculation formula of the inverse moment is as follows: In the formula, When calculating the inverse moment, it is used to measure the impact of gray value differences on local gray consistency.
[0012] Optionally, the establishment of an electroplated aluminum surface defect classification model, inputting texture features and shape features to achieve classification and identification of different defects, specifically includes: Establishing an electrochemical aluminum surface defect classification model based on the fruit fly algorithm: S41, setting the size of the fruit fly to maxsize; the number of iterations to maxgen; the position of the fruit fly group to X_axis and Y_axis, which represent the initial horizontal and vertical coordinates of the fruit fly in the search space, respectively; S42. According to the random orientation and position, the fruit fly individuals search for food by smell, that is, they search for a better smoothing factor σ value; S43. For each fruit fly individual, its position is updated as: X_i = X_axis + Random Value and Y_i = Y_axis + Random Value; S44. Calculate the distance D_i between each fruit fly individual and the origin using the formula: D_i = sqrt(X_i^2 +Y_i^2), and calculate the taste concentration judgment value S_i based on the distance using the formula: S_i = 1 / D_i; S45. Use the output error of the training sample to construct a taste concentration judgment function Smell(S_i). The value of Smell(S_i) is determined by the inverse of the mean square error. The formula is: Smell(S_i) = 1 / RMSE(T - T_out), where T is the expected output and T_out is the actual output. S46, extracting the fruit fly individual with the highest smell concentration from the fruit fly population, and recording its smell concentration bestSmell and the corresponding index bestIndex; S47, save the maximum smell concentration value bestSmell and the corresponding X, Y coordinates; update the position of the fruit fly group to make it close to the position of the optimal fruit fly individual, that is: X_axis = X(bestIndex) and Y_axis = Y(bestIndex); S48, repeating steps S42 to S47 until the upper limit of the number of iterations maxgen is reached. In each iteration, if the bestSmell obtained in the current iteration is better than that in the previous iteration, the optimal value and the position of the fruit fly colony are updated; otherwise, proceeding to the next iteration; S49. Use the optimal smoothing factor σ finally obtained to construct a PNN model, i.e., an electroplated aluminum surface defect classification model. Input the area ratio, aspect ratio, roundness, contrast, entropy and inverse moment into the electroplated aluminum surface defect classification model to obtain a defect classification result.
[0013] An intelligent recognition and classification device for electrochemical aluminum surface defects, comprising: A preprocessing module is used to shoot the anodized aluminum surface with a camera, decompose the collected image into three color channel components of red primary color R, green primary color G, and blue primary color B, and use an image enhancement algorithm to process the three color channel components, and then merge them to obtain an enhanced image; A ROI extraction module, used for processing the enhanced image in blocks and extracting a region of interest of the enhanced image; A feature acquisition module, used to convert the region of interest into a defect region, and acquire texture features and shape features of the defect region, wherein the shape features include area ratio, aspect ratio and roundness, and the texture features include contrast, entropy and inverse moment; The defect recognition and classification module is used to establish an electroplated aluminum surface defect classification model, input shape features and texture features, and realize the classification and recognition of different defects.
[0014] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the method for intelligent identification and classification of surface defects of electroplated aluminum are implemented as described above.
[0015] A computer-readable storage medium having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by a processor, implement the steps of the method for intelligent identification and classification of surface defects of electroplated aluminum as described above.
[0016] As described above, the intelligent identification and classification method for electroplated aluminum surface defects proposed by the present invention has the following effects: The present invention processes the collected images by using an image enhancement algorithm, especially by applying the MSR image enhancement algorithm to the three color channel components of the red primary color R, the green primary color G, and the blue primary color B, respectively, which can effectively reduce the impact of changes in lighting conditions on image quality, improve the signal-to-noise ratio of the image, and provide a clearer and more accurate image basis for subsequent defect detection; The present invention extracts the region of interest of the enhanced image and converts it into the defect region, and further obtains the texture features and shape features of the defect region (including contrast, entropy, inverse moment, area ratio, aspect ratio and roundness, etc.). These features can fully and accurately describe the characteristics and morphology of the defects, and provide strong support for the classification and identification of defects. The present invention decomposes the image into color channel components and processes them separately, as well as subsequent steps such as block processing, region of interest extraction and global threshold segmentation. The method can effectively reduce the interference of background noise on defect detection and improve the accuracy and stability of detection. The electroplated aluminum surface defect classification model based on the fruit fly algorithm can improve the processing speed while ensuring the detection accuracy, thereby meeting the real-time detection needs on the actual production line. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 Shown is a schematic flow chart of an intelligent identification and classification method for anodized aluminum surface defects according to an embodiment of the present invention; Figure 2 Shown is a structural block diagram of an intelligent identification and classification device for anodized aluminum surface defects according to an embodiment of the present invention; Figure 3 Shown is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.
[0019] It should be noted that the diagram provided in the present embodiment only illustrates the basic concept of the present invention in a schematic manner, so the diagram only shows the components related to the present invention rather than drawing according to the number, shape and size of the components during actual implementation. The type, quantity and ratio of each component during actual implementation can be a random change, and the component layout type may also be more complicated. The structure, ratio, size, etc. illustrated in the drawings of the present specification are only used to match the content disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the limiting conditions that the present invention can implement, so they have no technical substantive significance. Any modification of the structure, change of the proportional relationship or adjustment of the size should still fall within the scope of the technical content disclosed by the present invention without affecting the effect that the present invention can produce and the purpose that can be achieved. At the same time, the terms such as "upper", "lower", "left", "right", "middle" and "one" quoted in this specification are only for the convenience of narration, and are not used to limit the scope of the present invention. The change or adjustment of its relative relationship should also be regarded as the scope of the present invention without substantially changing the technical content.
[0020] like Figure 1As shown, the present invention provides an intelligent identification and classification method for anodized aluminum surface defects, aiming to achieve accurate identification and classification of anodized aluminum surface defects. The specific implementation of the present invention will be described in detail below: S1. Use a camera to shoot the surface of the anodized aluminum, decompose the collected image into three color channel components: red primary color R, green primary color G, and blue primary color B, and use an image enhancement algorithm to process the three color channel components, and then merge them to obtain an enhanced image; Specifically, a high-resolution camera is used to shoot the surface of anodized aluminum to ensure that the image is clear and complete. Subsequently, the collected image is decomposed into three color channel components: red primary color R, green primary color G, and blue primary color B. After decomposing the color channels, the three color channel components are processed using the MSR (Multi-Scale Retinex) image enhancement algorithm. The MSR algorithm is a commonly used image enhancement method that can improve the local contrast of the image while maintaining the brightness and color information of the image.
[0021] The specific processing process of the MSR algorithm is as follows: The collected image is decomposed into three color channel components: red primary color R, green primary color G, and blue primary color B. The formula is as follows: In the formula, For any color, The primary color is red. Green is the primary color. The original color is blue. , and They are the composite weight coefficients of the three color channel components respectively; Apply the MSR image enhancement algorithm to each color channel to process the three color channel components, and then merge them to obtain the enhanced image. The formula is as follows: In the formula, For the original image The pixel value at is the reflection component, which represents the reflection characteristics of the image after removing the influence of lighting. are Gaussian convolution functions of different sizes, used to simulate illumination changes of different sizes. are weights of different sizes, used to balance the contribution of different scales to the final result. is the total number of scales, indicating how many Gaussian convolution functions of different scales are used for processing. is the convolution operation, which means applying the Gaussian convolution function to the original image; , For scale The two-dimensional information entropy represents the amount of information of the image at this scale. For scale The amount of information in the image when it is 1.
[0022] in, The calculation process is as follows: By calculating the average grayscale value of the pixels around the image , two-dimensional quantity ( ) is as follows: In the formula, is the characteristic two-dimensional quantity the number of is the total number of pixels in the image; The discrete two-dimensional entropy of an image is defined as: therefore, , the weights are automatically determined by calculating the image information entropy.
[0023] After being processed by the MSR algorithm, the three color channel components are merged to obtain an enhanced image. The enhanced image is significantly improved in terms of contrast, brightness and color information, providing a good foundation for subsequent processing.
[0024] S2, processing the enhanced image in blocks to extract the region of interest of the enhanced image; In order to reduce computational complexity and improve recognition accuracy, the enhanced image needs to be processed in blocks to extract the region of interest, including: The size of the enhanced image I is set to m×n; The enhanced image I is divided into three sub-blocks by row, named I1, I2 and I3, where I1 contains the first 1 / 3 rows of the image, I2 contains the middle 1 / 3 rows of the image, and I3 contains the last 1 / 3 rows of the image; The enhanced image I is divided into three sub-blocks by column, named I4, I5 and I6 respectively, where I4 contains the first 1 / 3 columns of the image, I5 contains the middle 1 / 3 columns of the image, and I6 contains the last 1 / 3 columns of the image; For the three sub-blocks I1, I2 and I3, the pixel mean of each column is calculated respectively to form three n-column mean vectors, and the three n-column mean vectors are arranged in rows to form a 3×n mean matrix MN; For the three sub-blocks I4, I5 and I6, the pixel mean of each row is calculated respectively to form three mean vectors of m rows, and the three mean vectors of m rows are arranged in columns to form an m×3 mean matrix MM; Calculate the second-order difference of pixels in adjacent columns in the mean matrix MN: for each pair of adjacent columns in MN, calculate the difference of corresponding elements, and then square the difference to form a second-order difference. Arrange the second-order differences by column to form a new 3×(n-1) difference matrix ND2; in the difference matrix ND2, find the column position corresponding to the grayscale change area in the image, and determine the left boundary minL and the right boundary maxR of the area of interest; Calculate the second-order difference of pixels in adjacent rows in the mean matrix MM: for each pair of adjacent rows in MM, calculate the difference of the corresponding elements, and then square the difference to form a second-order difference, and arrange the second-order differences by row to form an m×(3-1) difference matrix MD2; in the difference matrix MD2, find the row position corresponding to the grayscale change area in the image, and determine the upper boundary minU and the lower boundary maxD of the area of interest; The corresponding region of interest is extracted from the enhanced image I according to the boundary values minL, maxR, minU and maxD.
[0025] S3, converting the region of interest into a defect region, and obtaining texture features and shape features of the defect region, wherein the shape features include area ratio, aspect ratio and roundness, and the texture features include contrast, entropy and inverse moment; The extracted region of interest is converted into a defect region for further feature extraction, specifically including: S21, selecting an initial value as a global threshold; S22, segmenting the region of interest using the current global threshold, treating pixels with grayscale values greater than the global threshold as foreground, and treating pixels with grayscale values less than or equal to the global threshold as background; S23, respectively calculating the average grayscale values of the foreground and background pixels; S24, adding the average grayscale values of the foreground and background and dividing by 2 to obtain a new global threshold; S25, repeating steps S21 to S24 until the difference between the new global threshold and the previous global threshold is less than a predetermined threshold; S26. After the iteration is completed, the region of interest is segmented using the final global threshold to obtain a final defect region.
[0026] Next, the shape features and texture features of the defect area are extracted. The shape features include area ratio, aspect ratio and roundness, which are used to describe the shape information of the defect area. The texture features include contrast, entropy and inverse moment, which are used to reflect the texture information of the defect area.
[0027] The calculation formula for area ratio is as follows: In the formula, is the defect area, is the image height, is the image width; The aspect ratio is calculated as follows: In the formula, is the length of the rectangular frame, is the width of the rectangular frame; The calculation formula of roundness is as follows: In the formula, is the perimeter of the defect.
[0028] For any pixel point in the enhanced image, the horizontal direction of the pixel point is defined as 0°, and the counterclockwise rotation is defined as 45°, 90°, and 135°, and the grayscale values along these four angles are calculated as , pixel pairs with a distance of d, to obtain four different gray-level co-occurrence matrices, and calculate the eigenvalues of the gray-level co-occurrence matrices: contrast, entropy and inverse moment, where: The contrast ratio is calculated as follows: In the formula, The elements in the gray-level co-occurrence matrix represent the frequency or probability of two pixel pairs with gray-level values i and j appearing in a specified direction and distance d; The calculation formula of entropy is as follows: In the formula, To take the logarithm of the probability value, it is used to measure the randomness of the probability distribution in the calculation of entropy; The calculation formula of the inverse moment is as follows: In the formula, When calculating the inverse moment, it is used to measure the impact of gray value differences on local gray consistency.
[0029] S4. Establish a surface defect classification model for electroplated aluminum, input shape features and texture features, and realize the classification and identification of different defects.
[0030] The present invention establishes an electroplated aluminum surface defect classification model based on the fruit fly algorithm. The fruit fly algorithm is an optimization algorithm based on swarm intelligence, which has the advantages of strong global search capability and fast convergence speed.
[0031] The specific steps are as follows: S41, setting the size of the fruit fly to maxsize; the number of iterations to maxgen; the position of the fruit fly group to X_axis and Y_axis, which represent the initial horizontal and vertical coordinates of the fruit fly in the search space, respectively; S42. According to the random orientation and position, the fruit fly individuals search for food by smell, that is, they search for a better smoothing factor σ value; S43. For each fruit fly individual, its position is updated as: X_i = X_axis + Random Value and Y_i = Y_axis + Random Value; S44. Calculate the distance D_i between each fruit fly individual and the origin using the formula: D_i = sqrt(X_i^2 +Y_i^2), and calculate the taste concentration judgment value S_i based on the distance using the formula: S_i = 1 / D_i; S45. Use the output error of the training sample to construct a taste concentration judgment function Smell(S_i). The value of Smell(S_i) is determined by the inverse of the mean square error. The formula is: Smell(S_i) = 1 / RMSE(T - T_out), where T is the expected output and T_out is the actual output. S46, extracting the fruit fly individual with the highest smell concentration from the fruit fly population, and recording its smell concentration bestSmell and the corresponding index bestIndex; S47, save the maximum smell concentration value bestSmell and the corresponding X, Y coordinates; update the position of the fruit fly group to make it close to the position of the optimal fruit fly individual, that is: X_axis = X(bestIndex) and Y_axis = Y(bestIndex); S48, repeating steps S42 to S47 until the upper limit of the number of iterations maxgen is reached. In each iteration, if the bestSmell obtained in the current iteration is better than that in the previous iteration, the optimal value and the position of the fruit fly colony are updated; otherwise, proceeding to the next iteration; S49. Use the optimal smoothing factor σ finally obtained to construct a PNN model, i.e., an electroplated aluminum surface defect classification model. Input the area ratio, aspect ratio, roundness, contrast, entropy and inverse moment into the electroplated aluminum surface defect classification model to obtain a defect classification result.
[0032] The present invention significantly improves the accuracy and robustness of recognition through multi-step refined processing. First, the color channel components are processed by an image enhancement algorithm, which effectively enhances the image quality and provides a clear and accurate image basis for subsequent processing. Secondly, the region of interest is accurately extracted through block processing and second-order difference calculation, avoiding the interference of irrelevant information. Furthermore, the region of interest is converted into a defect region using an iterative global threshold segmentation method, thereby improving the accuracy of defect recognition. In addition, by calculating rich texture features and shape features, comprehensive information is provided for defect classification. Finally, the classification model established based on the fruit fly algorithm can intelligently identify and classify different defects, and has a high level of automation and intelligence.
[0033] The present invention combines global threshold segmentation and multiple feature extraction methods, which can accurately identify and classify multiple defects (such as scratches, pits, cracks, etc.) on the surface of anodized aluminum. This multi-feature fusion strategy further enhances the robustness and accuracy of the method.
[0034] In summary, this method not only improves the accuracy and efficiency of surface defect identification of electrochemical aluminum, but also has strong robustness and adaptability, and can be widely used in quality control and defect detection in the production process of electrochemical aluminum.
[0035] refer to Figure 2 , as a response to the above Figure 1 The present application provides an embodiment of an intelligent recognition and classification device for electroplated aluminum surface defects. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0036] like Figure 2 As shown, the intelligent identification and classification device for electrochemical aluminum surface defects described in this embodiment includes: A preprocessing module is used to shoot the anodized aluminum surface with a camera, decompose the collected image into three color channel components of red primary color R, green primary color G, and blue primary color B, and use an image enhancement algorithm to process the three color channel components, and then merge them to obtain an enhanced image; A ROI extraction module, used for processing the enhanced image in blocks and extracting a region of interest of the enhanced image; A feature acquisition module, used to convert the region of interest into a defect region, and acquire texture features and shape features of the defect region, wherein the shape features include area ratio, aspect ratio and roundness, and the texture features include contrast, entropy and inverse moment; The defect recognition and classification module is used to establish an electroplated aluminum surface defect classification model, input shape features and texture features, and realize the classification and recognition of different defects.
[0037] To solve the above technical problems, the present application also provides a computer device. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.
[0038] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0039] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0040] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk equipped on the computer device 4, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the intelligent identification and classification method of electroplated aluminum surface defects. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0041] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions or process data stored in the memory 41, such as computer-readable instructions for running the method for intelligent identification and classification of electroplated aluminum surface defects.
[0042] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0043] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned method for intelligent identification and classification of electroplated aluminum surface defects.
[0044] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A method for intelligent identification and classification of surface defects of electrochemical aluminum, characterized in that: The following steps are involved: S1. Use a camera to shoot the surface of the anodized aluminum, decompose the collected image into three color channel components: red primary color R, green primary color G, and blue primary color B, and use an image enhancement algorithm to process the three color channel components, and then merge them to obtain an enhanced image; S2, processing the enhanced image in blocks to extract the region of interest of the enhanced image; S3, converting the region of interest into a defect region, and obtaining texture features and shape features of the defect region, wherein the shape features include area ratio, aspect ratio and roundness, and the texture features include contrast, entropy and inverse moment; S4. Establish a surface defect classification model for electroplated aluminum, input shape features and texture features, and realize the classification and identification of different defects.
2. According to the method for intelligent recognition and classification of surface defects of electroplated aluminum according to claim 1, the collected image is decomposed into three color channel components of red primary color R, green primary color G, and blue primary color B, and the three color channel components are processed using the MSR image enhancement algorithm, and then merged to obtain an enhanced image, which specifically includes: The collected image is decomposed into three color channel components: red primary color R, green primary color G, and blue primary color B. The formula is as follows: In the formula, For any color, The primary color is red. Green is the primary color. The original color is blue. , and They are the composite weight coefficients of the three color channel components respectively; Apply the MSR image enhancement algorithm to each color channel to process the three color channel components, and then merge them to obtain the enhanced image. The formula is as follows: In the formula, For the original image The pixel value at is the reflection component, which represents the reflection characteristics of the image after removing the influence of lighting. are Gaussian convolution functions of different sizes, used to simulate illumination changes of different sizes. are weights of different sizes, used to balance the contribution of different scales to the final result. is the total number of scales, indicating how many Gaussian convolution functions of different scales are used for processing. is the convolution operation, which means applying the Gaussian convolution function to the original image; , For scale The two-dimensional information entropy represents the amount of information of the image at this scale. For scale The amount of information in the image when it is 1.
3. According to the method for intelligent recognition and classification of electroplated aluminum surface defects in claim 2, the step of processing the enhanced image into blocks and extracting the region of interest of the enhanced image specifically comprises: The size of the enhanced image I is set to m×n; The enhanced image I is divided into three sub-blocks by row, named I1, I2 and I3, where I1 contains the first 1 / 3 rows of the image, I2 contains the middle 1 / 3 rows of the image, and I3 contains the last 1 / 3 rows of the image; The enhanced image I is divided into three sub-blocks by column, named I4, I5 and I6 respectively, where I4 contains the first 1 / 3 columns of the image, I5 contains the middle 1 / 3 columns of the image, and I6 contains the last 1 / 3 columns of the image; For the three sub-blocks I1, I2 and I3, the pixel mean of each column is calculated respectively to form three n-column mean vectors, and the three n-column mean vectors are arranged in rows to form a 3×n mean matrix MN; For the three sub-blocks I4, I5 and I6, the pixel mean of each row is calculated respectively to form three mean vectors of m rows, and the three mean vectors of m rows are arranged in columns to form an m×3 mean matrix MM; Calculate the second-order difference of pixels in adjacent columns in the mean matrix MN: for each pair of adjacent columns in MN, calculate the difference of corresponding elements, and then square the difference to form a second-order difference. Arrange the second-order differences by column to form a new 3×(n-1) difference matrix ND2; in the difference matrix ND2, find the column position corresponding to the grayscale change area in the image, and determine the left boundary minL and the right boundary maxR of the area of interest; Calculate the second-order difference of pixels in adjacent rows in the mean matrix MM: for each pair of adjacent rows in MM, calculate the difference of the corresponding elements, and then square the difference to form a second-order difference, and arrange the second-order differences by row to form an m×(3-1) difference matrix MD2; in the difference matrix MD2, find the row position corresponding to the grayscale change area in the image, and determine the upper boundary minU and the lower boundary maxD of the area of interest; The corresponding region of interest is extracted from the enhanced image I according to the boundary values minL, maxR, minU and maxD.
4. According to the method for intelligent recognition and classification of electrochemical aluminum surface defects in claim 3, the converting the region of interest into a defect region specifically comprises: S31, selecting an initial value as a global threshold; S32, segmenting the region of interest using the current global threshold, treating pixels with grayscale values greater than the global threshold as foreground, and treating pixels with grayscale values less than or equal to the global threshold as background; S33, respectively calculating the average grayscale values of the foreground and background pixels; S34, adding the average grayscale values of the foreground and background and dividing by 2 to obtain a new global threshold; S35, repeating steps S31 to S34 until the difference between the new global threshold and the previous global threshold is less than a predetermined threshold; S36. After the iteration is completed, the region of interest is segmented using the final global threshold to obtain a final defect region.
5. According to the method for intelligent recognition and classification of electroplated aluminum surface defects according to claim 4, the method for calculating the shape features specifically comprises: The area ratio is calculated as follows: In the formula, is the defect area, is the image height, is the image width; The aspect ratio is calculated as follows: In the formula, is the length of the rectangular frame, is the width of the rectangular frame; The calculation formula of roundness is as follows: In the formula, is the perimeter of the defect.
6. According to the method for intelligent recognition and classification of electroplated aluminum surface defects according to claim 5, the method for calculating the texture features specifically comprises: For any pixel point of the enhanced image, the horizontal direction of the pixel point is defined as 0°, and the counterclockwise rotation is defined as 45°, 90°, and 135° respectively. The grayscale values along these four angles are , pixel pairs with a distance of d, to obtain four different gray-level co-occurrence matrices, and calculate the eigenvalues of the gray-level co-occurrence matrices: contrast, entropy and inverse moment, where: The contrast ratio is calculated as follows: In the formula, The elements in the gray-level co-occurrence matrix represent the frequency or probability of two pixel pairs with gray-level values i and j appearing in a specified direction and distance d; The calculation formula of entropy is as follows: In the formula, To take the logarithm of the probability value, it is used to measure the randomness of the probability distribution in the calculation of entropy; The calculation formula of the inverse moment is as follows: In the formula, When calculating the inverse moment, it is used to measure the impact of gray value differences on local gray consistency.
7. According to the method for intelligent recognition and classification of electroplated aluminum surface defects in claim 6, the method of establishing an electroplated aluminum surface defect classification model, inputting texture features and shape features, and realizing classification and recognition of different defects specifically comprises: Establishing an electrochemical aluminum surface defect classification model based on the fruit fly algorithm: S41, setting the size of the fruit fly to maxsize; the number of iterations to maxgen; the position of the fruit fly group to X_axis and Y_axis, which represent the initial horizontal and vertical coordinates of the fruit fly in the search space, respectively; S42. According to the random orientation and position, the fruit fly individuals search for food by smell, that is, they search for a better smoothing factor σ value; S43. For each fruit fly individual, its position is updated as: X_i = X_axis + Random Value and Y_i = Y_axis + Random Value; S44. Calculate the distance D_i between each fruit fly individual and the origin using the formula: D_i = sqrt(X_i^2 + Y_i^2). Calculate the taste concentration judgment value S_i based on the distance using the formula: S_i = 1 / D_i. S45. Use the output error of the training sample to construct a taste concentration judgment function Smell(S_i). The value of Smell(S_i) is determined by the inverse of the mean square error. The formula is: Smell(S_i) = 1 / RMSE(T - T_out), where T is the expected output and T_out is the actual output. S46, extracting the fruit fly individual with the highest smell concentration from the fruit fly population, and recording its smell concentration bestSmell and the corresponding index bestIndex; S47, save the maximum smell concentration value bestSmell and the corresponding X, Y coordinates; update the position of the fruit fly group to make it close to the position of the optimal fruit fly individual, that is: X_axis = X(bestIndex) and Y_axis = Y(bestIndex); S48, repeating steps S42 to S47 until the upper limit of the number of iterations maxgen is reached. In each iteration, if the bestSmell obtained in the current iteration is better than that in the previous iteration, the optimal value and the position of the fruit fly colony are updated; otherwise, proceeding to the next iteration; S49. Use the optimal smoothing factor σ finally obtained to construct a PNN model, i.e., an electroplated aluminum surface defect classification model. Input the area ratio, aspect ratio, roundness, contrast, entropy and inverse moment into the electroplated aluminum surface defect classification model to obtain a defect classification result.
8. An intelligent identification and classification device for electrochemical aluminum surface defects, characterized in that: include: A preprocessing module is used to shoot the anodized aluminum surface with a camera, decompose the collected image into three color channel components of red primary color R, green primary color G, and blue primary color B, and use an image enhancement algorithm to process the three color channel components, and then merge them to obtain an enhanced image; A ROI extraction module, used for processing the enhanced image in blocks and extracting a region of interest of the enhanced image; A feature acquisition module, used to convert the region of interest into a defect region, and acquire texture features and shape features of the defect region, wherein the shape features include area ratio, aspect ratio and roundness, and the texture features include contrast, entropy and inverse moment; The defect recognition and classification module is used to establish an electroplated aluminum surface defect classification model, input shape features and texture features, and realize the classification and recognition of different defects.
9. A computer device, characterized in that: It comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the method for intelligent identification and classification of surface defects of electroplated aluminum as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for intelligent identification and classification of surface defects of electroplated aluminum as described in any one of claims 1 to 7.
Citation Information
Cited By
Greenhouse Internet of Things monitoring system
CN121478053A
Bar discharging temperature intelligent sorting method and system
CN121580354A