Image processing method and device, image processing device and defect detection equipment

By updating the identification model and using the loss function to identify defects on the image data, the problem of low accuracy in the identification of thin strip defects in silicon steel in the prior art is solved, and higher defect information accuracy and detection efficiency are achieved.

CN120219286APending Publication Date: 2025-06-27武汉钢铁有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510175923.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In the prior art, the accuracy of identifying silicon steel thin strip defects is low, resulting in equipment performance degradation and safety hazards.

Method used

By obtaining the preset identification model, establishing a loss function, updating the model to a more accurate identification model, and using the model to identify defects on the image data.

Benefits of technology

It improves the accuracy of defect information, enhances the defect recognition ability of the detected objects, and improves the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120219286A_ABST
    Figure CN120219286A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing method and device, an image processing device and defect detection equipment, and relates to the technical field of image processing. The image processing method comprises the following steps: acquiring a preset first identification model; establishing a loss function corresponding to the first identification model; updating the first recognition model into a second recognition model through the loss function; acquiring first image data of the to-be-detected object; and performing defect identification on the first image data through a second identification model to obtain defect information of the to-be-detected object. The defect identification accuracy of the to-be-detected object is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and particularly to an image processing method, apparatus, image processing apparatus, and defect detection device. Background Art

[0002] Silicon steel strip is a key material widely used in the power and electronics industries, and its quality directly affects the performance and service life of electrical equipment. During the production process, various defects such as cracks, scratches, and pits may appear on the surface of the silicon steel strip. These defects not only reduce the physical properties of the material but may also cause equipment failures and pose safety hazards. Therefore, it is of great practical significance to efficiently and accurately detect the surface defects of silicon steel strips.

[0003] At present, generally through image processing methods, the defects of silicon steel strips are identified, but existing image processing methods have technical problems such as low recognition accuracy. Summary of the Invention

[0004] Embodiments of this application provide an image processing method, apparatus, image processing apparatus, and defect detection device, which are used to solve technical problems such as low recognition accuracy in the prior art.

[0005] In the first aspect of the embodiments of this application, an image processing method is provided, including:

[0006] Obtain a preset first recognition model;

[0007] Establish a loss function corresponding to the first recognition model;

[0008] Update the first recognition model to a second recognition model through the loss function;

[0009] Obtain first image data of the object to be detected;

[0010] Perform defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected.

[0011] In the image processing method of this embodiment, defect recognition is performed on the first image data through the second recognition model to obtain defect information of the object to be detected, improving the information accuracy of the defect information and thus improving the defect accuracy of the object to be detected.

[0012] In the second aspect of the embodiments of this application, an image processing apparatus is provided, including:

[0013] An obtaining unit, configured to obtain a preset first recognition model;

[0014] A processing unit, configured to establish a loss function corresponding to the first recognition model;

[0015] The processing unit is further configured to update the first recognition model to a second recognition model through a loss function;

[0016] The acquisition unit is further configured to acquire first image data of the object to be detected;

[0017] The processing unit is further configured to perform defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected.

[0018] In a third aspect of the embodiments of the present application, another image processing apparatus is provided, including a processor and a memory. A computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the image processing method in any of the above embodiments are implemented. Therefore, the image processing apparatus has all the beneficial effects of the image processing method in any of the above embodiments, and will not be described in detail herein.

[0019] In a fourth aspect of the embodiments of the present application, a readable storage medium is proposed, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the image processing method in any of the above embodiments are implemented. Therefore, the readable storage medium has all the beneficial effects of the image processing method in any of the above embodiments, and will not be described in detail herein.

[0020] According to a fifth aspect of the present invention, a defect detection device is proposed, including: the image processing apparatus defined in the second aspect above, or the image processing apparatus defined in the third aspect above, and / or the readable storage medium defined in the fourth aspect above. Therefore, it has all the beneficial technical effects of the image processing apparatus defined in the second aspect above, or the image processing apparatus defined in the third aspect above, and / or the readable storage medium defined in the fourth aspect above, and will not be described in too much detail herein. Description of the Drawings

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 One of the flowcharts of the image processing method provided by the embodiments of the present application;

[0023] Figure 2 One of the schematic diagrams of the image processing method provided by the embodiments of the present application;

