Image processing method, image processing device, image processing equipment, storage medium and computer product

Through the local binary pattern algorithm and deep learning two-stage repair network, combined with the similarity encoder and affine transformation, the problem of scarcity of product surface data is solved, fast and accurate defect segmentation and sample expansion are achieved, and the accuracy of defect contour information is improved. Accuracy.

CN118823501APending Publication Date: 2024-10-22CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410245165.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-04
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

In actual production, due to the continuous improvement of the yield rate, it is often difficult to obtain product surface data containing defects, resulting in the inability of traditional image processing methods to accurately segment defects.

Method used

Using the local binary pattern algorithm combined with the two-stage repair network of deep learning, the image is repaired through the coarse repair network and the fine repair network, and the similarity encoder and auxiliary encoding and decoding network are used to generate the repaired image, combined with affine transformation to generate Images with different defect characteristics.

Benefits of technology

It achieves fast and accurate defect segmentation, expands the number of defect samples, improves the accuracy of defect contour information and the repair ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823501A_ABST
    Figure CN118823501A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing method, an image processing device, image processing equipment, a storage medium and a computer product. The method comprises the following steps: obtaining a first image and a second image; the second image is an image obtained after the defect of the first image is repaired; processing the first image and the second image by using a local binary pattern algorithm to obtain a first region; the first area is a defective area in the first image; generating a third image based on the first region; the third image and the first image have different flaw characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, an image processing apparatus, an image processing device, a storage medium and a computer product. Background Art

[0002] In the industrial field, the research on product surface defect detection scenarios is mainly focused on various mainstream neural network frameworks, from convolutional neural networks (CNN) to deep neural networks (such as YOLO, SSD), and even to semantic segmentation fully convolutional neural networks (FCN). Due to the characteristics of deep learning, defect classification or detection requires a large amount of defect data to learn and train a model with good generalization.

[0003] However, in actual production, as the yield rate continues to increase, surface data of products containing defects is often difficult to obtain. Summary of the invention

[0004] Embodiments of the present application provide an image processing method, an image processing apparatus, an image processing device, a storage medium, and a computer product.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present application provides an image processing method, which includes:

[0007] Obtaining a first image and a second image; wherein the second image is an image obtained after repairing defects of the first image;

[0008] Processing the first image and the second image using a local binary pattern algorithm to obtain a first region; the first region is a defect region in the first image;

[0009] Based on the first area, a third image is generated; the third image and the first image have different defect characteristics

[0010] In the above solution, obtaining the second image includes:

[0011] Inputting the first image into a restoration model, and using a coarse restoration network of the restoration model to restore the first image to obtain a fourth image;

[0012] The fourth image is repaired using a refined repair network of the repair model to obtain the second image.

[0013] In the above solution, the method of repairing the fourth image using the fine repair network of the repair model to obtain the second image includes:

[0014] Inputting the fourth image into the content-aware branch of the fine restoration network to obtain a fifth image;

[0015] Inputting the fourth image into the encoding branch of the fine restoration network to obtain a sixth image;

[0016] Inputting the fifth image and the sixth image into a similarity encoder of the fine restoration network to obtain a similarity parameter;

[0017] The fifth image, the sixth image and the similarity parameter are input into an auxiliary coding and decoding network to obtain the second image.

[0018] In the above scheme, the method further includes:

[0019] Obtaining a first sample image; the first sample image is a flawless image;

[0020] Based on the first sample image, construct a second sample image; the second sample image is a defective image;

[0021] The restoration model is trained by learning using a model composed of a generative image network and a discriminative network.

[0022] In the above solution, the loss function of the restoration model is determined based on the first sample image, the second sample image and the discrimination result of the discriminant network.

[0023] In the above solution, generating a third image based on the first area includes:

[0024] Performing an affine transformation on the first defect feature of the first region to obtain a plurality of second defect features;

[0025] Obtaining a first sample image; the first sample image is a flawless image;

[0026] Each of the second defect features is fused with the first sample image to obtain each of the third images.

[0027] In the above solution, the second defect feature and the first defect feature are defects of different types.

[0028] The present application also provides an image processing device, including:

[0029] An obtaining unit, configured to obtain a first image and a second image; the second image is an image obtained after repairing defects of the first image;

[0030] A processing unit, configured to process the first image and the second image using a local binary pattern algorithm to obtain a first region; the first region is a defect region in the first image;

[0031] The processing unit is used to generate a third image based on the first area; the third image and the first image have different defect characteristics.

