Image generation method and apparatus, and computing device cluster

By generating new images with fused features, the problem of insufficient defect samples in defect detection is solved, the detection accuracy and efficiency are improved, and stable defect sample generation is achieved.

CN118735846APending Publication Date: 2024-10-01HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Application Number
CN202310847444.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-03-28
Filing Date
2023-07-11
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the existing technology, the training of neural networks in defect detection requires a large number of defect samples. However, due to the randomness and scarcity of fault occurrence, defect samples are extremely scarce, resulting in a decrease in detection accuracy and making practical applications impossible.

Method used

By obtaining the defect image input by the user, similar normal images are determined from the image library based on the defect image, and a new image with fused features is generated, which is used to train the neural network model and improve the accuracy and efficiency of defect sample generation.

Benefits of technology

It achieves stable defect sample generation, improves the accuracy and efficiency of defect detection, reduces manual input, and ensures the quality and correctness of the generated images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118735846A_ABST
    Figure CN118735846A_ABST
Patent Text Reader

Abstract

The image generation method comprises the following steps: acquiring a defect image input by a user; based on the defect image, K normal images similar to the defect image are determined from an image library; at least one first image is generated on the basis of the defect image and the K normal images, each first image in the at least one first image has fusion features, the fusion features are generated on the basis of features of the Nth level in the defect image and features of the Mth level in the normal images, N is not equal to M, and M is equal to M; the features of the Nth level and the features of the Mth level are semantic features of different levels; and outputting at least one first image, wherein the first image is used for training a neural network model for detecting object defects. The image generation process is operation and combination of high-level semantic features instead of fusion and editing of low-level pixels, so that even if the defect form is complex, stable generation can be realized, the accuracy of defect sample generation is improved, the manual input amount is small, and the efficiency of defect sample generation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on March 28, 2023, with application number 202310315695.1 and application name “A Method and System for Image Generation”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of information technology (IT) technology, and in particular to an image generation method, device and computing device cluster. Background Art

[0003] Defect detection usually refers to the detection of defects on objects such as mechanical workpieces. Defects on mechanical workpieces can include: breakage, oil stains, spots, pits, scratches, color differences, cracks or missing parts, etc. These defects in mechanical workpieces often lead to serious safety hazards and social harm. For example, in railway scenarios, defects in parts on trains (such as wear or breakage) can lead to serious life hazards and social harm; in power grid scenarios, defects in insulators can also lead to serious life hazards and social harm.

[0004] In the related art, a data-driven computer vision defect detection algorithm can be used to detect defects on objects such as mechanical workpieces. However, this method often requires a large number of defect samples to train the neural network (NN). In reality, due to the randomness and scarcity of faults, there is an extreme lack of or even no defect samples, which greatly reduces the accuracy of defect detection using the trained NN and makes it impossible to apply it in practice. Therefore, how to obtain a large number of defect samples is a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides an image generation method, apparatus, computing device cluster, computer storage medium and computer product, which can conveniently obtain a large number of defect samples.

[0006] In a first aspect, the present application provides an image generation method, comprising: obtaining a defect image input by a user; based on the defect image, determining K normal images similar to the defect image from an image library, K ≥ 1; based on the defect image and the K normal images, generating at least one first image, wherein each of the at least one first image has a fusion feature, and the fusion feature is generated based on features of the Nth level in the defect image and features of the Mth level in the normal image, N ≠ M, and the features of the Nth level and the features of the Mth level are semantic features of different levels; outputting at least one first image, and the at least one first image is used to train a neural network model, and the neural network model is used to detect object defects.

[0007] In this way, by decoupling the high-level semantic features contained in the defect image and the normal image, and according to the different defect categories, the features corresponding to the defects in the defect image can be fused with other normal features in the normal image to obtain a new defect image. Since the image generation process is mainly the operation and combination of high-level semantic features, rather than the fusion and editing of low-level pixels, even if the form of the defect is very complex, stable generation can be achieved, which improves the accuracy of defect sample generation; at the same time, the amount of manual input is also less, which improves the efficiency of defect sample generation.

[0008] In a possible implementation, at least one first image is generated based on a defect image and K normal images, including: generating multiple second images based on the defect image and one or more normal images among the K normal images, wherein different second images are generated based on features obtained by fusing features of different levels in the defect image and features of different levels in the normal image; displaying multiple second images; determining a target image in response to a user's target image selection operation, the target image being any one of the multiple second images; based on the level of features in the defect image corresponding to the target image being N and the level of features in the normal image corresponding to the target object being M, and based on the defect image and the remaining normal images among the K normal images, generating at least one image other than the target image in the first image. In this way, the user can select the effect of the first image that he or she expects to generate through the effect presented by the generated second image, so that the first image generated subsequently can meet the user's expectations and improve the accuracy of the first image generation.

