Defect classification identification method and device, storage medium and electronic equipment

By magnifying and scaling the preliminary defect characterization area at the defect location, and optimizing the parameters using a random search algorithm, the problems of low accuracy and efficiency in existing defect classification and identification systems are solved, achieving more accurate defect identification.

CN115170512BActive Publication Date: 2026-04-21SUZHOU MEGAROBO TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUZHOU MEGAROBO TECH CO LTD
Filing Date
2022-07-06
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing defect classification and recognition systems suffer from poor classification and recognition performance due to the diverse characteristics of defects and the small amount of learning data. Furthermore, inaccurate detection locations reduce the accuracy of classification and recognition.

Method used

By performing preliminary defect identification on the image to be identified, the preliminary defect characterization region at the defect location is obtained, and the region is enlarged based on preset magnification parameters. The trained defect classification model is then used for classification and identification. The magnification and scaling parameters are optimized by combining a random search algorithm to improve the accuracy of defect feature extraction.

Benefits of technology

It effectively improves the accuracy of defect identification, meets practical needs, avoids the problem of defects not being fully covered by the ROI area, and improves identification efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170512B_ABST
    Figure CN115170512B_ABST
Patent Text Reader

Abstract

This invention discloses a defect classification and identification method, a classification and identification device, and a storage medium, relating to the field of computer processing technology. The classification and identification method includes the following reasoning steps: performing preliminary defect identification on the image to be identified to obtain a preliminary defect representation region at each defect location; expanding the preliminary defect representation region at each defect location based on a preset magnification parameter to obtain an expanded representation region; determining a region image corresponding to the expanded representation region at each defect location in the image to be identified; and classifying and identifying the region image based on a trained defect classification model to obtain the defect classification and identification result. By further optimizing and extracting the defect location region before defect identification, defect features can be obtained more comprehensively and accurately, thereby improving the accuracy of defect classification and identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer processing technology, and more specifically to a defect classification and identification method, a defect classification and identification device, a computer-readable storage medium, and an electronic device. Background Technology

[0002] With the continuous development of technology, people have higher and higher requirements for the products produced and manufactured. Correspondingly, processing plants also have higher and higher requirements for the product processing and manufacturing process.

[0003] In traditional product processing and manufacturing, defects in the processed products are often identified and handled manually. However, traditional manual identification methods suffer from low identification efficiency, high labor costs, and subjective bias, thus failing to meet actual needs.

[0004] To address the aforementioned technical issues, technicians employed image recognition to detect defects in the manufactured products. However, in practical applications, they discovered that existing defect classification and identification systems suffer from at least the following technical problems:

[0005] Due to the diverse characteristics of defects and the relatively small amount of learning data, the existing defect classification and recognition systems have poor classification and recognition performance and cannot meet practical needs. In addition, the inaccurate detection location of defects during the detection process, and the classification based on the region of interest obtained from the inaccurate detection location coordinates, will further reduce the accuracy of classification and recognition. Summary of the Invention

[0006] In order to overcome the above-mentioned technical problems in the prior art, the present invention provides a defect classification and identification method. By further optimizing and extracting the area where the defect is located before identifying the defect, the defect features can be obtained more comprehensively and accurately, thereby improving the accuracy of defect classification and identification.

[0007] To achieve the above objectives, embodiments of the present invention provide a defect classification and identification method, which includes the following reasoning steps: performing preliminary defect identification on the image to be identified to obtain a preliminary defect representation region at each defect location; expanding the preliminary defect representation region at each defect location based on a preset magnification parameter to obtain an expanded representation region; determining a region image corresponding to the expanded representation region at each defect location in the image to be identified; and classifying and identifying the region image based on a trained defect classification model to obtain a defect classification and identification result.

[0008] Preferably, the method further includes the following training steps: acquiring training sample images, wherein defect locations are marked on the training sample images and referred to as training defect locations; acquiring a preset magnification parameter range; determining the corresponding current magnification parameter within the preset magnification parameter range based on a random search algorithm, so as to expand the training defect representation region at the training defect location in the training sample image according to the current magnification parameter, thereby obtaining the expanded training representation region; determining a training region image corresponding to the expanded training representation region at each training defect location in the training sample image; training a preset defect classification model according to the training region image and known defect category labels until the training result meets the preset training requirements, thereby obtaining the trained defect classification model; and using the current magnification parameter as the preset magnification parameter.