[0032] The embodiment of the present application further provides an image processing device, comprising: a processor and a memory for storing a computer program that can be run on the processor,

[0033] Wherein, the processor is used to execute the steps of any of the above methods when running the computer program.

[0034] An embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0035] An embodiment of the present application further provides a computer product, including a computer program, which implements the steps of any of the above methods when executed by a processor.

[0036] The embodiment of the present application provides an image processing method, an image processing device, an image processing equipment, a storage medium and a computer product, the method comprising: obtaining a first image and a second image; the second image is an image obtained after repairing the defects of the first image; using a local binary pattern algorithm to process the first image and the second image to obtain a first region; the first region is a defect region in the first image; based on the first region, a third image is generated; the third image and the first image have different defect characteristics. The problem that the surface data of products containing defects is often difficult to obtain in actual production due to the continuous improvement of the yield rate is solved, and fast defect segmentation is achieved, and the number of defect samples is expanded. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic diagram of the wheel hub surface in the related art;

[0038] Figure 2 A schematic diagram of a flow chart of an image processing method according to an embodiment of the present application;

[0039] Figure 3 A schematic diagram of the defect detection stage of an embodiment of the present application;

[0040] Figure 4 A schematic diagram of a coarse repair network and a fine repair network according to an embodiment of the present application;

[0041] Figure 5A schematic diagram of an automatic defect generation process based on a deep learning generative adversarial network according to an embodiment of the present application;

[0042] Figure 6 This is a schematic diagram of the structure of an image processing device according to an embodiment of the present application;

[0043] Figure 7 This is a schematic diagram of the structure of the image processing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0044] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0045] In actual production (such as wheel hub production), due to the continuous improvement of the yield rate, it is often difficult to obtain product surface data containing defects. After obtaining the original image of the product surface, the automatic defect generation method in the related art usually extracts and segments the defect features including threshold segmentation, edge detection, and morphological operations to obtain the initial contour of the target defect for subsequent analysis and processing.

[0046] However, due to the complexity of product surface image data, it will interfere with defect segmentation. The contour extraction based on traditional image processing methods such as threshold segmentation, edge detection, and morphological operations often cannot accurately segment defects. In the wheel hub surface defect extraction task, there are many lines and holes on the wheel hub surface. Figure 1 As shown. The traditional defect automatic generation method cannot accurately obtain the defect contour. The image processing method provided by the present application realizes the ability in image reconstruction and can extract the defect contour information more accurately.

[0047] The present application embodiment provides an image processing method, which is applied to an image processing device, such as Figure 2 As shown, the method includes:

[0048] Step 101: Obtain a first image and a second image; the second image is an image obtained after repairing defects of the first image.

[0049] In practical application, the first image is a defect image to be processed, and the first image includes an abnormal sample image. In the defect repair stage, the first image is repaired to obtain a second image.

[0050] Step 102: Process the first image and the second image using a local binary pattern algorithm to obtain a first region; the first region is a defect region in the first image.

[0051] In practical applications, local binary patterns (LBP) are visual operators used for classification in the field of computer vision. In the defect detection stage, the LBP algorithm is used to process the first image and the second image to locate the defect target, thereby obtaining the first area; the first area is the defect area in the first image.

[0052] In one embodiment, step 102 uses a local binary pattern algorithm to process the first image and the second image to obtain a first region. Figure 3 As shown, the present application uses the LBP algorithm to encode the first image (the defective image before restoration) and the second image (the restored image), and compares them to generate a binary mask of the defective area. The original defective sample image is filtered by the mask to obtain the defective area. Based on the advantages of the local binary mode, such as insensitivity to grayscale changes and fast calculation speed, the present application can quickly extract the defective area in the defective image. Among them, the pixels in the first image and the second image, such as RGB values ​​and grayscale values, are not exactly the same. By binarizing the image and then comparing the defective image and the restored image, the defective area is obtained.

[0053] Step 103: Generate a third image based on the first area; the third image and the first image have different defect characteristics.

[0054] In actual application, in the defect generation stage, in method 1, the defect defect in the first area is processed, and the processed defect is merged with the normal sample to generate a third image. The normal sample includes but is not limited to the defect-free image corresponding to the first image. In method 2, the defect defect in the first area is processed, and the processed defect is merged with the second image to generate a third image.

