Industrial product defect classification large model training method and defect detection method

Through the large model training method of industrial product defect classification, grayscale images and Fourier analysis technology are used to solve the problem of algorithm stability and insufficient samples in industrial product appearance defect detection, achieve fast and accurate defect detection, and improve production. Efficiency and quality, supporting automated production.

CN118570561APending Publication Date: 2024-08-30NANJING HAIYAN TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411044814.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

The existing technology has poor algorithm stability, missed detection and wrong detection problems in industrial product appearance defect detection, and insufficient demand for training samples, resulting in difficulty in model learning, inability to effectively extract features, and affecting detection efficiency and accuracy.

Method used

Using the large model training method for industrial product defect classification, by acquiring grayscale images, eliminating background areas, performing characteristic analysis and Fourier analysis, screening high-frequency information, locating target areas, generating pre-selected boxes, cropping the image to be inspected, and establishing defect images Data set, uses classification model network for training and detection, and supports model iteration.

Benefits of technology

It achieves fast and accurate defect detection, improves production efficiency and production control quality, reduces manual operating errors, supports automated production, and reduces detection costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570561A
    Figure CN118570561A
Patent Text Reader

Abstract

The invention discloses an industrial product defect classification large model training method and a defect detection method, and the method comprises the steps: obtaining a gray image of a product, and extracting a main region image of the product; carrying out characteristic analysis and gain processing on the image to enhance the contrast of the image, carrying out Fourier analysis on the image, creating a Gaussian filter, analyzing and screening frequency domain information of the image, and screening out high-frequency information of the image; high-frequency information of the image is converted into spatial domain information, and a target area is quickly positioned; generating a pre-selection box, and cutting out a to-be-detected image; a data set is established, a classification model network is trained, the trained model is used for defect detection, the defect detection efficiency is high, the precision is high, and model iteration is supported.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of industrial control technology and relates to production line detection technology, and in particular to large-scale model training for product defect classification and a defect detection method based on the large-scale model. Background Art

[0002] Industrial products need to be spliced ​​and circulated in multiple steps on the production line, so they are prone to defects due to improper operation. For example, the appearance of sheet metal on the current production line may have the following defects: (1) Scratches on the metal surface due to improper operation of tools during installation; (2) Dirt left on the product surface due to environmental or other factors; (3) The product is large and heavy, and may be bumped during circulation. Since the production line produces a large number of products every day, manual defect detection may cause visual fatigue and missed defects. Product records also need to be manually recorded, and multiple operations increase the burden on operators.

[0003] Traditional machine algorithms are sensitive to background environment and model changes when solving such problems, and slight changes may cause the algorithm to fail (such as CN117788467A, a titanium metal plate defect image classification method). This method requires threshold calculation to screen out the optimal solution. However, if the product model, color, appearance, and background changes are serious, the algorithm stability may be poor.

[0004] As described in CN117132581A, a printed circuit board micro-defect detection method based on the YOLO network, for detection objects with tiny target defects and complex backgrounds, missed detection and false detection are serious problems, and there is an insufficient demand for training samples when deeply solving such problems. In actual industrial production, there are fewer defect samples and they have different shapes, resulting in insufficient prior knowledge of training data, inability to effectively extract features during model learning, and slow model iteration. Summary of the invention

[0005] The purpose of the present invention is to overcome the defects of the prior art, detect appearance defects of industrial products, improve production efficiency and production control quality, reduce manual errors in operation, support model iteration, and realize automated production.

[0006] To achieve the purpose of the present invention, the technical solution adopted by the present invention is a large-scale model training method for industrial product defect classification and a defect detection method.

[0007] A large model training method for industrial product defect classification includes the following steps: S1, obtain the grayscale image of the product; S2, discard the background area of ​​the grayscale image and extract the image of the main area of ​​the product; S3, performing characteristic analysis on the image of the main area of ​​the product to obtain the grayscale mean and grayscale deviation value of the image, and performing gain processing on the image of the main area of ​​the product according to the grayscale mean and grayscale deviation value to enhance the image contrast; S4, performing Fourier analysis on the image to convert the spatial domain information of the image into frequency domain information, creating a Gaussian filter, analyzing and screening the frequency domain information of the image, and screening out the high-frequency information of the image; S5, converting the high-frequency information of the image into spatial domain information, locating all target areas corresponding to the high-frequency information and obtaining the area values ​​of all target areas, and screening out target areas larger than the area threshold by comparing with a preset area threshold; generating a pre-selection box, and cutting out the image to be inspected containing the target area from the image; S6. Manually screen the images to be inspected, establish a defect image dataset and a contour edge image dataset; and use the defect image dataset and the contour edge image dataset to train the classification model network.