[0009] Preferably, the inference step further includes: after obtaining the region image, scaling the resolution of the region image according to a preset scaling parameter to obtain a scaled region image; classifying and recognizing the scaled region image based on the trained defect classification model to obtain the defect classification and recognition result.

[0010] Preferably, the method further includes a training step: the training step includes: acquiring a training sample image, wherein defect locations are marked on the training sample image and referred to as training defect locations; acquiring a preset scaling range; expanding the training defect representation region at the training defect location in the training sample image according to the preset scaling parameter to obtain the expanded training representation region; determining a training region image corresponding to the expanded training representation region at each training defect location in the training sample image; acquiring the resolution of the training region image; determining a current scaling parameter within the preset scaling range based on the random search algorithm, and scaling the resolution of the training region image according to the current scaling parameter to obtain a training scaled region image; training a preset defect classification model according to the training scaled region image and known defect category labels until the training result meets the preset training requirements to obtain the trained defect classification model; and using the current scaling parameter as the preset scaling parameter.

[0011] Preferably, the preset scaling parameters include: multiple resolution thresholds and scaling parameters corresponding to each resolution threshold. The inference step further includes: comparing the resolution of the current region image with the multiple resolution thresholds to determine the current resolution threshold and the corresponding current scaling parameter of the current region image, and scaling the resolution of the current region image based on the current scaling parameter to obtain a scaled region image.

[0012] Preferably, the method further includes a training step, which includes: acquiring a training sample image, wherein defect locations are marked on the training sample image and referred to as training defect locations; acquiring a preset scaling range; the preset scaling range includes: multiple resolution threshold ranges and multiple scaling parameter ranges corresponding one-to-one with each resolution threshold range; expanding the training defect representation region at the training defect location of the training sample image according to the preset scaling parameters to obtain the expanded training representation region; determining a training region image corresponding to the expanded training representation region at each training defect location in the training sample image; acquiring the resolution of the training region image; determining the current training resolution threshold and the current training scaling parameter based on the random search algorithm within the resolution threshold range and the corresponding scaling parameter range of the training region image resolution; scaling the resolution of the training region image according to the current training resolution threshold and the current training scaling parameter to obtain a training scaled region image; training a preset defect classification model according to the training scaled region image and known defect category labels until the training result meets the preset training requirements to obtain the trained defect classification model; and generating preset scaling parameters based on the current training resolution threshold and the current training scaling parameter.

[0013] Preferably, the reasoning step further includes: before classifying and recognizing the region image, filling the region image according to a preset filling size parameter to obtain a region-filled image; classifying and recognizing the region-filled image according to a trained defect classification model to obtain the defect classification and recognition result.

[0014] Preferably, the method further includes a training step, which includes: acquiring a training sample image, wherein defect locations are marked on the training sample image and referred to as training defect locations; enlarging the training defect representation region at the training defect location in the training sample image according to the preset magnification parameter to obtain the enlarged training representation region; determining a training region image corresponding to the enlarged training representation region at each training defect location in the training sample image; acquiring a preset fill size parameter range; determining the corresponding current fill size parameter within the preset fill size parameter range based on a random search algorithm, and filling the training region image according to the current fill size parameter to obtain a training region filled image; training a preset defect classification model according to the training region filled image and known defect category labels until the training result meets the preset training requirements to obtain the trained defect classification model; and using the current fill size parameter as the preset fill size parameter.

[0015] Preferably, the preliminary defect identification of the image to be identified to obtain a preliminary defect representation region at each defect location includes: performing preliminary defect identification on the image to be identified based on a defect detection model to obtain the location information of the defects in the image to be identified; and determining the preliminary defect representation region based on the location information of the defects.

[0016] Accordingly, this invention also provides a defect classification and recognition device, comprising: a preliminary recognition unit for performing preliminary defect recognition on an image to be recognized, obtaining a preliminary defect representation region at each defect location; an enlargement unit for enlarging the preliminary defect representation region at each defect location based on a preset enlargement parameter, obtaining an enlarged representation region; a determination unit for determining a region image corresponding to the enlarged representation region at each defect location in the image to be recognized; and a classification and recognition unit for classifying and recognizing the region image based on a trained defect classification model, obtaining a defect classification and recognition result.