[0009] In a possible implementation, the method may further include: obtaining configuration information input by a user, the configuration information including information for representing the values ​​of N and M. In this way, the user can configure N and M in advance to facilitate subsequent automated execution and improve the efficiency of image generation.

[0010] In a possible implementation, based on the defect image, K normal images similar to the defect image are determined from the image library, specifically including: calculating the similarity between the defect image and the normal images in the image library to obtain H similarities; taking the normal images corresponding to K similarities among the H similarities as the required images, the K similarities being the first K similarities after sorting the H similarities from large to small, K≤H. In this way, some normal images similar to the defect image can be screened out from the image library by similarity calculation, thereby ensuring the correctness and rationality of the first image generated subsequently, and improving the stability and authenticity of image generation.

[0011] In a possible implementation, based on the defect image, K normal images similar to the defect image are determined from the image library, specifically including: based on the similarity between the defect image and the normal images in the image library, H normal images are determined from the image library; in response to the image screening operation of the user, K normal images among the H normal images selected by the user are used as the required images. In this way, the user can further screen the screened normal images by manual inspection, thereby improving the accuracy of the screened normal images, thereby ensuring the correctness and rationality of the first image generated subsequently, and improving the stability and authenticity of image generation.

[0012] In a possible implementation, the method may further include: optimizing an image screening model based on K normal images, wherein the image screening model is used to determine normal images from an image library. In this way, the image screening model may be optimized based on the screened normal images, thereby improving the screening capability of subsequent image screening models.

[0013] In a second aspect, the present application provides an image generation device, comprising: an acquisition module and a processing module. The acquisition module is used to acquire a defect image input by a user. The processing module is used to determine K normal images similar to the defect image from an image library based on the defect image, where K ≥ 1. The processing module is also used to generate at least one first image based on the defect image and the K normal images, wherein each of the at least one first image has a fusion feature, and the fusion feature is generated based on the features of the Nth level in the defect image and the features of the Mth level in the normal image, N≠M, and the features of the Nth level and the features of the Mth level are semantic features of different levels. The processing module is also used to output at least one first image, and the at least one first image is used to train a neural network model, and the neural network model is used to detect object defects.

[0014] In one possible implementation, when the processing module generates at least one first image based on the defect image and K normal images, it is specifically used to: generate multiple second images based on the defect image and one or more normal images among the K normal images, wherein different second images are generated based on features obtained by fusing features of different levels in the defect image and features of different levels in the normal image; display multiple second images; determine a target image in response to a user's target image selection operation, the target image being any one of the multiple second images; based on the feature level N in the defect image corresponding to the target image and the feature level M in the normal image corresponding to the target object, and based on the defect image and the remaining normal images among the K normal images, generate at least one image other than the target image in the first image.

[0015] In a possible implementation, the acquisition module is further used to: acquire configuration information input by a user, where the configuration information includes information used to characterize the values ​​of N and M.

[0016] In a possible implementation, when the processing module determines K normal images similar to the defective image from an image library based on the defective image, the processing module is specifically used to: calculate the similarity between the defective image and the normal images in the image library to obtain H similarities; and use the normal images corresponding to K similarities among the H similarities as the required images, the K similarities being the first K similarities after sorting the H similarities from large to small, K≤H.

[0017] In a possible implementation, when the processing module determines K normal images similar to the defective image from an image library based on the defective image, the processing module is specifically used to: determine H normal images from the image library based on the similarity between the defective image and the normal images in the image library; and in response to the user's image screening operation, use K normal images out of the H normal images selected by the user as the required images.

[0018] In a possible implementation, the processing module is further used to: optimize the image screening model based on K normal images, wherein the image screening model is used to determine the normal image from the image library.

[0019] In a third aspect, the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster performs the method described in the first aspect or any possible implementation of the first aspect.

[0020] In a fourth aspect, the present application provides a computer-readable storage medium, including computer program instructions, when the computer program instructions are executed by a computing device, the computing device executes the method described in the first aspect or any possible implementation of the first aspect; or, when the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect or any possible implementation of the first aspect. Exemplarily, the computing device cluster may include one or more computing devices.

[0021] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device, causes the computing device to perform the method described in the first aspect or any possible implementation of the first aspect, or, when executed by a computing device cluster, causes the computing device cluster to perform the method described in the first aspect or any possible implementation of the first aspect. Exemplarily, the computing device cluster may include one or more computing devices.