[0055] The image processing method provided by the embodiment of the present application obtains a first image and a second image; the second image is an image obtained after repairing the defects of the first image; the first image and the second image are processed by a local binary pattern algorithm to obtain a first region; the first region is a defective region in the first image; here, based on the characteristics of the local binary pattern such as insensitivity to grayscale changes and fast calculation speed, the defective region in the defective image can be quickly extracted to achieve defect segmentation; further, based on the first region, a third image is generated; the third image and the first image have different defect characteristics, thereby expanding the number of defect samples.

[0056] The image processing method provided in the embodiment of the present application can be implemented independently by a terminal or a server; it can also be implemented jointly by a terminal and a server. For example, the terminal independently undertakes the image processing method described below, or the terminal sends a first image to the server, and the server executes the image processing method on the received first image to generate a third image.

[0057] The image processing device provided in the embodiment of the present application can be various types of terminal devices or servers, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services; the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and the present application does not limit this.

[0058] In some embodiments, obtaining the second image in step 101 may be achieved by the following steps:

[0059] Inputting the first image into the restoration model, and using the coarse restoration network of the restoration model to restore the first image to obtain a fourth image;

[0060] The fourth image is repaired using the refined repair network of the repair model to obtain the second image.

[0061] In practical applications, the coarse repair network is a typical encoder-decoder architecture, which outputs the blurred defect repair result. The fine repair network is used to further repair the blurred defect repair result to achieve a better repair effect.

[0062] In practical applications, the repair model is also called the defect repair model (G model for short).

[0063] In some embodiments, the method further comprises the following steps:

[0064] First, a first sample image is obtained; the first sample image is a flawless image.

[0065] Secondly, based on the first sample image, a second sample image is constructed; the second sample image is a defective image; here, some defects can be created on the first sample image to obtain the second sample image.

[0066] Finally, the model composed of the generative image network and the discriminative network is used for learning and training the restoration model.

[0067] Exemplarily, the G model can be obtained in the following way: using normal (defect-free) samples collected at the product production site by industrial cameras, using image processing technology to artificially create some defects on the normal sample images, using the G module composed of the generated image network (Generator) and the discriminator network (Discriminator) to perform defect repair learning, and training a generative G model with image repair and reconstruction capabilities. Among them, the normal samples collected at the product production site by industrial cameras can be used in the defect generation stage and fused with the processed defects to generate a third image.

[0068] In practical applications, when training the repair model, you can use the alternating iterative training method. First, train the discriminator network, fix the generator network, then train the generator network, fix the discriminator network, and perform alternating iterative training. Finally, take the generator model as the G model.

[0069] In some embodiments, the loss function of the restoration model is determined based on the first sample image, the second sample image, and the discrimination result of the discriminant network. In practical applications, the loss function is minimized by training the restoration model so that the image restored by the generator is closer to the real data (ground truth).

[0070] Different from the Generative Adversarial Network (GAN) model in the related art, the G model in the present application includes two networks, namely a coarse repair network and a fine repair network. The G model in the present application is a GAN model based on deep learning.

[0071] In actual application, when extracting defects, the image containing defects, i.e., the first image, is input into the trained G model, and the G model is used to perform two-stage repair on the first image containing various defects, first rough repair and then fine repair, to obtain the repaired image, i.e., the second image. The two-stage defect repair network of the present application can improve the model repair capability and achieve better repair effects.

[0072] In some embodiments, the fourth image is repaired using the fine repair network of the repair model to obtain the second image, which can be achieved by the following steps:

[0073] The fourth image is repaired using the fine repair network of the repair model to obtain the second image, including:

[0074] First, the fourth image is input into the content-aware branch of the fine inpainting network to obtain the fifth image;

[0075] Here, the content-aware branch can allow the feature information of the two regions to learn from each other without being restricted by spatial position to restore the image of the defective area.

[0076] Secondly, the fourth image is input into the encoding branch of the fine restoration network to obtain the sixth image;

[0077] Here, the encoding branch can be a regular encoder branch, which is responsible for extracting basic and common features of the image without paying too much attention to the specific content of the image, and helps to preserve the overall structure and basic features of the image when processing blur defects.

[0078] Again, the fifth image and the sixth image are input into the similarity encoder of the fine restoration network to obtain similarity parameters;

[0079] Here, the features from the lower branch are fused together with the features extracted by the content-aware branch from the upper branch through a similarity encoder. This fusion process aims to combine generic features and content-aware features to more comprehensively encode similarity information between image regions.

[0080] Finally, the fifth image, the sixth image and the similarity parameter are input into the auxiliary codec network to obtain the second image.