[0008] The method of the present invention can quickly and accurately obtain training samples, realize accurate training of the classification model network, and support model iteration based on the convergence characteristics of the classification model network.

[0009] Furthermore, in step S3, the characteristics of the product main area image are analyzed to obtain the grayscale mean and grayscale deviation value of the image, and the product main area image is subjected to gain processing according to the grayscale mean and grayscale deviation value to enhance the image contrast, and the noise in the image is removed by median filtering. Median filtering can further remove noise, reduce interference with subsequent algorithms, and further improve processing efficiency and accuracy.

[0010] The large-model-based automated industrial product defect detection method obtains the trained classification model network based on the above-mentioned large-model training method for industrial product defect classification, and then performs the following steps: S1, obtain the grayscale image of the product; S2, discard the background area of ​​the grayscale image and extract the image of the main area of ​​the product; S3, performing characteristic analysis on the image of the main area of ​​the product to obtain the grayscale mean and grayscale deviation value of the image, and performing gain processing on the image of the main area of ​​the product according to the grayscale mean and grayscale deviation value to enhance the image contrast; S4, performing Fourier analysis on the image to convert the spatial domain information of the image into frequency domain information, creating a Gaussian filter, analyzing and screening the frequency domain information of the image, and screening out the high-frequency information of the image; S5, converting the high-frequency information of the image into spatial domain information, locating all target areas corresponding to the high-frequency information and obtaining the area values ​​of all target areas, and screening out target areas larger than the area threshold by comparing with a preset area threshold; generating a pre-selection box, and cutting out the image to be inspected containing the target area from the image; S6. Analyze and classify the image to be inspected through the trained classification model network.

[0011] Furthermore, the method further includes step S7: storing the classified images into a defect image dataset and a contour edge image dataset respectively, so as to collect more training sets for iterative training of the classification model.

[0012] Furthermore, in step S3, the characteristics of the product main area image are analyzed to obtain the grayscale mean and grayscale deviation value of the image, and the product main area image is subjected to gain processing according to the grayscale mean and grayscale deviation value to enhance the image contrast, and the noise in the image is removed by median filtering. Median filtering can further remove noise, reduce interference with subsequent algorithms, and further improve processing efficiency and accuracy.

[0013] Furthermore, in step S5, the high-frequency information of the image is converted into spatial domain information, all target areas corresponding to the high-frequency information are located and the area values ​​of all target areas are obtained, and by comparing with a preset area threshold, target areas larger than the area threshold are screened out; the area values ​​of the screened target areas are averaged, and then target areas with areas smaller than the average are screened out; a pre-selection box is generated, and the image to be inspected containing the target area finally screened out is cropped out from the image.

[0014] The target area may be a contour edge area or a defect area. Since the area of ​​the defect area is much smaller than the area of ​​the contour edge area, the area of ​​the contour edge area should be larger than the average value, while the area of ​​the defect area should be smaller than the average value. This method can be used to screen out large contour edge areas and screen out small defect areas and contour edge areas, further reducing the data processed by the large model and improving the efficiency and accuracy of detection.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: the method of the present invention processes the grayscale images of industrial products, has low requirements on the complexity of the algorithm, screens at each step, processes less and more precise data, and quickly locates the target area through mutual conversion between the image space domain and the frequency domain, obtains defect images and contour edge images, establishes a training set through manual selection, trains the classification model network, supports rapid iteration of the classification model network, and uses the trained classification model network to accurately analyze and classify the images to be inspected, thereby realizing low-cost, rapid and accurate detection of product defects, improving production efficiency and production control quality, reducing manual errors in operation, and realizing automated production. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 Shown is a flow chart of a large model training method for industrial product defect classification.

[0018] Figure 2 Shown is a flow chart of a large model-based automated industrial product defect detection method.

[0019] Figure 3 Shown is a comparison of the image before and after gain processing.