[0017] Preferably, the defect classification and recognition device further includes: a scaling unit, which is used to scale the resolution of the region image according to a preset scaling parameter after obtaining the region image, to obtain a scaled region image; and the classification and recognition unit is used to classify and recognize the scaled region image based on the trained defect classification model to obtain the defect classification and recognition result.

[0018] Preferably, the preset scaling parameters include: multiple resolution thresholds and scaling parameters corresponding to each resolution threshold. The scaling unit is used to compare the resolution of the current region image with the multiple resolution thresholds, determine the current resolution threshold and the corresponding current scaling parameter of the current region image, and scale the resolution of the current region image based on the current scaling parameter to obtain a scaled region image.

[0019] On the other hand, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the above embodiments of the present invention.

[0020] On the other hand, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the defect classification and identification method provided in embodiments of the present invention.

[0021] The present invention has at least the following technical effects through the technical solution provided by the present invention:

[0022] By improving existing defect identification methods, the preliminary defect representation area (ROI) at the defect location is further magnified before classifying the acquired image to be identified. This avoids the ROI not completely covering the defect in the image to be identified, thus enabling a more accurate determination of the defect location and the image area it covers. Then, a pre-trained model is used to classify and identify the image corresponding to the defect (the image covered by the ROI), thereby effectively improving the accuracy of defect identification and meeting practical needs.

[0023] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0024] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:

[0025] Figure 1 This is a flowchart illustrating the specific implementation of the defect classification and identification method provided in this embodiment of the invention.

[0026] Figure 2 This is a schematic diagram of the defect classification and identification device provided in the embodiment of the present invention. Detailed Implementation

[0027] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.

[0028] In this invention, the terms "system" and "network" are used interchangeably. "Multiple" refers to two or more; therefore, in this invention, "multiple" can also be understood as "at least two." "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / ", unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, it should be understood that in the description of this invention, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.

[0029] Please see Figure 1 This invention provides a defect classification and identification method, characterized in that the defect classification and identification method includes the following reasoning steps:

[0030] S10) Perform preliminary defect identification on the image to be identified to obtain the preliminary defect characterization region at each defect location;

[0031] S20) Expand the preliminary defect characterization region at each defect location based on preset amplification parameters to obtain the expanded characterization region;

[0032] S30) Determine a region image corresponding to the enlarged characterization region at each defect location in the image to be identified;

[0033] S40) Based on the trained defect classification model, classify and identify the region image to obtain the defect classification and identification results.

[0034] In one possible implementation, preliminary defect identification is first performed on the image to be identified. The image to be identified can be an image taken of the target to be identified. A pre-trained defect detection model can be used to perform preliminary defect identification on the image to be identified and obtain a preliminary defect representation region at each defect location of the target to be identified. This preliminary defect representation region is used to represent the location and size range of the defect. Specifically, a defect detection model based on algorithms such as YOLOv, YOLOv, and Faster R-CNN can be used to detect the defect location to obtain the ROI (region of interest) for the defect location, which is also referred to as the defect representation region in this paper. Since in practical applications, the defect category cannot be accurately identified by a pre-trained defect detection model alone, further optimization of the identification method is required.

[0035] In this embodiment, the preliminary defect characterization area at each defect location is expanded based on a preset magnification parameter. This preset magnification parameter can be determined in advance through training. Of course, in practical applications, a preset magnification parameter can be determined in advance for each target to be identified and directly called during the defect identification process.

[0036] For example, in an embodiment of the present invention, the method further includes the following training steps: acquiring a training sample image, wherein the training sample image is marked with defect locations, referred to as training defect locations; acquiring a preset magnification parameter range; determining the corresponding current magnification parameter within the preset magnification parameter range based on a random search algorithm, so as to expand the training defect representation region at the training defect location of the training sample image according to the current magnification parameter, thereby obtaining an expanded training representation region; determining a training region image corresponding to the expanded training representation region at each training defect location in the training sample image; training a preset defect classification model according to the training region image and the known defect category label, until the training result meets the preset training requirements, thereby obtaining a trained defect classification model; and using the current magnification parameter as the preset magnification parameter.