[0022] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a schematic diagram of the architecture of an image generation system provided in an embodiment of the present application;

[0024] Figure 2 is a schematic diagram of the architecture of another image generation system provided in an embodiment of the present application;

[0025] Figure 3 It is a flowchart of an image generation method provided in an embodiment of the present application;

[0026] Figure 4 is a structural schematic diagram of an image generating device provided in an embodiment of the present application;

[0027] Figure 5 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0028] Figure 6 is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;

[0029] Figure 7 It is a structural diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.

[0031] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.

[0032] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0033] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.

[0034] Generally, defect samples can be increased by manually adding defects to the image. Specifically, edge extraction can be performed on the normal image (i.e., the sample without defects) to map the normal image to a low-dimensional space, thereby obtaining an edge image of the normal image. Then, the edge image is manually edited to add defects. Finally, the edge image with added defects is inversely mapped back to the high-dimensional space to obtain defect samples. Although this method can obtain defect samples, each defect sample requires human participation, resulting in too much manual input. In addition, this method can only add specific defects to the normal image. For example, it is difficult to add defects such as complete damage to the mechanical workpiece, resulting in insufficient diversity of defect samples. At the same time, due to the poor performance of NN, defect details are easily lost during the inverse mapping process.

[0035] In view of this, the embodiment of the present application provides an image generation method that can decouple the high-level semantic features contained in the defect image and the normal image, and fuse the features corresponding to the defects in the defect image with other normal features in the normal image to obtain a new defect image according to the defect category. Since the image generation process is mainly the operation and combination of high-level semantic attributes, rather than the fusion and editing of low-level pixels, even if the form of the defect is very complex, stable generation can be achieved, which improves the accuracy of defect sample generation; at the same time, the amount of manual input is also less, which improves the efficiency of defect sample generation.

[0036] For example, Figure 1 FIG. 1 is a schematic diagram showing the architecture of an image generation system provided by an embodiment of the present application. Figure 1 As shown, the image generation system 100 may include: an image library 110 , an image screening model 120 , a sample visualization component 130 , a feature attribute decoupling and fusion model 140 , and an image generation model 150 .

[0037] The image library 110 may include at least one normal image. Exemplarily, the normal image may be a sample prepared in advance, or may be a sample obtained from the network in real time when authorization is obtained.

[0038] The image screening model 120 can be used to screen out at least one normal image similar to the defective image from the image library 110 based on the similarity between the defective image input by the user and the normal image contained in the image library 110, so as to reduce the semantic difference between the normal image and the defective image, greatly improve the stability of subsequent feature fusion, and reduce the collapse. Exemplarily, the image screening model 120 can first extract features from the defective image and the normal image respectively; then calculate the similarity between the features of the extracted defective image and the features of the normal image by cosine similarity, euclidean distance, etc.; finally, sort the similarities from large to small, and use the normal images corresponding to the first k (k ≥ 1) similarities as the screened images. Of course, the similarities can also be sorted from small to large, and the normal images corresponding to the last k similarities can be used as the screened images. In some embodiments, the image recommendation model 120 can be, but is not limited to, NN, such as convolutional neural networks (CNN) or deep neural networks (DNN).

[0039] The sample visualization component 130 can be used to display the normal images screened by the image screening model 120, so that the user can screen by manual inspection to improve the accuracy of the screened images. For example, when the image screening model 120 screens out H normal images, the H normal images can be displayed by the sample visualization component 130. Then, the user can select K normal images to be retained from the H normal images, and these K normal images are the normal images to be used later. In addition, the sample visualization component 130 can also feed back the results of the user's screening to the image screening model 120, so that the image screening model 120 is optimized based on the user's screening results, thereby improving the accuracy of the screening results of the subsequent image screening model 120. In addition, the sample visualization component 130 can also be used to display different types of defective images generated by the image generation model 150, so that the user can check by manual inspection to select the desired type of defective image, thereby ensuring the correctness and rationality of the defective image generated by the image generation model 150, and improving the stability and authenticity of image generation. Furthermore, the sample visualization component 130 can feed back the user's verification result to the image generation model 150, so that the image generation model 150 can subsequently output a defect image of the same type as the defect image selected by the user, so that subsequent automatic verification can be achieved through a one-time verification by the user, thereby improving the efficiency of image generation. In some embodiments, the sample visualization component 130 can be, but is not limited to, a device with a display screen.