[0024] Figure 3 Another schematic diagram of the image processing method provided by the embodiments of the present application;

[0025] Figure 4 The third schematic diagram of the image processing method provided by the embodiments of the present application;

[0026] Figure 5 The fourth schematic diagram of the image processing method provided by the embodiments of the present application;

[0027] Figure 6 The fifth schematic diagram of the image processing method provided by the embodiments of the present application;

[0028] Figure 7 The sixth schematic diagram of the image processing method provided by the embodiments of the present application;

[0029] Figure 8 The seventh schematic diagram of the image processing method provided by the embodiments of the present application;

[0030] Figure 9 The second flowchart of the image processing method provided by the embodiments of the present application;

[0031] Figure 10 The functional module block diagram of the image processing device provided by the embodiments of the present application;

[0032] Figure 11 The structural block diagram of the image processing device provided by the embodiments of the present application. Detailed implementation manners

[0033] In order to better understand the technical solutions provided by the embodiments of this specification, the technical solutions of the embodiments of this specification will be described in detail below through the accompanying drawings and specific embodiments. It should be understood that the specific features in the embodiments of this specification and the embodiments are detailed descriptions of the technical solutions of the embodiments of this specification, rather than limitations on the technical solutions of this specification. Without conflict, the technical features in the embodiments of this specification and the embodiments can be combined with each other.

[0034] In this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including an..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element. The term "more than two" includes two or more than two.

[0035] In some embodiments, such as Figure 1 shown, embodiments of the present application provide an image processing method, including:

[0036] Step S101, obtaining a preset first recognition model;

[0037] Step S102, establishing a loss function corresponding to the first recognition model;

[0038] Step S103, updating the first recognition model to a second recognition model through the loss function;

[0039] Step S104, obtaining first image data of the object to be detected;

[0040] Step S105, performing defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected.

[0041] In this embodiment, an image processing method is proposed for identifying defects of an object to be detected, where the object to be detected is the object that needs to be detected.

[0042] Exemplarily, the object to be detected can be a silicon steel strip.

[0043] Obtain a preset first recognition model, where the first recognition model is an initial model for identifying defects.

[0044] Exemplarily, the first recognition model can be an object detection model based on the YOLOv11 (an algorithm) algorithm.

[0045] Establish a loss function corresponding to the first recognition model, where the loss function is a function that maps the value of a random event or its related random variable to a non - negative real number to represent the "risk" or "loss" of the random event.

[0046] Exemplarily, the loss function can constrain the output data of the first recognition model.

[0047] Update the first recognition model through the loss function to obtain a second recognition model, where the second recognition model is the updated recognition model.

[0048] Exemplarily, the first recognition model can be an improved YOLOv11 object detection model.

[0049] Obtain first image data of the object to be detected, perform defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected, where the first image data is the image data of the object to be detected, and the defect information is the information indicating the defect situation of the object to be detected.

[0050] Exemplarily, the first image data may be a two-dimensional image of the object to be detected.

[0051] Exemplarily, the defect information may be the position information of various defects such as cracks, scratches, pits, etc. on the surface of the silicon steel strip.

[0052] It should be noted that in this application, the loss function is newly established to update the first recognition model to obtain the second recognition model, improving the recognition accuracy of the second recognition model, and further improving the defect accuracy of the object to be detected.

[0053] In the image processing method of this embodiment, the second recognition model is used to perform defect recognition on the first image data to obtain the defect information of the object to be detected, improving the information accuracy of the defect information, and further improving the defect accuracy of the object to be detected.

[0054] In some embodiments, an image processing method is provided in the embodiments of this application. Establishing the loss function corresponding to the first recognition model includes:

[0055] Step S201, obtaining multiple output images of the first recognition model;

[0056] Step S202, determining function parameters according to the multiple output images;

[0057] Step S203, establishing a loss function based on the function parameters.

[0058] In this embodiment, the image of the object to be detected is recognized by the first recognition model to obtain multiple output images output by the first recognition model, where the output image is the recognition output image of the first recognition model.

[0059] Exemplarily, the output image includes information such as the predicted box of the defect.

[0060] Data processing is performed on the multiple output images to obtain function parameters, where the function parameters are the parameters that make up the loss function.