[0020] Figure 4 Shown is a schematic diagram of image generation pre-selection box. DETAILED DESCRIPTION

[0021] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The embodiments of the present invention are provided for the purpose of illustration and description, and are not intended to be exhaustive or to limit the present invention to the disclosed forms. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments are selected and described in order to better illustrate the principles and practical applications of the present invention, and to enable those of ordinary skill in the art to understand the present invention and thereby design various embodiments with various modifications suitable for specific uses.

[0022] At present, automated defect detection technology can replace most manual inspections to improve the efficiency and quality of product production. Only cameras, industrial computer software and corresponding mechanical structures are needed to realize the automatic defect detection function. The technology behind it is very high. For users, the operation is simple, the detection time is shorter, the misjudgment rate is lower, and it does not increase the difficulty of production line workers. Therefore, this embodiment aims to provide a large model training method for industrial product defect classification and an automated industrial product defect detection method based on the large model to achieve the purpose of automated defect detection.

[0023] Embodiment 1: Figure 1 ,A large model training method for industrial product defect classification ,suitable for defect detection, includes the following steps; S1. Obtain a grayscale image of the product; industrial products refer to products with a shell produced on a production line, such as refrigerators, washing machines, etc.

[0024] Specifically, a camera is used to capture product images and generate grayscale images. The camera may be a front camera. Preferably, a line scan camera is used to capture images of industrial product shells. Line scan cameras can capture images in a wide range of sizes and are suitable for capturing images of industrial products of different sizes. Line scan cameras are also more cost-effective. Preferably, lighting is used when capturing product images to improve the quality of grayscale images and lay the foundation for accurate defect detection.

[0025] The purpose of generating a grayscale image is: the grayscale image uses the grayscale value to evaluate the color depth of the image. When the grayscale value is the minimum value, the image is black; when the grayscale value is the maximum value, the image is white. By adjusting the grayscale value, the image gain processing can be achieved. Compared with color images, the image processing only involves the grayscale value dimension, and does not involve multi-dimensional image parameters. This improves the image processing efficiency and accuracy of the algorithm or formula in the subsequent steps, plays a key role in the rapid detection of defects, and reduces the cost of defect detection. The size of the grayscale image needs to cover the appearance size of the industrial product so that the plate image of the industrial product can be fully captured.

[0026] S2. Remove the background area of ​​the grayscale image and extract the image of the main area of ​​the product. Preferably, the large model Yolov7 target detection algorithm is used to extract the image of the main area of ​​the product, but it is not limited to this. Using the large model Yolov7 target detection algorithm to extract the image domain of the main area of ​​the product is an existing technology and is not described in detail here. The background area of ​​the grayscale image has nothing to do with the defects of the product. Removing the background area can reduce the interference with defect detection, reduce the image processing tasks of subsequent algorithms, and further improve the image processing efficiency and accuracy.

[0027] S3. Analyze the characteristics of the image of the main area of ​​the product to obtain the grayscale mean and grayscale deviation value of the image. Grayscale deviation value The image of the main area of ​​the product is subjected to gain processing to enhance the image contrast; preferably, after the image is subjected to gain processing, the noise in the image is removed by median filtering to reduce interference with the image processing algorithm and further improve the accuracy and efficiency of image processing.

[0028] The grayscale mean and grayscale deviation calculation steps of the image are as follows; the main area of ​​the industrial product is set as , For Region For each pixel in, the corresponding gray value is , For Region All points on ( = | |), the characteristics are defined as follows:

[0029]

[0030] Through and Determine the gain factor ;

[0031] In the formula, Represent the spatial domain position parameters of each pixel point, Represents the gray value of the pixel after gain processing. As can be seen from the formula, image characteristic analysis only processes the gray value dimension parameters, and compared with color image processing, the analysis efficiency is high.

[0032] It is important to note that and Determine the gain factor The way is: when and If the image is too small, the image of the product will be judged to be black; and When it is too large, the image of the product is judged to be white, and the gain coefficient The purpose of introducing is to enhance the contrast of the image. Different models of products have different colors. Determine a suitable gain factor based on the color of the product. , for example, the product color is black, and Too small, gain factor The image grayscale value will be increased to improve the contrast; the product color is white, and Too large, gain factor The grayscale value of the image will be reduced to improve the contrast. Figure 3 The comparison chart before and after image gain processing is shown. Figure 3 3a in the figure is the image before gain processing. Figure 3 3b in the figure is the image after gain processing. Figure 3 The contrast of image 3b is obviously higher than Figure 3 3a in the optimal gain factor It needs to be determined through experiments or debugging to obtain the best image contrast to facilitate the detection of product defects.