[0040] The feature attribute decoupling and fusion model 140 can be used to decouple high-level semantic features in the defect image input by the user and the normal image after manual screening, so as to obtain multiple different levels of semantic features of the defect image and multiple different levels of semantic features of the normal image. Exemplarily, "different levels" can be understood as "different levels of abstraction".

[0041] Furthermore, the feature attribute decoupling and fusion model 140 can also be used to fuse the semantic features of a certain level of the normal image and the semantic features of a certain level of the defective image, for example, by linear addition, to create at least one new feature. The created feature can be called a "fused feature".

[0042] The image generation model 150 can be used to generate a defect image corresponding to the feature based on the feature created by the feature attribute decoupling and fusion model 140. In some embodiments, the image generation model 150 can be, but is not limited to, a NN, such as CNN, DNN, GAN, etc.

[0043] In addition, after generating the defect image, the image generation model 150 can transmit the generated defect image to the sample visualization component 130, so that the user can select the type of defect image they need through the sample visualization component 130, for example, selecting a defect image generated by features obtained by fusing the semantic features of the 10th level of the normal image and the semantic features of the 3rd level of the defect image, or selecting a defect image generated by features obtained by fusing the semantic features of the 4th level of the normal image and the semantic features of the 10th level of the defect image.

[0044] Furthermore, the image generation model 150 can output defect images of the same type as the one selected by the user through the sample visualization component 130. Exemplarily, after the user selects a defect image of the corresponding type through the sample visualization component 130, the image generation model 150 can record the type selected by the user and subsequently output defect images of that type until the user selects it again. Of course, the image generation model 150 can also periodically (for example, every 1 minute, 10 minutes, etc.) display the defect images it generates through the sample visualization component 130 for the user to select, or can display the defect images through the sample visualization component 130 every time after the defect images are generated for the user to select, which can be determined according to the actual situation.

[0045] The above is an introduction to the image generation system 100 provided in the embodiment of the present application. Based on the image generation system 100, the embodiment of the present application also provides another image generation system. The image generation system can be as follows Figure 2 As shown. Among them, Figure 2 The image generation system 200 shown in FIG. Figure 1 The main difference between the image generation system 100 shown in the figure is that the image generation system 200 does not need to manually screen the normal images screened out by the image screening model 120, but directly inputs them into the feature attribute decoupling and fusion model 140 for processing.

[0046] In addition, Figure 1 The image generation system 100 and Figure 2 In the image generation system 200 shown, the user can also pre-configure the semantic features of a certain level in the normal image and the semantic features of a certain level in the defect image. For example, before or after the user inputs the defect image, a configuration information can be input. The configuration information may include information about the value of a certain level in the normal image required by the user and the value of a certain level in the defect image required by the user. Afterwards, the feature attribute decoupling and fusion model 140 can extract the semantic features of a specific level (i.e., the level required by the user) from the normal image and the defect image respectively, and fuse them to obtain the fused features. The image generation model 150 can directly use the acquired fused features to generate a new image and output the new image.

[0047] In some embodiments, the aforementioned image generation system can be, but is not limited to, deployed on a cloud computing platform. The cloud computing platform refers to an Internet-based computing model that provides various computing resources and services through the network, including computing power, storage space, databases, network functions, etc. The cloud computing platform can aggregate and centrally manage computing resources through virtualization technology, and users can obtain and use these resources on demand through the cloud computing platform without owning and maintaining their own physical equipment and infrastructure. Cloud computing platforms are usually composed of large data centers that have high-performance computing devices (such as servers, etc.), storage devices, and network devices, as well as reliable power and network connections.

[0048] The above is an introduction to the image generation system provided in the embodiment of the present application. Next, based on the image generation system described above, an image generation method provided in the embodiment of the present application is introduced. Among them, the method is proposed based on the image generation system described above, and part or all of the content of the method can be referred to the description above.

[0049] For example, Figure 3 The flowchart of an image generation method provided by an embodiment of the present application is shown. It can be understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. For ease of description, the following description is based on the execution of a cloud computing platform as an example. Figure 3 As shown, the image generation method may include the following steps:

[0050] S301. The cloud computing platform obtains a defect image input by a user.

[0051] In this embodiment, the user can upload the defect image to the cloud computing platform through the client associated with the cloud computing platform. After the user completes the upload, the cloud computing platform can obtain the defect image input by the user.

[0052] S302: The cloud computing platform determines, based on the defect image, K normal images similar to the defect image from an image library, where K≥1.