[0081] In practical application, such as Figure 4 As shown in the figure, the restoration model includes two stages: stage 1, a coarse restoration network, and stage 2, a fine restoration network. The coarse restoration network is a typical encoder-decoder architecture that outputs the blurred defect restoration result. The encoder in the fine restoration network is divided into two parallel branches, the upper content perception (contextual attention) branch and the lower conventional encoder branch. The upper branch is an encoder containing a semantic attention mechanism. Compared with the traditional convolutional neural network, it can allow the feature information of the two regions to learn from each other without being restricted by spatial position to restore the image of the defective area; the lower branch is a conventional encoder branch, which is responsible for extracting the basic and general features of the image without paying too much attention to the specific content of the image. It is beneficial to retain the overall structure and basic features of the image when processing blurred defects.

[0082] Then the two branches are combined into one branch through the similarity encoder to encode the similarity between image regions. The features of the lower branch are fused together with the features extracted by the content-aware branch of the upper branch through the similarity encoder. This fusion process aims to combine general features and content-aware features to more comprehensively encode the similarity information between image regions. The auxiliary encoder-decoder network generates an auxiliary image with normal regions unchanged according to the similarity provided by the similarity encoder, while the defective regions are filled with similar normal regions. In the process of filling the defective regions with similar normal regions, the similarity encoder calculates the similarity of all patch quality inspections, and the auxiliary encoder-decoder generates an auxiliary image. The defective regions are replaced with the weighted sum of patches in the normal regions according to the similarity. The loss function of the generator feature is defined as the restoration loss of the auxiliary image (L1+adversarialloss). By minimizing the loss function, the generator feature is trained to be close to the minimum restoration loss of the known image features.

[0083] In some embodiments, step 103 generates a third image based on the first area, which can be implemented by the following steps:

[0084] Performing an affine transformation on the first defect feature of the first area to obtain a plurality of second defect features;

[0085] Obtaining a first sample image; the first sample image is a flawless image;

[0086] Each second defect feature is fused with the first sample image to obtain each third image.

[0087] The second defect feature and the first defect feature are defects of different types.

[0088] In practical applications, various defects, including wheel hub surface defects, are closely related to the shape and size of the image. The affine transformation used in this application can change the shape of the image in the first area, and the new geometric structure can introduce new features, resulting in the appearance of defect types that do not exist in the original image in the transformed image. Furthermore, the translation and rotation operations used in the affine transformation in this application may introduce noise or emphasize the noise in the original image, which can improve the robustness of the model during the algorithm training process. In this way, the image processing method provided by this application can achieve image reconstruction for the phenomenon of small amount of abnormal sample data and unbalanced distribution of defect categories in industrial quality inspection scenarios. Compared with previous defect generation schemes, the defect generation scheme of this application is less affected by product contour, surface structure, and surface texture, and can capture defect targets more accurately. It can not only accurately extract defect contour information, but also expand the number of abnormal samples and defect categories.

[0089] In a feasible industrial quality inspection scenario, the automatic defect generation solution based on deep learning GAN provided by this application can be achieved by Figure 5 The four stages shown generate a sample image with defects:

[0090] Step 501: Model training phase.

[0091] Using normal sample images collected by industrial cameras at product production sites, image processing technology is used to artificially create some defects on the normal sample images. The G module composed of a generative image network and a discriminant network is used for defect repair learning to train a generative G model with image repair and reconstruction capabilities.

[0092] Step 502: Defect repair phase.

[0093] When extracting defects, the image containing defects is input into the trained G model, and the G model is used to repair the image containing various defects to obtain the repaired image.

[0094] In the defect repair stage, this application adopts a two-stage defect repair network based on a coarse repair network and a fine repair network, and introduces a similarity encoder to encode the similarity between image regions. An auxiliary image with unchanged normal areas is generated through an auxiliary encoder-decoder network to improve the model repair capability.

[0095] Step 503: Defect detection phase.

[0096] Since there are differences in pixel-level details between the image repaired by the repair network and the original defect sample image, this application uses the LBP algorithm to encode the images before and after repair, and compares them to generate a binary mask of the defect area. The original defect sample image is filtered through the mask to obtain the defect.

[0097] Step 504: Defect generation phase.

[0098] Affine transformation is performed on the defect to increase the diversity of the defect, and finally the defect is fused with the normal sample to form a sample image containing the defect.

[0099] The present application embodiment provides an image processing device, such as Figure 6 As shown, the device comprises:

[0100] An obtaining unit 601 is used to obtain a first image and a second image; the second image is an image obtained after repairing defects of the first image;