[0033] S4, performing Fourier analysis on the image to convert the spatial domain information of the image into frequency domain information, creating a Gaussian filter, analyzing and screening the frequency domain information of the image, and screening out the high-frequency information of the image; Perform Fourier analysis on the image, and the conversion formula is as follows:

[0034] In the formula, M and N represent the rows and columns of the two-dimensional image respectively, and F(u, v) is the Fourier transform complex function, which represents the characteristics of the image in the frequency domain. Among them, u and v are variables in the frequency domain, representing the frequency components in the horizontal and vertical directions, and f(x, y) is the input function of the image space domain.

[0035] In digital image processing, an image is usually represented as a two-dimensional array or matrix, where x and y are variables in the spatial domain, representing the pixel locations in the image. :This is a complex exponential function, where j is the imaginary unit. This function is multiplied by the image input function during the integration process, which plays the role of converting the image from the spatial domain to the frequency domain. ux and vy represent the product of the u and v coordinates in the frequency domain and the x and y coordinates in the spatial domain, respectively. u and v are coordinates in the frequency domain, while x and y are coordinates in the spatial domain. Specifically, ux represents the product of the frequency component in the horizontal direction and the spatial position x, while vy represents the product of the frequency component in the vertical direction and the spatial position y. These products are multiplied by -j2π in the complex exponential function, which together determine which frequency component the pixel at each spatial position is associated with. In this conversion process, the spatial position (x, y) of each pixel is associated with a series of frequency components (u, v), and ux and vy are the key parameters to describe this association. The high-frequency information of the image corresponds to the part where the grayscale value changes violently, such as edges, contours, and defects; the low-frequency information of the image corresponds to the part where the grayscale value changes little or changes relatively smoothly, such as large surface structures, protruding surfaces, etc.

[0036] S5. Convert the high-frequency information of the image into spatial domain information, locate all target areas corresponding to the high-frequency information and obtain the area values ​​of all target areas, and screen out target areas larger than the area threshold by comparing with the preset area threshold; in a specific implementation, the value range of the area threshold is at least 200 pixels, and the area threshold is selected according to different product models. Areas below 200 pixels are scratches that are difficult to detect with the naked eye, and such scratches may not be detected; Figure 4 , generate a pre-selection box, and crop the image to be inspected containing the target area from the image; if there are 100 target areas after screening, then generate a pre-selection box around the 100 target areas, and then crop out 100 images to be inspected.

[0037] The conversion formula for converting the high-frequency information of the image into spatial domain information is as follows:

[0038] In the formula, M and N represent the rows and columns of the two-dimensional image respectively. is a Fourier transform complex function, which represents the characteristics of the image in the spatial domain. x and y are variables in the spatial domain, representing the spatial domain position parameters of each pixel. is the input function of the image frequency domain, where u and v are frequency domain variables, representing the frequency component parameters in the horizontal and vertical directions. is a complex exponential function, where j is an imaginary unit. This function is multiplied by the input function of the image frequency domain during the integration process, which plays the role of converting the image from the frequency domain to the spatial domain.

[0039] S6. Manually screen the images to be inspected, establish defect image datasets and contour edge image datasets; use the defect image datasets and contour edge image datasets to train the classification model network. The classification model network uses the existing Resnet50 classification model network, but is not limited thereto. The image to be inspected refers to the image area cropped by the pre-selected box, which contains the target area. The images to be inspected are manually classified into defect images and contour edge images. The contour edge images refer to the contour images and edge images of the product.