[0061] Exemplarily, the function parameters may include the center point coordinates of the predicted box and the ground truth box, the Euclidean distance between the two center points, and the diagonal length of the minimum bounding rectangle of the two images.

[0062] A loss function is established based on the function parameters.

[0063] Exemplarily, the loss function may be the DIoU (a kind of loss function) loss function, and the formula of the loss function is:

[0064] L DIoU = 1 - DIoU, 0 ≤ L DIoU≤2;

[0065] Among them, DIoU is the loss function, IoU is a loss function used in object detection tasks, and L DIoU is the limit value of the loss function, b and b gt respectively represent the center point coordinates of the predicted box and the ground truth box, and p 2 (b, bgt) represents the Euclidean distance between the two center points (referring to the distance between two points in Euclidean space), C represents the diagonal length of the minimum bounding rectangle of the two images, and the structure of the loss function is as Figure 2 shown.

[0066] Exemplarily, the process of the DIoU algorithm:

[0067] If the predicted box is B'=(x1, y1, x2, y2), and the GTbox (ground truth) is B=(x1', y1', x2', y2');

[0068] Input the bounding box coordinates B' of the predicted box B' and the coordinates B of GTbox B: B'=(x1, y1, x2, y2), B=(x1', y1', x2', y2');

[0069] Output: L DIoU .

[0070] Step 1: Calculate the area A' of B': A'=(x2 - x1)×(y2 - y1);

[0071] Step 2: Calculate the area A of B: A=(x2' - x1')×(y2' - y1');