[0053] In this embodiment, the cloud computing platform can extract the features of the defect image and the features of the normal image in the image library above it through the neural network model. Then, the similarity between the defect image and the normal image in the image library above it is calculated by the cosine similarity algorithm to obtain H similarities. Finally, the cloud computing platform can use the normal images corresponding to K similarities among the H similarities as the required images. Among them, the K similarities are the first K similarities after sorting the H similarities from large to small, K≤H.

[0054] In some embodiments, after calculating H similarities, the cloud computing platform can present the normal images corresponding to the H similarities to the user through the client. Then, the user can perform image screening operations on the client. After the user completes the image screening, the cloud computing platform can use the K normal images selected by the user as the required images, K≤H.

[0055] In some embodiments, after acquiring K normal images, the cloud computing platform may also use these K normal images to optimize the image screening model used to determine normal images from the image library, so as to enhance the subsequent screening capability of the image screening model.

[0056] S303. The cloud computing platform generates at least one first image based on the defect image and K normal images, wherein each first image has a fusion feature, and the fusion feature is generated based on the features of the Nth level in the defect image and the features of the Mth level in the normal image, N≠M, and the features of the Nth level and the features of the Mth level are semantic features of different levels.

[0057] In this embodiment, after the cloud computing platform obtains the defect image and K normal images, at least one first image can be generated from these images. Each first image has a fusion feature. The fusion feature is generated based on the N-th level feature in the defect image and the M-th level feature in the normal image, N≠M, and the N-th level feature and the M-th level feature are semantic features of different levels. Exemplarily, the semantic feature may include, but is not limited to, one or more of shape, category, edge, corner point, color, and texture.

[0058] As a possible implementation method, the user inputs configuration information to the cloud computing platform through the client before or after inputting the defect image. The configuration information may include information for representing the values ​​of N and M. For example, a feature level selection interface may be displayed on the client, and the user may select the features he wants to fuse in the selection interface, such as fusing the high-level semantic features of the defect image with the low-level semantic features of the normal image, or fusing the low-level semantic features of the defect image with the high-level semantic features of the normal image, and so on. At the same time, in the fusion method selected by the user, each fusion method corresponds to the corresponding information of the values ​​of N and M, for example: when the fusion method is "fusing the high-level semantic features of the defect image with the low-level semantic features of the normal image", N = 10, M = 5, and so on. After obtaining the configuration information, the cloud computing platform can extract the semantic features of the Nth level from the defect image through a neural network, and extract the semantic features of the Mth level from each normal image. Then, the cloud computing platform can fuse the semantic features of the Nth level with the extracted semantic features of each Mth level, such as linear addition, to obtain K fused features. Finally, the cloud computing platform can process each fused feature through a neural network to obtain the first image corresponding to each fused feature.

[0059] As another possible implementation, the cloud computing platform may also first generate multiple second images based on the defect image and one or more normal images among the determined K normal images. Among them, different second images are generated based on features obtained by fusing features of different levels in the defect image and features of different levels in the normal image. For example, taking a normal image as an example, the cloud computing platform can extract multiple semantic features of different levels from the defect image through a neural network, and extract multiple semantic features from the normal image. Then, the cloud computing platform can fuse the semantic features of a certain level in the defect image with the semantic features of a certain level in the normal image to obtain a fused feature. Since the cloud computing platform can extract semantic features of multiple different levels in the defect image and the normal image respectively, multiple fused features can be obtained through the above-mentioned feature fusion method. Finally, the cloud computing platform can process each fused feature separately to obtain the second image corresponding to each fused feature.

[0060] Furthermore, after generating multiple second images, the cloud computing platform can display the multiple second images. For example, the cloud computing platform can transmit the generated second images to the client used by the user to display these images on the client. Then, the user can filter out the target image that meets his expectations from these second images based on his own needs. For example, the user can perform an image selection operation through the client to select the target image he needs from these second images. Afterwards, the client can transmit the user's selection result to the cloud computing platform. Finally, the cloud computing platform can be informed of the target image selected by the user.

[0061] Furthermore, the cloud computing platform can generate at least one image other than the target image in the first image based on the level of features in the defect image corresponding to the target image as N and the level of features in the normal image corresponding to the target object as M, and based on the defect image and the remaining normal images in the K normal images determined above. For example, when the target image is generated by the fusion feature obtained by fusing the features of the 10th level in the defect image and the features of the 4th level in the normal image, then N=10 and M=4. In addition, for the generation process of the first image, please refer to the above description, which will not be repeated here.

[0062] S304. The cloud computing platform outputs at least one first image generated, and the at least one first image is used to train a neural network model, and the neural network model is used to detect object defects.