[0040] The method of this embodiment removes the background of the acquired product grayscale image, and then performs characteristic analysis. Image gain processing is performed based on the analysis results to improve the contrast, so that the grayscale values ​​of the defect, contour and edge areas change greatly, while the grayscale values ​​of other areas change very little or very slowly. According to the characteristics of the grayscale value change, Fourier analysis is performed on the image to obtain the frequency domain information of the image, filter out the high-frequency information, and quickly locate the target area where defects may exist through spatial domain conversion of the high-frequency information. The target area is further threshold-screened, and the defect image and contour edge image can be accurately obtained. After manual screening, the training data set is accurately established. Since the number of defect samples in batch products is low and cannot be collected on a large scale, the use of a classification model network for training can reduce the requirements for the number of samples, reduce the difficulty of training, and ensure the accuracy of classification. Compared with the large target detection model, the fast convergence property of the classification model can be used to complete the rapid iteration of the product and meet the appearance detection needs.

[0041] Embodiment 2: Figure 2 As shown, the large-model-based automated industrial product defect detection method obtains the trained classification model network based on the large-model training method for industrial product defect classification in Example 1, and then performs the following steps: S1. Obtain a grayscale image of the product; preferably, a line scan camera is used for acquisition; S2. Remove the background area of ​​the grayscale image and extract the image of the main area of ​​the product. Preferably, the large model Yolov7 target detection algorithm is used to extract the image of the main area of ​​the product, but it is not limited thereto; S3. Perform characteristic analysis on the image of the main area of ​​the product to obtain the grayscale mean and grayscale deviation value of the image, and perform gain processing on the image of the main area of ​​the product according to the grayscale mean and grayscale deviation value to enhance the image contrast; preferably, remove the noise in the image by median filtering; the grayscale mean and grayscale deviation value calculation steps of the image are as follows; the main area of ​​the industrial product is set to , For Region For each pixel in, the corresponding gray value is , For Region All points on ( = | |), the characteristics are defined as follows:

[0042]

[0043] Through and Determine the gain factor ;

[0044] In the formula, Represent the spatial domain position parameters of each pixel point, Represents the gray value of the pixel after gain processing.

[0045] S4, performing Fourier analysis on the image to convert the spatial domain information of the image into frequency domain information, creating a Gaussian filter, analyzing and screening the frequency domain information of the image, and screening out the high-frequency information of the image; Perform Fourier analysis on the image, and the conversion formula is as follows:

[0046] In the formula, M and N represent the rows and columns of the two-dimensional image respectively. is a Fourier transform complex function, which represents the characteristics of the image in the frequency domain, where u and v are variables in the frequency domain, representing the frequency component parameters in the horizontal and vertical directions, f(x,y) is the input function of the image space domain, and x and y are variables in the space domain, representing the position parameters of each pixel in the space domain. For more specific analysis, refer to Implementation 1. The high-frequency information of the image corresponds to the part where the gray value changes drastically, such as edges, contours, and defects; the low-frequency information of the image corresponds to the part where the gray value changes little or changes relatively smoothly, such as large surface structures, protruding surfaces, etc.

[0047] S5, converting the high-frequency information of the image into spatial domain information, locating all target areas corresponding to the high-frequency information and obtaining the area values ​​of all target areas, and screening out target areas larger than the area threshold by comparing with the preset area threshold; Figure 4 , generate a pre-selected box and cut out the image to be inspected containing the target area from the image; The conversion formula for converting the high-frequency information of the image into spatial domain information is as follows:

[0048] In the formula, M and N represent the rows and columns of the two-dimensional image respectively. is a Fourier transform complex function, which represents the characteristics of the image in the spatial domain. x and y are variables in the spatial domain, representing the spatial domain position parameters of each pixel. is the input function of the image frequency domain, where u and v are variables in the frequency domain, representing the frequency component parameters in the horizontal and vertical directions. For more specific analysis, refer to Implementation 1. S6. The trained classification model network is used to analyze and classify the image to be inspected to filter out defective images and achieve the purpose of defect detection. The classification model network adopts the existing Resnet50 classification model network, but is not limited thereto.

[0049] Preferably, the method further includes the following step: S7, storing the classified images into a defect image dataset and a contour edge image dataset respectively, so as to facilitate further iterative training of the classification model.

[0050] Preferably, in step S5, the high-frequency information of the image is converted into spatial domain information, all target areas corresponding to the high-frequency information are located and the area values ​​of all target areas are obtained, and the target areas larger than the area threshold are screened out by comparison with the preset area threshold; the area values ​​of all the screened target areas are averaged, and the target areas with areas smaller than the average value are screened out again; a pre-selection box is generated, and the image to be inspected containing the target area finally screened out is cropped from the image. For example, if 405 target areas are screened out by the area threshold, and then the areas of the 405 target areas are averaged, and then 118 target areas with areas smaller than the average value are screened out, and then pre-selection boxes are generated around the 118 target areas, and 118 images to be inspected containing the target areas are cropped out from the image for classification.