[0072] Step 3: Calculate the coordinates of the intersection box between B' and B: x_left = max(x1, x1'), y_top = max(y1, y1'), x_right = min(x2, x2'), y_bottom = min(y2, y2');

[0073] Step 4: Calculate the area A_intersection of the intersection box between B' and B:

[0074] If (x_left < x_right) and (y_top < y_bottom):

[0075] A_intersection=(x_right - x_left)×(y_bottom - y_top);

[0076] Otherwise: A_intersection = 0.

[0077] Step 5: Calculate IoU:

[0078] If A'+A - A_intersection > 0:

[0079] IoU = A_intersection / (A'+A - A_intersection);

[0080] Otherwise: IoU = 0.

[0081] Step 6: Calculate the distance d_c between the center points:

[0082] d_c = sqrt((x1 + x2 - x1' - x2')^2 + (y1 + y2 - y1' - y2')^2) / 2.

[0083] Step 7: Calculate the diagonal length d_1:

[0084] d_1 = sqrt((x2 - x1)^2 + (y2 - y1)^2).

[0085] Step 8: Calculate the diagonal length d_2:

[0086] d_2 = sqrt((x2' - x1')^2 + (y2' - y1')^2).

[0087] Step 9: Calculate the DIoU loss:

[0088] v = d_c / sqrt(d_1 + d_2);

[0089] LDIoU = 1 - IoU + v^2 × (1 - IoU).

[0090] In some embodiments, in the embodiments of the present application, an image processing method is provided, and the first recognition model is updated to the second recognition model through a loss function, including:

[0091] Step S301, optimize the network structure of the first recognition model through a loss function to obtain an optimized first recognition model;

[0092] Step S302, obtain a preset training data set;

[0093] Step S303, perform model training processing on the optimized first recognition model based on the training data set to obtain a second recognition model.

[0094] In this embodiment, the network structure of the first recognition model is optimized through a loss function to obtain an optimized first recognition model.

[0095] Exemplarily, the optimized first recognition model is the first recognition model with optimized structure.

[0096] Obtain a preset training data set, and based on the training data set, perform model training processing on the optimized first recognition model to obtain a second recognition model.

[0097] Exemplarily, based on the training data set, train the optimized first recognition model to obtain a second recognition model.

[0098] Exemplarily, the structure of the second recognition model is as Figure 3 shown.

[0099] In some embodiments, in the embodiments of the present application, an image processing method is provided. Obtaining a preset training data set includes:

[0100] Step S401, collect an image of the image data to obtain second image data;

[0101] Step S402, adjust the image size and color channels of the second image data to obtain third image data;

[0102] Step S403, perform defect annotation on the third image data to obtain fourth image data;

[0103] Step S404, perform data set division on the fourth image data to obtain a training data set.

[0104] In this embodiment, collect an image of the image data to obtain second image data, where the second image data is the initial image data.

[0105] Adjust the image size and color channels of the second image data to obtain third image data, where the third image data is the image data with adjusted size and color.

[0106] Perform defect annotation on the third image data to obtain fourth image data, where the fourth image data is the annotated image data.

[0107] Perform data set division on the fourth image data to obtain a training data set.

[0108] Exemplarily, the method for establishing a training data set includes:

[0109] The first step is to establish a standard library of strip surface defects.

[0110] The second step is to rename the image of the picture to be detected, perform defect annotation, convert the label format, and divide the data set, set evaluation indicators, training parameters, and perform network stability analysis and network performance analysis.

[0111] In the third step, determine the position of the defect in the image to be detected, and improve the first recognition model using the loss function.

[0112] The specific content of the above-mentioned first step includes:

[0113] (1) Adopt the silicon steel strip surface defect image dataset.

[0114] (2) Select pictures with a resolution of 128×128 pixels and a format of 3 channels.

[0115] The specific content of the above-mentioned second step includes:

[0116] (1) Rename the images. Rename the silicon steel strip defect images according to the naming format of the VOC2012 (an image database) image database.

[0117] (2) Defect annotation: Before training the object detection model, it is necessary to manually annotate the silicon steel strip surface defects. Annotation tools include LabelImg, Labelme, etc. Considering that the first recognition model uses the form of a rectangular box to recognize the silicon steel strip surface defects, combined with the characteristics of simple operation and rich functions of the LabelImg tool, select LabelImg1.8.6 for annotation. After the annotation is completed, a number of true box labels are obtained.

[0118] (3) Label format conversion: The annotation information of the image by LabelImg is stored in a label file ending with "xml". The "xml" file contains the category of the defect and four position parameters x min , x max , y min , y max . The annotation rectangular box takes the upper left corner as the origin. The difference between x max and x min is the width w of the annotation rectangular box, and the difference between y max and y min is the height h of the annotation rectangular box.

[0119] The "xm1" label cannot be directly used for the first recognition model and needs to be converted into a standard "txt" format file. The conversion process is the normalization of the annotation box. The conversion formula used is as follows:

[0120]

[0121] Among them, (x center , y center ) is the center point of the rectangular box after normalization, w' and h' are the width and height after normalization respectively, x min , x max , y min , y maxis the position parameter, h is the height, and w is the width.

[0122] Taking the upper left corner of the image as the origin, a two-dimensional coordinate system is constructed. The upper left corner coordinates of the labeled rectangular box in the image are (x min , y min ); the lower right corner coordinates of the labeled rectangular box in the image are (x max , y max ); (x center , y center ) are the horizontal and vertical coordinates of the center point of the rectangular box after normalization.

[0123] (4) Division of the data set: Divide a number of strip steel surface defect images and their corresponding annotation files according to the ratio of 80%:20%, and keep the number of images of each defect type evenly distributed in the training set and the validation set during the division process.

[0124] In some embodiments, an image processing method is provided in the embodiments of the present application. Based on the training data set, model training processing is performed on the optimized first recognition model to obtain a second recognition model, including:

[0125] Step S501: Divide the fourth image data into a data set to obtain a test data set;

[0126] Step S502: Test the second recognition model based on the test data set to obtain the detection result of the second recognition model.

[0127] In this embodiment, the fourth image data is divided into a data set to obtain a test data set, where the test data set is a data set for testing the performance of the second recognition model.

[0128] Exemplarily, when dividing the fourth image data into a data set, a test data set and a training data set can be obtained respectively.

[0129] Based on the test data set, the second recognition model is tested to obtain the detection result of the second recognition model, where the detection result represents the detection effect of the second recognition model.

[0130] Exemplarily, the detection results include:

[0131] Average Precision: AP. By setting different IoU thresholds, multiple sets of P values and R values can be obtained. Taking P as the vertical axis and R as the horizontal axis, a P-R curve is plotted. The area of the closed region formed by the P-R curve and the coordinate axes is the AP value. The higher the AP value, the better the performance of the model.

[0132] Mean Average Precision: mAP. After evaluating the model on the validation set, an AP value for each type of defect is generated. The mAP value is obtained by averaging the AP values of all classes. Select mAP@0.5: the mAP result calculated when IoU = 0.5 as the metric to measure the detection accuracy.

[0133] Detection time: The detection time is the time required for the model to identify a single defective image on average. A smaller detection time means a faster detection speed. In addition, on the premise of the same device, the time taken for the model to process an image is closely related to the number of its parameters. Therefore, the number of floating-point operations (FLOPs) required by the model is also included in the scope of evaluation metrics.

[0134] Network stability analysis: The decline curves of the bounding box localization loss (box_loss), confidence loss (obj_loss), and class loss (cls_loss) of the training set and the validation set during the training process of the model. Generally speaking, the loss values of the training set and the validation set gradually converge to a stable state as the iteration progresses, the network training process is stable, and overfitting has not occurred.

[0135] After the model training is completed, the weight parameters are saved in the best.pt file, with a size of 13.24MB. The performance of the model is evaluated using this weight file in the test set. The model performs well on scratches defects and relatively poorly on crazing defects.

[0136] Using val.py to detect 360 images in the validation set, the detection time for a single image is 11.6ms, including 1.1ms for preprocessing time, 9.1ms for inference time, and 1.4ms for non-maximum suppression time. The model can detect defects quickly.

[0137] Generally speaking, the first recognition model can better identify the types of surface defects of silicon steel strips and complete the localization, but there are deficiencies in the detection performance of crazing defects, resulting in a reduction in the overall recognition accuracy. The first recognition model is improved by introducing the DIoU loss function to obtain more accurate and faster defect detection results.

[0138] Exemplarily, the detection results are as Figure 4 、 Figure 5 、 Figure 6 、 Figure 7 and Figure 8 shown.

[0139] Exemplarily, the detection effect can be as shown in Table 1, where crazing, inclusion1, Inclusion2, pitted_surface, rolled-in_scale, and scratches are defect types.

[0140] Table 1

[0141]

[0142] In some embodiments, an image processing method is provided in the embodiments of the present application. By using a second recognition model, defect recognition is performed on first image data to obtain defect information of an object to be detected, including:

[0143] Step S601: Take the first image data as model input data;

[0144] Step S602: Input the model input data into the second recognition model to obtain the defect information output by the second recognition model.

[0145] In this embodiment, the first image data is taken as model input data, and the model input data is input into the second recognition model to obtain the defect information output by the second recognition model.

[0146] Exemplarily, the defect information can be the position information of various defects such as cracks, scratches, and pits on the surface of the silicon steel strip.

[0147] Exemplarily, the defect information may include whether there are defects on the surface of the silicon steel strip and the degree of the defects.

[0148] In some embodiments, as Figure 9 shown, an image processing method is provided in the embodiments of the present application, including:

[0149] Step S1: Obtain a silicon steel strip defect data set and preprocess it;

[0150] Step S2: Optimize the network structure based on the existing YOLOv11 algorithm to obtain an improved YOLOv11 object detection model after optimization;

[0151] Step S3: Train the improved YOLOv11 object detection model based on the collected and processed data set;

[0152] Step S4: Use the improved YOLOv11 object detection model to detect pictures and output the detected pictures.

[0153] In this embodiment, a silicon steel strip defect data set is obtained and preprocessed, and the network structure based on the existing YOLOv11 algorithm is optimized to obtain an improved YOLOv11 object detection model after optimization.

[0154] Based on the collected and processed data set, an improved YOLOv11 object detection model is trained, and then the improved YOLOv11 object detection model is used to detect images, and the detected images are output.

[0155] In some embodiments, as Figure 10 shown, in the embodiments of the present application, an image processing apparatus 1000 is provided, including:

[0156] An acquisition unit 1002, configured to acquire a preset first recognition model;

[0157] A processing unit 1004, configured to establish a loss function corresponding to the first recognition model;

[0158] The processing unit 1004 is further configured to update the first recognition model to a second recognition model through the loss function;

[0159] The acquisition unit 1002 is further configured to acquire first image data of an object to be detected;

[0160] The processing unit 1004 is further configured to perform defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected.

[0161] In this embodiment, an image processing apparatus 1000 is proposed for identifying defects of an object to be detected, where the object to be detected is an object that needs to be detected.

[0162] Exemplarily, the object to be detected may be a silicon steel strip.

[0163] Acquire a preset first recognition model, where the first recognition model is an initial model for recognizing defects.

[0164] Exemplarily, the first recognition model may be an object detection model based on the YOLOv11 (an algorithm) algorithm.

[0165] Establish a loss function corresponding to the first recognition model, where the loss function is a function that maps the value of a random event or its related random variable to a non-negative real number to represent the "risk" or "loss" of the random event.

[0166] Exemplarily, the loss function may constrain the output data of the first recognition model.

[0167] Update the first recognition model through the loss function to obtain a second recognition model, where the second recognition model is an updated recognition model.

[0168] Exemplarily, the first recognition model may be an improved YOLOv11 object detection model.

[0169] Obtain the first image data of the object to be detected, and perform defect recognition on the first image data through a second recognition model to obtain defect information of the object to be detected, where the first image data is the image data of the object to be detected, and the defect information is information indicating the defect situation of the object to be detected.

[0170] Exemplarily, the first image data may be a two-dimensional image of the object to be detected.

[0171] Exemplarily, the defect information may be the position information of various defects such as cracks, scratches, and pits on the surface of the silicon steel strip.

[0172] It should be noted that in this application, a new loss function is used to update the first recognition model to obtain the second recognition model, which improves the recognition accuracy of the second recognition model, and further improves the defect accuracy of the object to be detected.

[0173] The image processing device 1000 in this embodiment performs defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected, which improves the information accuracy of the defect information, and further improves the defect accuracy of the object to be detected.

[0174] In some embodiments, an image processing device 1000 provided in the embodiments of this application further includes:

[0175] An acquisition unit 1002 is further configured to acquire a plurality of output images of the first recognition model;

[0176] The acquisition unit 1002 is further configured to determine function parameters according to the plurality of output images;

[0177] The acquisition unit 1002 is further configured to establish a loss function based on the function parameters.

[0178] In some embodiments, an image processing device 1000 provided in the embodiments of this application further includes:

[0179] A processing unit 1004 is further configured to optimize the network structure of the first recognition model through the loss function to obtain an optimized first recognition model;

[0180] The processing unit 1004 is further configured to acquire a preset training data set;

[0181] The processing unit 1004 is further configured to perform model training processing on the optimized first recognition model based on the training data set to obtain a second recognition model.

[0182] In some embodiments, an image processing device 1000 provided in the embodiments of this application further includes:

[0183] The acquisition unit 1002 is further configured to collect the image of the image data to obtain second image data;

[0184] The acquisition unit 1002 is further configured to adjust the image size and color channels of the second image data to obtain third image data;

[0185] The acquisition unit 1002 is further configured to perform defect annotation on the third image data to obtain fourth image data;

[0186] The acquisition unit 1002 is further configured to perform dataset division on the fourth image data to obtain a training dataset.

[0187] In some embodiments, an image processing apparatus 1000 provided in the embodiments of the present application further includes:

[0188] The processing unit 1004 is further configured to perform dataset division on the fourth image data to obtain a test dataset;

[0189] The processing unit 1004 is further configured to test the second recognition model based on the test dataset to obtain the detection result of the second recognition model.

[0190] In some embodiments, an image processing apparatus 1000 provided in the embodiments of the present application further includes:

[0191] The processing unit 1004 is further configured to use the first image data as model input data;

[0192] The processing unit 1004 is further configured to input the model input data into the second recognition model to obtain the defect information output by the second recognition model.

[0193] In some embodiments, as Figure 11 shown, an image processing apparatus 1100 is proposed. The image processing apparatus 1100 includes a processor 1102 and a memory 1104. A computer program is stored in the memory 1104. When the computer program is executed by the processor 1102, it implements the steps of the image processing method in any of the above embodiments. Therefore, the image processing apparatus 1100 has all the beneficial effects of the image processing method in any of the above embodiments, and will not be elaborated here.

[0194] In some embodiments, a readable storage medium is provided, on which a program is stored. When the program is executed by a processor, it implements the steps of the image processing method in any of the above embodiments, and thus has all the beneficial technical effects of the image processing method in any of the above embodiments.

[0195] In one embodiment according to the present application, a defect detection device is provided, including: the image processing device in any of the above embodiments, and / or the readable storage medium in any of the above embodiments, and thus has all the beneficial technical effects of the image processing device in any of the above embodiments, and / or the readable storage medium in any of the above embodiments, and will not be elaborated here too much.

[0196] It should be noted that in the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0197] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-readable program codes.

[0198] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0199] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0200] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocksFigure 1 Steps of the functions specified in one or more boxes.