[0063] In this embodiment, after generating the first image, the cloud computing platform may output the first image. For example, the first image may be stored in a storage device, or transmitted to a device specified by a user, etc. The first image is mainly used to train a neural network model for detecting object defects.

[0064] In this way, by decoupling the high-level semantic features contained in the defect image and the normal image, and according to the different defect categories, the features corresponding to the defects in the defect image can be fused with other normal features in the normal image to obtain a new defect image. Since the image generation process is mainly the operation and combination of high-level semantic features, rather than the fusion and editing of low-level pixels, even if the form of the defect is very complex, stable generation can be achieved, which improves the accuracy of defect sample generation; at the same time, the amount of manual input is also less, which improves the efficiency of defect sample generation.

[0065] It should be understood that Figure 3The image generation method shown is introduced with the cloud computing platform as the execution subject. The process of the image generation method when other devices or clients are the execution subjects can refer to the execution process of the cloud computing platform, which will not be described here. In addition, the image generation method when other devices or clients are the execution subjects is still within the protection scope of this application.

[0066] The above is an introduction to the image generation method provided in the embodiment of the present application. Next, based on the method in the above embodiment, an image generation device provided in the embodiment of the present application is introduced.

[0067] For example, Figure 4 FIG. 1 is a schematic diagram showing the structure of an image generating device provided by an embodiment of the present application. Figure 4 As shown, the image generating device 400 may include: an acquisition module 401 and a processing module 402. The acquisition module 401 is used to acquire a defect image input by a user. The processing module 402 is used to determine K normal images similar to the defect image from an image library based on the defect image, where K ≥ 1. The processing module 402 is also used to generate at least one first image based on the defect image and the K normal images, wherein each of the at least one first image has a fusion feature, and the fusion feature is generated based on the features of the Nth level in the defect image and the features of the Mth level in the normal image, N≠M, and the features of the Nth level and the features of the Mth level are semantic features of different levels. The processing module 402 is also used to output at least one first image, and the at least one first image is used to train a neural network model, and the neural network model is used to detect object defects.

[0068] In some embodiments, when the processing module 402 generates at least one first image based on the defect image and K normal images, it is specifically used to: generate multiple second images based on the defect image and one or more normal images among the K normal images, wherein different second images are generated based on features obtained by fusing features of different levels in the defect image and features of different levels in the normal image; display multiple second images; determine a target image in response to a user's target image selection operation, where the target image is any one of the multiple second images; based on the feature level N in the defect image corresponding to the target image and the feature level M in the normal image corresponding to the target object, and based on the defect image and the remaining normal images among the K normal images, generate at least one image other than the target image in the first image.

[0069] In some embodiments, the acquisition module 401 is further used to: acquire configuration information input by a user, where the configuration information includes information used to characterize the values ​​of N and M.

[0070] In some embodiments, when the processing module 402 determines K normal images similar to the defective image from the image library based on the defective image, it is specifically used to: calculate the similarity between the defective image and the normal image in the image library to obtain H similarities; take the normal images corresponding to K similarities among the H similarities as the required images, the K similarities are the first K similarities after sorting the H similarities from large to small, K≤H.

[0071] In some embodiments, when the processing module 402 determines K normal images similar to the defective image from the image library based on the defective image, it is specifically used to: determine H normal images from the image library based on the similarity between the defective image and the normal images in the image library; and in response to the user's image screening operation, use K normal images out of the H normal images selected by the user as the required images.

[0072] In some embodiments, the processing module 402 is further used to: optimize the image screening model based on K normal images, wherein the image screening model is used to determine the normal image from the image library.

[0073] In some embodiments, Figure 4 The acquisition module 401 and the processing module 402 shown in the figure can be implemented by software or by hardware. For example, the implementation of the acquisition module 401 is described below by taking the acquisition module 401 as an example. Similarly, the implementation of the processing module 402 can refer to the implementation of the acquisition module 401.

[0074] As an example of a software functional unit, the acquisition module 401 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the acquisition module 401 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.

[0075] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0076] As an example of a hardware functional unit, the acquisition module 401 may include at least one computing device, such as a server, etc. Alternatively, the acquisition module 401 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0077] The multiple computing devices included in the acquisition module 401 can be distributed in the same region or in different regions. The multiple computing devices included in the acquisition module 401 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the acquisition module 401 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0078] It should be noted that, in other embodiments, the acquisition module 401 can be used to execute any step in the image generation method described in the above embodiment, and the processing module 402 can be used to execute any step in the image generation method described in the above embodiment. The steps that the acquisition module 401 and the processing module 402 are responsible for implementing can be specified as needed, and the acquisition module 401 and the processing module 402 respectively implement different steps in the image generation method described in the above embodiment to achieve Figure 4 The overall functionality of the image generating apparatus 400 is shown.