[0101] A processing unit 602 is used to process the first image and the second image using a local binary pattern algorithm to obtain a first region; the first region is a defect region in the first image;

[0102] The processing unit 602 is configured to generate a third image based on the first area; the third image and the first image have different defect characteristics.

[0103] In some embodiments, the processing unit 602 is used to input the first image into the restoration model, use the coarse restoration network of the restoration model to restore the first image to obtain a fourth image; and use the fine restoration network of the restoration model to restore the fourth image to obtain a second image.

[0104] In some embodiments, the processing unit 602 is used to input the fourth image into the content perception branch of the fine restoration network to obtain the fifth image; input the fourth image into the encoding branch of the fine restoration network to obtain the sixth image; input the fifth image and the sixth image into the similarity encoder of the fine restoration network to obtain the similarity parameter; input the fifth image, the sixth image and the similarity parameter into the auxiliary codec network to obtain the second image.

[0105] In some embodiments, the processing unit 602 is used to obtain a first sample image; the first sample image is a flawless image; based on the first sample image, a second sample image is constructed; the second sample image is a flawed image; and a repair model is trained by learning using a model composed of a generative image network and a discriminant network.

[0106] In some embodiments, the loss function of the restoration model is determined based on the first sample image, the second sample image, and the discrimination result of the discriminant network.

[0107] In some embodiments, the processing unit 602 is used to perform an affine transformation on the first defect feature of the first area to obtain multiple second defect features; obtain a first sample image; the first sample image is a defect-free image; and fuse each second defect feature with the first sample image to obtain each third image.

[0108] In some embodiments, the second defect feature and the first defect feature are defects of different types.

[0109] In actual application, the processing unit 602 may be implemented by a processor in an image processing device.

[0110] The embodiment of the present application provides an image processing device: obtain a first image and a second image; the second image is an image obtained after repairing the defects of the first image; use a local binary pattern algorithm to process the first image and the second image to obtain a first region; the first region is a defect region in the first image; based on the first region, generate a third image; the third image and the first image have different defect characteristics. It solves the problem that in actual production, due to the continuous improvement of the yield rate, the surface data of products containing defects is often difficult to obtain, realizes rapid defect segmentation, and expands the number of defect samples.

[0111] The present application also provides an image processing device, such as Figure 7 As shown, the image processing device 700 includes: a first communication interface 701 and a first processor 702; wherein,

[0112] The first communication interface 701 is capable of exchanging information with other devices;

[0113] The first processor 702 is connected to the first communication interface 701 to implement information interaction with other devices, and is used to execute the method provided by one or more technical solutions of the above-mentioned image processing device side when running a computer program;

[0114] The first memory 703 stores a computer program that can be executed on the first processor 702 .

[0115] The first processor 702 is used to obtain a first image and a second image; the second image is an image obtained after repairing defects of the first image;

[0116] Processing the first image and the second image using a local binary pattern algorithm to obtain a first region; the first region is a defect region in the first image;

[0117] Based on the first area, a third image is generated; the third image and the first image have different defect characteristics.

[0118] In some embodiments, the first processor 702 is configured to input the first image into the restoration model, and use a coarse restoration network of the restoration model to restore the first image to obtain a fourth image;

[0119] The fourth image is repaired using the refined repair network of the repair model to obtain the second image.

[0120] In some embodiments, the first processor 702 is configured to input the fourth image into a content-aware branch of a fine inpainting network to obtain a fifth image;

[0121] Inputting the fourth image into the encoding branch of the fine restoration network to obtain a sixth image;

[0122] Inputting the fifth image and the sixth image into a similarity encoder of a fine restoration network to obtain a similarity parameter;

[0123] The fifth image, the sixth image and the similarity parameter are input into the auxiliary codec network to obtain the second image.

[0124] In some embodiments, the first processor 702 is used to obtain a first sample image; the first sample image is a flawless image;

[0125] Based on the first sample image, construct a second sample image; the second sample image is a defective image;

[0126] The restoration model is trained using a model consisting of a generative image network and a discriminative network.

[0127] In some embodiments, the loss function of the restoration model is determined based on the first sample image, the second sample image, and the discrimination result of the discriminant network.

[0128] In some embodiments, the first processor 702 is configured to perform an affine transformation on the first defect feature of the first region to obtain a plurality of second defect features;

[0129] Obtaining a first sample image; the first sample image is a flawless image;

[0130] Each second defect feature is fused with the first sample image to obtain each third image.

[0131] In some embodiments, the second defect feature and the first defect feature are defects of different types.