[0037] In one possible implementation, a training sample image is first acquired, and defect locations are marked on the training sample image, which can be referred to as training defect locations. At this time, a preset magnification parameter range is obtained. For example, in this embodiment, the preset magnification range can be [1.0, 3.0]. Of course, the technician can adjust the preset magnification range according to actual needs. Then, based on a random search algorithm, the corresponding current magnification parameter is determined within the preset magnification range. For example, in one embodiment, the current magnification parameter is determined to be 1.6, that is, when the above-mentioned training defect representation area is magnified according to the current magnification parameter, it is magnified to 1.6 times the original size (the length and width are magnified proportionally), and the corresponding magnified training representation area is obtained. Then, at each of the training defect locations in the training sample image, a training area image corresponding to the magnified training representation area is further determined. Then, the training area image is input into a preset defect classification model, and the preset defect classification model is trained in combination with the known defect category labels until the training result meets the preset training requirements.

[0038] Specifically, the training result meeting the preset training requirements can be achieved as follows: In the specific training process, based on the defect ROI coordinates output by the defect classification model for the above-mentioned region image, combined with the pre-defined label data of the sample images (including the location coordinates of the defect and the category of the defect), the crossover ratio (CRR) threshold can be preset to 0.5. Then, based on the actual CRR between the defect ROI coordinates output by the defect classification model and the label data, the category labels with an actual CRR greater than the CRR threshold of 0.5 are taken as the category labels of the defect ROI. Then, the accuracy is calculated based on the identified defect label data and the pre-defined label data of the sample images. If the accuracy meets the requirements, the training result meets the training requirements.

[0039] Furthermore, to improve the recognition accuracy of the defect classification model, the training sample images are divided into a training set and a validation set. After the defect classification model is generated, the validation set is used as input to the defect classification model for recognition to determine the recognition accuracy of the defect classification model. If its accuracy cannot meet the actual accuracy requirement, the defect classification model is further optimized and trained until its recognition accuracy meets the actual accuracy requirement, and then the training is considered complete.

[0040] After generating the trained defect classification model and the corresponding preset magnification parameters, the preliminary defect representation area (ROI) at each defect location is first enlarged using the preset magnification parameters to obtain the enlarged representation area (ROI). This allows the ROI to cover a larger image area, avoiding the situation where the ROI corresponding to the defect does not completely cover the defect, thereby improving the accuracy of subsequent defect identification.

[0041] Furthermore, in this embodiment of the invention, by employing a random search algorithm to predetermine the optimal magnification factor for the initial defect characterization area, direct magnification processing can be performed during subsequent identification, which can effectively improve the accuracy of magnification processing and effectively reduce the amount of computation during on-site identification, thereby improving identification efficiency.

[0042] After obtaining the enlarged representation area, the corresponding region image can be determined at each defect location, that is, the actual region image corresponding to each region can be determined. At this point, defect identification begins. However, in actual applications, since different defects have different sizes, the method of determining the region image by directly calling the preset magnification parameters may not be accurate. Therefore, in order to further improve the accuracy of defect image acquisition, the region image is further optimized.

[0043] In this embodiment of the invention, the inference step further includes: after obtaining the region image, scaling the resolution of the region image according to preset scaling parameters to obtain a scaled region image; classifying and recognizing the scaled region image based on a trained defect classification model to obtain the defect classification and recognition result. Using preset scaling parameters to scale the region image better preserves defect features and further improves the accuracy of defect recognition.

[0044] Further, preferably, a random search method is used to obtain the preset scaling parameters. Specifically, the training steps further include: acquiring training sample images, wherein defect locations are marked on the training sample images and referred to as training defect locations; acquiring a preset scaling range; expanding the training defect representation region at the training defect location in the training sample image according to the preset scaling parameters to obtain the expanded training representation region; determining a training region image corresponding to the expanded training representation region at each training defect location in the training sample image; acquiring the resolution of the training region image; determining the current scaling parameter within the preset scaling range based on a random search algorithm, and scaling the resolution of the training region image according to the current scaling parameter to obtain a training scaled region image; training a preset defect classification model according to the training scaled region image and known defect category labels until the training result meets the preset training requirements to obtain a trained defect classification model; and using the current scaling parameter as the preset scaling parameter.

[0045] Furthermore, in this embodiment of the invention, the preset scaling parameters include: multiple resolution thresholds and scaling parameters corresponding one-to-one with each resolution threshold. The inference step further includes: comparing the resolution of the current region image with the multiple resolution thresholds to determine the current resolution threshold and the corresponding current scaling parameter for the current region image; and scaling the resolution of the current region image based on the current scaling parameter to obtain a scaled region image. Using this method, scaling can be performed in stages according to the size of the region image, enabling the magnification of images covered by smaller ROIs and the reduction of images covered by larger ROIs, thereby better preserving defect features and further improving the accuracy of defect identification.