[0051] The target area may be a contour edge area or a defect area. Generally, the defects of industrial products are relatively small. Since the area of ​​the defect area is much smaller than that of the contour edge area, the area of ​​the contour edge area is larger than the average value, while the area of ​​the defect area is smaller than the average value. This method can be used to screen out large contour edge areas and screen out small defect areas and contour edge areas, further reducing the data processed by the large model and improving the efficiency and accuracy of detection.

[0052] The method of this embodiment removes the background of the acquired grayscale image of the product, and then performs characteristic analysis. Image gain processing is performed based on the analysis results to improve the contrast, so that the grayscale values ​​of the defect, contour and edge areas change greatly, while the grayscale values ​​of other areas change very little or very gently. According to the characteristics of the grayscale value change, Fourier analysis is performed on the image to obtain the frequency domain information of the image, filter out the high-frequency information, and quickly locate the target area where defects may exist through spatial domain conversion of the high-frequency information, and further threshold screening is performed on the target area, so that the defect image and contour edge image can be accurately obtained, and the Resnet50 classification model network is used for rapid classification to filter out the defective image. The method of this embodiment processes grayscale images, has low requirements on algorithm complexity, and each step is screened layer by layer. The data processed by the algorithm is small and precise. The target area is quickly located by mutual conversion between the image spatial domain and the frequency domain, and precise analysis is performed in combination with the classification large model, so that product defects can be detected quickly and accurately with low cost, production efficiency and production control quality can be improved, manual errors in operation can be reduced, and automated production can be realized.

[0053] According to the present embodiment, an electronic device, a readable storage medium and a computer program product are also provided. The electronic device is intended to represent various forms of digital computers and is not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0054] An electronic device includes: at least one processor, and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the large model-based automated industrial product defect detection method. The computer instructions are computer programs that implement a certain function, and the program code for implementing the large model-based automated industrial product defect detection method can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the program code is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or completely on a remote machine or server. The processor can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit to a random access memory (RAM). The processor, ROM, and RAM are connected to each other through a bus.

[0055] In this embodiment, a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the large model-based automated industrial product defect detection method. A machine-readable medium may be a tangible medium that may contain or store a program for use by an instruction execution system, device, or apparatus or used in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.

[0056] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present invention can be achieved, and this document does not limit this.

[0057] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A large model training method for industrial product defect classification, characterized in that: The steps include: S1, obtain the grayscale image of the product; S2, discard the background area of ​​the grayscale image and extract the image of the main area of ​​the product; S3, performing characteristic analysis on the image of the main area of ​​the product to obtain the grayscale mean and grayscale deviation value of the image, and performing gain processing on the image of the main area of ​​the product according to the grayscale mean and grayscale deviation value to enhance the image contrast; S4, performing Fourier analysis on the image to convert the spatial domain information of the image into frequency domain information, creating a Gaussian filter, analyzing and screening the frequency domain information of the image, and screening out the high-frequency information of the image; S5, converting the high-frequency information of the image into spatial domain information, locating all target areas corresponding to the high-frequency information and obtaining the area values ​​of all target areas, and screening out target areas larger than the area threshold by comparing with a preset area threshold; generating a pre-selection box, and cutting out the image to be inspected containing the target area from the image; S6. Establish a defect image dataset and a contour edge image dataset by manually screening the images to be inspected; and train the classification model network using the defect image dataset and the contour edge image dataset.

2. The method for training a large model for industrial product defect classification according to claim 1, characterized in that: In step S3, the characteristics of the product main area image are analyzed to obtain the grayscale mean and grayscale deviation value of the image, and the product main area image is gain processed according to the grayscale mean and grayscale deviation value, and the noise in the image is removed by median filtering.