[0201] The embodiments of the present application also provide a computer program product, which includes computer software instructions. When the computer software instructions run on a processing device, the processing device is caused to execute the process of the image processing method.

[0202] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, a computer, a server, or a data center to another website, a computer, a server, or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0203] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.

[0204] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be in an electrical, mechanical, or other form.

[0205] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0206] In addition, the functional units in each embodiment of this application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0207] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of this application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0208] The above embodiments are only used to illustrate the technical solutions of this application, not to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of this application.

[0209] Although the preferred embodiments of this specification have been described, those skilled in the art can make additional changes and modifications once they know the basic creative concept. Therefore, the appended claims are intended to be interpreted to include the preferred embodiments and all changes and modifications that fall within the scope of this specification.

[0210] Obviously, those skilled in the art can make various changes and modifications to this specification without departing from the spirit and scope of this specification. Thus, if these modifications and variations of this specification fall within the scope of the claims of this specification and their equivalent technologies, this specification is also intended to include these changes and variations.

Claims

1. An image processing method, characterized in that: The method comprises: Obtaining a preset first recognition model; Establishing a loss function corresponding to the first recognition model; Updating the first recognition model to a second recognition model by using the loss function; Acquire first image data of the object to be detected; Defect recognition is performed on the first image data using the second recognition model to obtain defect information of the object to be detected.