[0046] Further, preferably, the preset scaling parameters are obtained using a random search method. Specifically, the training step further includes: acquiring a training sample image, wherein defect locations are marked on the training sample image and referred to as training defect locations; acquiring a preset scaling range; the preset scaling range includes: multiple resolution threshold ranges and multiple scaling parameter ranges corresponding one-to-one with each resolution threshold range; expanding the training defect representation region at the training defect location of the training sample image according to the preset scaling parameters to obtain the expanded training representation region; determining a training region image corresponding to the expanded training representation region at each training defect location in the training sample image; acquiring the resolution of the training region image; determining the current training resolution threshold and the current training scaling parameter based on the resolution threshold range and the corresponding scaling parameter range of the resolution of the training region image using a random search algorithm; scaling the resolution of the training region image according to the current training resolution threshold and the current training scaling parameter to obtain a training scaled region image; training a preset defect classification model according to the training scaled region image and the known defect category labels until the training result meets the preset training requirements to obtain a trained defect classification model; and generating preset scaling parameters based on the current training resolution threshold and the current training scaling parameter.

[0047] In one possible implementation, after obtaining the training region image during the training of the defect classification model, a preset scaling range can be further obtained. For example, the preset scaling range may include multiple resolution threshold ranges and a scaling parameter range corresponding to each resolution threshold range (e.g., a range of [0.2, 10]). For example, in one embodiment, the preset scaling range is as follows: when the resolution of the training region image is less than 120*120, the corresponding scaling parameter range is scaling by 1.4 to 1.8 times according to the aspect ratio; when the resolution of the training region image is less than or equal to 220*220 and greater than or equal to 120*120, the corresponding scaling parameter range is scaling by 1.0 to 1.4 times according to the aspect ratio; when the resolution of the training region image is less than 360*360 and greater than 220*220, the corresponding scaling parameter range is scaling by 0.5 to 0.9 times according to the aspect ratio; when the resolution of the training region image is greater than or equal to 360*360, the resolution of the training region image is reduced to 320*320, that is, the scaling parameter range is a fixed resolution value.

[0048] After obtaining the preset scaling range, the resolution of the training region image is first obtained. Then, according to the random search algorithm, the current scaling parameter corresponding to the resolution of the training region image is determined within the preset scaling range. The resolution of the training region image is then scaled according to the current scaling parameter to obtain the training scaled region image.

[0049] Specifically, during training, based on the resolution threshold range and corresponding scaling parameter range of the training region image, a random search algorithm is used to determine the current training resolution threshold and scaling parameter within these two ranges. For example, if the resolution of the current training region image is 180*200, then according to the aforementioned preset scaling range, the resolution threshold range of this training region image can be determined to be less than 220*220 and greater than 120*120, with a corresponding scaling parameter range of 1.0 to 1.4. Therefore, a random search algorithm is used within these two ranges to ultimately determine that the current training resolution threshold that meets the training requirements is 220*220, and its corresponding current training scaling parameter is 1.2. During training, the current training resolution threshold and current training scaling parameter are searched within these two ranges, and the resolution of the training region image is scaled to obtain a scaled region image. During training, multiple current training resolution thresholds and current training scaling parameters can be determined within these two ranges using a random search algorithm. It is continuously judged whether these are the optimal resolution thresholds and scaling parameters until the obtained optimal resolution thresholds and optimal scaling parameters are obtained. Only then is it determined that the training result meets the preset training requirements. At this point, the trained model is used as the trained defect classification model, and preset scaling parameters are generated based on the aforementioned training resolution thresholds and current training scaling parameters. As can be seen from the above training process, the final generated preset scaling parameters include multiple resolution thresholds and corresponding scaling parameters, i.e., multiple resolution thresholds and corresponding scaling parameters are trained for use in the inference process. It should be noted that in this embodiment, a random search algorithm is used to search for both the resolution thresholds and their corresponding scaling parameters. However, the present invention is not limited to this; in practical applications, only one of them can be searched according to actual needs.