[0132] It should be noted that the specific processing process of the first communication interface 701 and the first processor 702 can be understood by referring to the above method, which will not be repeated here.

[0133] Of course, in actual application, the various components in the image processing device 700 are coupled together through the first bus system 704. It can be understood that the first bus system 704 is used to realize the connection and communication between these components. In addition to the data bus, the first bus system 704 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 7 In the figure, various buses are labeled as a first bus system 704 .

[0134] The first memory 703 in the embodiment of the present application is used to store various types of data to support the operation of the image processing device 700. Examples of such data include: any computer program used to operate on the image processing device 700.

[0135] The method disclosed in the above embodiment of the present application can be applied to the first processor 702, or implemented by the first processor 702. The first processor 702 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the first processor 702 or an instruction in the form of software. The above-mentioned first processor 702 may be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The first processor 702 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the first memory 703, and the first processor 702 reads the information in the first memory 703, and completes the steps of the above method in combination with its hardware.

[0136] In an exemplary embodiment, the image processing device 700 can be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA), general processor, controller, microcontroller (MCU), microprocessor, or other electronic components to execute the aforementioned method.

[0137] The embodiment of the present application provides an image processing device: obtaining a first image and a second image; the second image is an image obtained after repairing the defects of the first image; using a local binary pattern algorithm to process the first image and the second image to obtain a first region; the first region is a defect region in the first image; based on the first region, a third image is generated; the third image and the first image have different defect characteristics. The problem that in actual production, due to the continuous improvement of the yield rate, the surface data of products containing defects is often difficult to obtain is solved, and fast defect segmentation is achieved, and the number of defect samples is expanded.

[0138] It can be understood that the memory of the embodiment of the present application can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (FlashMemory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Sync Link Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of the present application are intended to include, but are not limited to, these and any other suitable types of memories.

[0139] In an exemplary embodiment, the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a first memory 703 storing a computer program, and the computer program can be executed by a first processor 702 of an image processing device 700 to complete the steps of the above method on the image processing device side. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.

[0140] In an exemplary embodiment, the present application also provides a computer product, including a computer program, which can be executed by the first processor 702 of the image processing device 700 to complete the steps of the above method on the image processing device side.

[0141] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0142] In addition, the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict. The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. An image processing method, characterized in that: include: Obtaining a first image and a second image; wherein the second image is an image obtained after repairing defects of the first image; Processing the first image and the second image using a local binary pattern algorithm to obtain a first region; The first area is a defect area in the first image; A third image is generated based on the first area; the third image and the first image have different defect characteristics.

2. The method according to claim 1, characterized in that The obtaining of the second image comprises: Inputting the first image into a restoration model, and using a coarse restoration network of the restoration model to restore the first image to obtain a fourth image; The fourth image is repaired using a refined repair network of the repair model to obtain the second image.

3. The method according to claim 2, characterized in that The method of repairing the fourth image by using the fine repair network of the repair model to obtain the second image includes: Inputting the fourth image into the content-aware branch of the fine restoration network to obtain a fifth image; Inputting the fourth image into the encoding branch of the fine restoration network to obtain a sixth image; Inputting the fifth image and the sixth image into a similarity encoder of the fine restoration network to obtain a similarity parameter; The fifth image, the sixth image and the similarity parameter are input into an auxiliary coding and decoding network to obtain the second image.

4. The method according to claim 2, characterized in that: The method also includes: Obtaining a first sample image; the first sample image is a flawless image; Based on the first sample image, construct a second sample image; the second sample image is a defective image; The restoration model is trained by learning using a model composed of a generative image network and a discriminative network.

5. The method according to claim 4, characterized in that The loss function of the restoration model is determined according to the first sample image, the second sample image and the discrimination result of the discriminant network.

6. The method according to claim 1, characterized in that The step of generating a third image based on the first area includes: Performing an affine transformation on the first defect feature of the first region to obtain a plurality of second defect features; Obtaining a first sample image; the first sample image is a flawless image; Each of the second defect features is fused with the first sample image to obtain each of the third images.

7. The method according to claim 6, characterized in that The second defect feature and the first defect feature are defects of different types.

8. An image processing device, characterized in that: include: An obtaining unit, configured to obtain a first image and a second image; The second image is an image obtained after repairing defects of the first image; A processing unit, configured to process the first image and the second image using a local binary pattern algorithm to obtain a first region; The first area is a defect area in the first image; The processing unit is used to generate a third image based on the first area; the third image and the first image have different defect characteristics.

9. An image processing device, characterized in that: include: a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.