[0079] The present application also provides a computing device 500. Figure 5As shown, computing device 500 includes: bus 502, processor 504, memory 506 and communication interface 508. Processor 504, memory 506 and communication interface 508 communicate through bus 502. Computing device 500 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in computing device 500.

[0080] The bus 502 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The bus 504 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 504 may include a path for transmitting information between various components of the computing device 500 (eg, the memory 506, the processor 504, and the communication interface 508).

[0081] The processor 504 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0082] The memory 506 may include a volatile memory, such as a random access memory (RAM). The processor 504 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0083] The memory 506 stores executable program codes, and the processor 504 executes the executable program codes to respectively implement the aforementioned Figure 4 The functions of the acquisition module 401 and the processing module 402 shown in the above embodiment are implemented to realize the image generation method described in the above embodiment. That is, the memory 506 stores instructions for executing the image generation method described in the above embodiment.

[0084] Alternatively, the memory 506 stores executable codes, and the processor 504 executes the executable codes to respectively implement the aforementioned Figure 4 The functions of the image generating apparatus 400 shown in the figure are implemented to realize the image generating method described in the above embodiment. That is, the memory 506 stores instructions for executing the image generating method described in the above embodiment.

[0085] The communication interface 503 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 500 and other devices or a communication network.

[0086] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0087] like Figure 6 As shown, the computing device cluster includes at least one computing device 500. The memory 506 in one or more computing devices 500 in the computing device cluster may store the same instructions for executing the image generation method described in the above embodiment.

[0088] In some possible implementations, the memory 506 of one or more computing devices 500 in the computing device cluster may also store partial instructions for executing the image generation method described in the above embodiment. In other words, the combination of one or more computing devices 500 may jointly execute instructions for executing the image generation method described in the above embodiment.

[0089] It should be noted that the memory 506 in different computing devices 500 in the computing device cluster may store different instructions, which are respectively used to execute the aforementioned Figure 4 The image generating apparatus 400 shown in FIG. 4 is a partial function. That is, the instructions stored in the memory 506 in different computing devices 500 can implement the functions of one or more modules in the acquisition module 401 and the processing module 402 .

[0090] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 7 A possible implementation is shown. Figure 7As shown, two computing devices 500A and 500B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 506 in the computing device 500A stores instructions for executing the functions of the acquisition module 401. At the same time, the memory 506 in the computing device 500B stores instructions for executing the functions of the processing module 402.

[0091] It should be understood that Figure 7 The functions of the computing device 500A shown in FIG. 5A may also be completed by multiple computing devices 500. Similarly, the functions of the computing device 500B may also be completed by multiple computing devices 500.

[0092] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Figure 6 and Figure 7 The connection mode of the computing device cluster is different in that the memory 506 in one or more computing devices 500 in the computing device cluster may store the same instructions for executing the method in the above embodiment.

[0093] In some possible implementations, the memory 506 of one or more computing devices 500 in the computing device cluster may also store partial instructions for executing the aforementioned data processing method. In other words, the combination of one or more computing devices 500 may jointly execute instructions for executing the aforementioned data processing method.

[0094] Based on the method in the above embodiment, the embodiment of the present application provides a computer-readable storage medium, including computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the above embodiment; or, when the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method in the above embodiment. Exemplarily, the computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0095] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product containing instructions, which, when executed by a computing device, enables the computing device to execute the method in the above embodiment, or, when executed by a computing device cluster, enables the computing device cluster to execute the method in the above embodiment.

[0096] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0097] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0098] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0099] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.