2. The method according to claim 1, characterized in that The establishing of the loss function corresponding to the first recognition model includes: Acquire a plurality of output images of the first recognition model; Determining function parameters according to the plurality of output images; Based on the function parameters, the loss function is established.

3. The method according to claim 1, characterized in that The updating of the first recognition model to a second recognition model by using the loss function includes: By using the loss function, the network structure of the first recognition model is optimized to obtain the optimized first recognition model; Get the preset training data set; Based on the training data set, model training processing is performed on the optimized first recognition model to obtain the second recognition model.

4. The method according to claim 3, characterized in that The obtaining of a preset training data set includes: Acquiring an image of the image data to obtain second image data; adjusting the image size and color channel of the second image data to obtain third image data; performing defect marking on the third image data to obtain fourth image data; The fourth image data is divided into data sets to obtain the training data set.

5. The method according to claim 4, characterized in that The performing model training processing on the optimized first recognition model based on the training data set to obtain the second recognition model includes: Dividing the fourth image data into data sets to obtain a test data set; Based on the test data set, the second recognition model is tested to obtain a detection result of the second recognition model.

6. The method according to any one of claims 1 to 5, characterized in that The step of performing defect recognition on the first image data by using the second recognition model to obtain defect information of the object to be detected includes: using the first image data as model input data; The model input data is input into the second recognition model to obtain the defect information output by the second recognition model.

7. An image processing device, characterized in that: The device comprises: An acquisition unit, used to acquire a preset first recognition model; A processing unit, used to establish a loss function corresponding to the first recognition model; The processing unit is further used to update the first recognition model to a second recognition model through the loss function; The acquisition unit is further used to acquire first image data of the object to be detected; The processing unit is further used to perform defect recognition on the first image data through the second recognition model to obtain defect information of the object to be detected.

8. An image processing device, characterized in that: include: processor; A memory, wherein a program or instruction is stored in the memory, and when the processor executes the program or instruction in the memory, the steps of the image processing method according to any one of claims 1 to 6 are implemented.

9. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by a processor, the steps of the image processing method according to any one of claims 1 to 6 are implemented.

10. A defect detection device, characterized in that: include: The image processing device according to claim 7 or 8; and / or The readable storage medium as claimed in claim 9.