[0050] In the actual defect identification process, by directly calling the trained defect classification model and the aforementioned preset scaling parameters, after obtaining the regional image, the resolution of the regional image is obtained, and the resolution of the regional image is scaled according to the preset scaling parameters. For example, based on the resolution range of the regional image within the resolution threshold defined in the aforementioned preset scaling parameters, the scaling parameters that need to be scaled for the regional image are determined, and then the corresponding image scaling operation is performed according to the scaling parameters to obtain the scaled regional image. At this time, the scaled regional image is classified and identified based on the trained defect classification model to obtain the corresponding defect classification and identification results.

[0051] In this embodiment of the invention, by initially magnifying the defect area, the magnified area image is further scaled to better display the defect features and further improve the accuracy of defect identification.

[0052] In this embodiment of the invention, the inference step further includes: before classifying and recognizing the region image, filling the region image according to a preset fill size parameter to obtain a region-filled image; classifying and recognizing the region-filled image according to a trained defect classification model to obtain the defect classification and recognition result. "Filling" refers to filling the region image with a preset pixel value, such as a pixel value of 0, around it when the region image does not reach the preset fill size, so that each region image, after filling, becomes an image of the preset fill size, which is then input into the defect classification model for classification and recognition, to match the requirements of the defect classification model for the input image.

[0053] Preferably, in this embodiment, a random search algorithm is used to determine the preset fill size parameter. Specifically, the training step further includes: acquiring a training sample image, wherein defect locations are marked on the training sample image and referred to as training defect locations; enlarging the training defect representation region at the training defect location in the training sample image according to the preset magnification parameter to obtain the enlarged training representation region; determining a training region image corresponding to the enlarged training representation region at each training defect location in the training sample image; acquiring a preset fill size parameter range; determining the corresponding current fill size parameter within the preset fill size parameter range based on the random search algorithm, and filling the training region image according to the current fill size parameter to obtain a training region filled image; training a preset defect classification model according to the training region filled image and known defect category labels until the training result meets the preset training requirements to obtain the trained defect classification model; and using the current fill size parameter as the preset fill size parameter.

[0054] In one possible implementation, after obtaining the aforementioned region image, before classifying and recognizing the region image using a trained defect classification model, a preset fill size parameter for the region image is further obtained. This preset fill size parameter can be determined within a preset fill size parameter range using a random search algorithm during the training of the classification model. For example, during the training of the defect classification model, a preset fill size parameter range is further obtained, such as a range of [100*100, 400*400]. At this point, the corresponding current fill size is determined within this preset fill size parameter range based on a random search algorithm. Then, the training region image is filled to obtain a filled training region image. It is then determined whether this filled training region image is the optimal fill image. If not, other fill sizes are tried, and the determination continues to be made to determine if it is the optimal fill size. If the optimal fill size is obtained (e.g., 320*320), it is determined that the training result meets the preset training requirements. The current fill size is then used as the preset fill size parameter.

[0055] In the specific defect identification process, the preset fill size is directly called to fill the area image. Of course, those skilled in the art will know that, according to actual needs, the preset fill parameters can also be directly called to perform the fill operation after obtaining the above-mentioned scaled image. This should also fall within the protection scope of the present invention, and will not be elaborated further here.

[0056] After obtaining the image of the filled region, the image is classified and identified according to the trained defect classification model to obtain the defect classification and identification results.

[0057] In this embodiment of the invention, after performing multiple processing steps on the image to be identified, its format is further standardized, thereby better meeting the input requirements of the intelligent recognition model, matching the actual processing conditions of the intelligent recognition model, and improving the defect identification accuracy of the intelligent recognition model.

[0058] In this embodiment of the invention, the preliminary defect identification of the image to be identified, and the acquisition of a preliminary defect characterization region at each defect location, includes: performing preliminary defect identification on the image to be identified based on a defect detection model to obtain the location information of the defects in the image to be identified; and determining the preliminary defect characterization region based on the location information of the defects.

[0059] The defect classification and identification device provided in the embodiments of the present invention will be described below with reference to the accompanying drawings.

[0060] Please see Figure 2 Based on the same inventive concept, embodiments of the present invention provide a defect classification and recognition device, the device comprising: a preliminary recognition unit for performing preliminary defect recognition on an image to be recognized, obtaining a preliminary defect representation region at each defect location; an enlargement unit for enlarging the preliminary defect representation region at each defect location based on preset enlargement parameters, obtaining an enlarged representation region; a determination unit for determining a region image corresponding to the enlarged representation region at each defect location in the image to be recognized; and a classification and recognition unit for classifying and recognizing the region image based on a trained defect classification model, obtaining a defect classification and recognition result.