3. The method for training a large model for industrial product defect classification according to claim 2, characterized in that: In step S3, the characteristics of the product main area image are analyzed to obtain the grayscale mean and grayscale deviation value of the image. The steps are as follows: the main area of ​​the industrial product is set to , For Region For each pixel in, the corresponding gray value is , For Region All points on ,The characteristics are defined as follows: ; ; Through and Analysis, determination of gain factor ; ; In the formula, Represent the spatial domain position parameters of each pixel point, Represents the gray value of the pixel after gain processing.

4. The method for training a large model for industrial product defect classification according to claim 1, characterized in that: In step S4, Fourier analysis is performed on the image, and the conversion formula is as follows: ; In the formula, M and N represent the rows and columns of the two-dimensional image respectively. is the Fourier transform complex function, which represents the characteristics of the image in the frequency domain, where u and v are variables in the frequency domain, representing the frequency component parameters in the horizontal and vertical directions, f(x,y) is the input function of the image in the spatial domain, and x and y are variables in the spatial domain, representing the position parameters of each pixel in the spatial domain.

5. The method for training a large model for industrial product defect classification according to claim 1, characterized in that: In step S5, the high-frequency information of the image is converted into spatial domain information. The conversion formula is as follows: ; In the formula, M and N represent the rows and columns of the two-dimensional image respectively. is a Fourier transform complex function, which represents the characteristics of the image in the spatial domain. x and y are variables in the spatial domain, representing the spatial domain position parameters of each pixel. is the input function of the image frequency domain, where u and v are frequency domain variables, representing the frequency component parameters in the horizontal and vertical directions.

6. An automated industrial product defect detection method based on a large model, characterized in that: Based on any one of the industrial product defect classification large model training methods described in claims 1-5, a trained classification model network is obtained, and then the following steps are performed: S1, obtain the grayscale image of the product; S2, discard the background area of ​​the grayscale image and extract the image of the main area of ​​the product; S3, performing characteristic analysis on the image of the main area of ​​the product to obtain the grayscale mean and grayscale deviation value of the image, and performing gain processing on the image of the main area of ​​the product according to the grayscale mean and grayscale deviation value to enhance the image contrast; S4, performing Fourier analysis on the image to convert the spatial domain information of the image into frequency domain information, creating a Gaussian filter, analyzing and screening the frequency domain information of the image, and screening out the high-frequency information of the image; S5, converting the high-frequency information of the image into spatial domain information, locating all target areas corresponding to the high-frequency information and obtaining the area values ​​of all target areas, and screening out target areas larger than the area threshold by comparing with a preset area threshold; generating a pre-selection box, and cutting out the image to be inspected containing the target area from the image; S6. Analyze and classify the image to be inspected through the trained classification model network.

7. The large model-based automated industrial product defect detection method according to claim 6, characterized in that: The method also includes the following steps: S7, storing the classified images into a defect image dataset and a contour edge image dataset respectively.

8. The large model-based automated industrial product defect detection method according to claim 6, characterized in that: In step S3, the characteristics of the product main area image are analyzed to obtain the grayscale mean and grayscale deviation value of the image, and the product main area image is gain processed according to the grayscale mean and grayscale deviation value, and the noise in the image is removed by median filtering.

9. The large model-based automated industrial product defect detection method according to claim 6, characterized in that: In step S5, the high-frequency information of the image is converted into spatial domain information, all target areas corresponding to the high-frequency information are located and the area values ​​of all target areas are obtained, and the target areas larger than the area threshold are screened out by comparing with the preset area threshold; The area values ​​of the filtered target areas are averaged, and then the target areas with areas smaller than the average are filtered out; a pre-selection box is generated, and the image to be inspected containing the finally filtered target area is cropped out from the image.

10. The large model-based automated industrial product defect detection method according to claim 6, characterized in that: In step S1, a camera is used to capture an image of the industrial product to generate a grayscale image.

11. An electronic device, characterized in that include: At least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the large model-based automated industrial product defect detection method described in any one of claims 6-9.

12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the large model-based automated industrial product defect detection method described in any one of claims 6 to 9.

Citation Information

Patent Citations

  • Printed circuit board tiny defect detection method based on YOLO network

    CN117132581A

  • Titanium metal plate defect image classification method

    CN117788467A

  • A cloth defect detection method based on Fourier transform and image morphology

    CN109934802A

  • Printed matter defect detection method combining machine vision and deep learning technology

    CN114299323A

  • Magnetic shoe surface defect detection method

    CN115841447A