[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present application.

Claims

1. An image generation method, characterized in that: The method comprises: Obtaining a defect image input by a user; Based on the defect image, determine K normal images similar to the defect image from an image library, where K ≥ 1; Based on the defect image and the K normal images, at least one first image is generated, wherein each first image in the at least one first image has a fusion feature, and the fusion feature is generated based on the feature of the Nth level in the defect image and the feature of the Mth level in the normal image, N≠M, and the feature of the Nth level and the feature of the Mth level are semantic features of different levels; The at least one first image is outputted, and the at least one first image is used to train a neural network model, and the neural network model is used to detect defects of the object.

2. The method according to claim 1, characterized in that The step of generating at least one first image based on the defective image and the K normal images comprises: Based on the defect image and one or more normal images among the K normal images, generating a plurality of second images, wherein different second images are generated based on features obtained by fusing features of different levels in the defect image and features of different levels in the normal image; displaying the plurality of second images; In response to the user's target image selection operation, determining the target image, where the target image is any one of the plurality of second images; Based on the fact that the level of features in the defect image corresponding to the target image is N and the level of features in the normal image corresponding to the target object is M, and based on the defect image and the remaining normal images among the K normal images, an image other than the target image in the at least one first image is generated.

3. The method according to claim 1, characterized in that The method further comprises: The configuration information input by the user is acquired, where the configuration information includes information used to represent the values ​​of N and M.

4. The method according to any one of claims 1 to 3, characterized in that: The determining, based on the defect image, K normal images similar to the defect image from an image library specifically includes: Calculating the similarity between the defect image and the normal image in the image library to obtain H similarities; The normal images corresponding to K similarities among the H similarities are taken as the required images, and the K similarities are the first K similarities after sorting the H similarities from large to small, and K≤H.

5. The method according to any one of claims 1 to 3, characterized in that: The determining, based on the defect image, K normal images similar to the defect image from an image library specifically includes: Determining H normal images from the image library based on the similarity between the defect image and the normal images in the image library; In response to the image screening operation of the user, K normal images among the H normal images selected by the user are taken as required images.

6. The method according to claim 5, characterized in that The method further comprises: Based on the K normal images, an image screening model is optimized, wherein the image screening model is used to determine a normal image from the image library.

7. An image generating device, characterized in that: include: An acquisition module, used for acquiring a defect image input by a user; A processing module, configured to determine, based on the defect image, K normal images similar to the defect image from an image library, where K≥1; The processing module is further used to generate at least one first image based on the defect image and the K normal images, wherein each first image in the at least one first image has a fusion feature, and the fusion feature is generated based on the N-th level feature in the defect image and the M-th level feature in the normal image, N≠M, and the N-th level feature and the M-th level feature are semantic features of different levels; The processing module is further used to output the at least one first image, and the at least one first image is used to train a neural network model, and the neural network model is used to detect object defects.

8. The device according to claim 7, characterized in that When the processing module generates at least one first image based on the defect image and the K normal images, it is specifically used to: Based on the defect image and one or more normal images among the K normal images, generating a plurality of second images, wherein different second images are generated based on features obtained by fusing features of different levels in the defect image and features of different levels in the normal image; displaying the plurality of second images; In response to the user's target image selection operation, determining the target image, where the target image is any one of the plurality of second images; Based on the fact that the level of features in the defect image corresponding to the target image is N and the level of features in the normal image corresponding to the target object is M, and based on the defect image and the remaining normal images among the K normal images, an image other than the target image in the at least one first image is generated.

9. The device according to claim 7, characterized in that The acquisition module is further used for: The configuration information input by the user is acquired, where the configuration information includes information used to represent the values ​​of N and M.

10. The device according to any one of claims 7 to 9, characterized in that: When the processing module determines K normal images similar to the defective image from an image library based on the defective image, it is specifically used to: Calculating the similarity between the defect image and the normal image in the image library to obtain H similarities; The normal images corresponding to K similarities among the H similarities are taken as the required images, and the K similarities are the first K similarities after sorting the H similarities from large to small, and K≤H.

11. The device according to any one of claims 7 to 9, characterized in that: When the processing module determines K normal images similar to the defective image from the image library based on the defective image, it is specifically used to: Determining H normal images from the image library based on the similarity between the defect image and the normal images in the image library; In response to the image screening operation of the user, K normal images among the H normal images selected by the user are taken as required images.

12. The device according to claim 11, characterized in that The processing module is further used for: Based on the K normal images, an image screening model is optimized, wherein the image screening model is used to determine a normal image from the image library.

13. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1-6.

14. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the instructions are executed by a computing device cluster, the computing device cluster enables the computing device cluster to perform the method according to any one of claims 1 to 6, wherein the computing device cluster comprises at least one computing device.

15. A computer program product comprising instructions, characterized in that When the instruction is executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 6, wherein the computing device cluster includes at least one computing device.

Citation Information

Patent Citations

  • Method for generating confrontation image based on multi-level features

    CN108765512A

  • Defect image sample generation method and device and panel defect detection method

    CN111524100A

  • Defect image generation method based on generative adversarial network

    CN114022586A

  • Industrial defect detection method based on few defect samples

    CN114897865A

Cited By

  • Intelligent detection and classification system applied to PCBA manufacturing defects

    CN119313665A