[0061] In this embodiment of the invention, the defect classification and recognition device further includes: a scaling unit, which is used to scale the resolution of the region image according to a preset scaling parameter after obtaining the region image, to obtain a scaled region image; and a classification and recognition unit, which is used to classify and recognize the scaled region image based on the trained defect classification model to obtain the defect classification and recognition result.

[0062] In this embodiment of the invention, the preset scaling parameters include: multiple resolution thresholds and scaling parameters corresponding to each resolution threshold. The scaling unit is used to compare the resolution of the current region image with the multiple resolution thresholds, determine the current resolution threshold and the corresponding current scaling parameter of the current region image, and scale the resolution of the current region image based on the current scaling parameter to obtain a scaled region image.

[0063] Furthermore, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in the embodiments of the present invention.

[0064] Furthermore, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the defect classification and identification method described in the embodiments of the present invention.

[0065] The optional embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details in the above embodiments. Within the scope of the technical concept of the embodiments of the present invention, various simple modifications can be made to the technical solutions of the embodiments of the present invention, and these simple modifications all fall within the protection scope of the embodiments of the present invention.

[0066] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the embodiments of the present invention will not describe the various possible combinations separately.

[0067] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a microcontroller, chip, or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0068] Furthermore, various different implementations of the present invention can be combined arbitrarily, as long as they do not violate the spirit of the present invention, they should also be regarded as the content disclosed in the present invention.

Claims

1. A defect classification and identification method, characterized in that, The classification and recognition method includes the following reasoning steps: Perform preliminary defect identification on the image to be identified to obtain the preliminary defect characterization region at each defect location; Acquire training sample images, on which defect locations are marked, referred to as training defect locations; Obtain the preset amplification parameter range; Based on a random search algorithm, the corresponding current magnification parameter is determined within the preset magnification parameter range, so as to expand the training defect representation region at the training defect location of the training sample image according to the current magnification parameter, and obtain the expanded training representation region. At each training defect location in the training sample image, a training region image corresponding to the expanded training representation region is determined; The preset defect classification model is trained based on the training region image and the known defect category labels until the training result meets the preset training requirements, so as to obtain the trained defect classification model. Use the current amplification parameter as the preset amplification parameter; The preliminary defect characterization region at each defect location is expanded based on preset amplification parameters to obtain the expanded characterization region. Determine the region image corresponding to the enlarged characterization region at each defect location in the image to be identified; The region image is classified and identified based on the trained defect classification model to obtain the defect classification and identification results.

2. The defect classification and identification method according to claim 1, characterized in that, The reasoning step also includes: After obtaining the region image, the resolution of the region image is scaled according to preset scaling parameters to obtain a scaled region image; The scaled area image is classified and identified based on the trained defect classification model to obtain the defect classification and identification results.

3. The defect classification and identification method according to claim 2, characterized in that, The preset scaling parameters include: multiple resolution thresholds and scaling parameters corresponding to each resolution threshold. The reasoning step also includes: comparing the resolution of the current region image with multiple resolution thresholds to determine the current resolution threshold and the corresponding current scaling parameter of the current region image, and scaling the resolution of the current region image based on the current scaling parameter to obtain a scaled region image.

4. The defect classification and identification method according to claim 1, characterized in that, The reasoning steps also include: Before classifying and recognizing the region image, the region image is filled according to a preset filling size parameter to obtain a region-filled image; The region-filled image is classified and identified based on the trained defect classification model to obtain the defect classification and identification results.

5. The defect classification and identification method according to claim 1, characterized in that, The preliminary defect identification of the image to be identified, obtaining the preliminary defect characterization region at each defect location, includes: Based on the defect detection model, preliminary defect identification is performed on the image to be identified to obtain the location information of the defects in the image to be identified. The preliminary defect characterization region is determined based on the location information of the defect.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the defect classification and identification method as described in any one of claims 1-5.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the defect classification and identification method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method for extracting BGA solder balls based on X-ray images

    CN107507182A

  • Carbon fiber composite material defect damage classification identification and quantitative analysis method and system

    CN113012123A