Image classification method and device and style transfer model training method and device

The style transfer model converts the actual scene image style into the training set style, which solves the problem of accuracy decline caused by inconsistent data styles in practical applications of deep learning models, improves the accuracy of image classification, and achieves it under unsupervised training Highly accurate diagnosis of fundus diseases.

CN111753908BInactive Publication Date: 2024-10-01BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010591392.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-24
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In practical applications, the accuracy of deep learning models is significantly reduced due to the inconsistency between the data style of the training set and the actual scene. Especially in the medical field such as fundus disease diagnosis, the difference in data style between the laboratory and the actual scene leads to the accuracy of the model in actual deployment. Poor sex.

Method used

The style transfer model is used to convert the image style in the actual scene into the style of the training set, and the converted image is input into the image classification model. The loss function is calculated through the style transfer network and image feature extractor, and the network parameters are adjusted to achieve style transfer. This enables the image classification model to achieve the accuracy of laboratory scenes in actual scenarios.

Benefits of technology

It effectively avoids the problem of decreased accuracy of the deep learning model caused by the difference between the training set and the actual scene, improves the accuracy of image classification, and achieves high-accuracy diagnosis results without the need for professional annotation of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753908B_ABST
    Figure CN111753908B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose an image classification method and device and a style transfer model training method and device, which relate to the fields of deep learning, cloud computing and computer vision in artificial intelligence. The specific implementation scheme is: inputting a first style image into a style transfer model to obtain a second style image corresponding to the first style image; inputting the second style image into an image classification model to obtain a classification result of the second style image; wherein the style transfer model is trained based on sample images of the first style and sample images of the second style; and the image classification model is trained based on sample images of the second style. The embodiments of the present application can improve the accuracy of image classification. The embodiments of the present application can be applied to fundus screening.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to the fields of deep learning, cloud computing, and computer vision in artificial intelligence. Background Art

[0002] In the application of deep learning models, sometimes the training set sample data used in the model training process is inconsistent with the data style processed during the actual use of the model, resulting in a significant decrease in the accuracy of the model in the actual scenario compared to the laboratory accuracy.

[0003] For example, in recent years, algorithms for automatic diagnosis of fundus diseases based on fundus photos based on deep learning have been widely studied and applied. Such algorithms can accurately screen out various fundus diseases, glaucoma, etc. under certain conditions. However, due to the sensitivity of the medical industry, fundus photo data is usually not shared. Therefore, the fundus images used to train deep learning models in the laboratory are often not from the same type of fundus camera as the fundus images obtained in actual scenes, resulting in different styles of the two fundus images; this difference in image style leads to a significant decrease in the accuracy of deep learning models in actual use scenarios compared to laboratory accuracy.

[0004] In order to solve the problem of decreased accuracy of deep learning models caused by the difference between the training set and the actual scene, the current general method is to add some actual scene samples during model training and confuse the features that distinguish the training set and the actual scene, so as to guide the deep learning model used for classification to only learn the features and discrimination patterns that are truly effective for classification (such as disease diagnosis). The disadvantage of this method is that it is necessary to add samples from the actual scene when training the classification model (such as the disease discrimination model), which makes it unable to meet the needs of rapid deployment in multiple scenes. At the same time, it usually requires that the samples in the actual scene are labeled, and the quality of the labels in the actual scenes in some fields is far inferior to that in the laboratory scenes. Therefore, this type of method has a poor actual effect on improving the accuracy of the classification model. Summary of the invention

[0005] The present application provides an image classification method and device and a style transfer model training method and device.

[0006] According to a first aspect of the present application, there is provided an image classification method, comprising:

[0007] Inputting the first style image into the style transfer model to obtain a second style image corresponding to the first style image;

[0008] The second style image is input into the image classification model to obtain the classification result of the second style image; wherein,

[0009] The style transfer model is trained based on sample images of the first style and sample images of the second style; and the image classification model is trained based on sample images of the second style.

[0010] According to a second aspect of the present application, a style transfer model training method is provided, comprising:

[0011] A first residual generation network, a second residual generation network, an image feature extractor, a first discriminator and a second discriminator are set; wherein the first residual generation network is used to generate a residual of the first style image converted into the second style image; the second residual generation network is used to generate a residual of the second style image converted into the first style image; the image feature extractor is used to extract feature information of the first style image or the second style image; the first discriminator is used to determine whether the image is the first style image; the second discriminator is used to determine whether the image is the second style image;

[0012] Input a training sample, and calculate a loss function using the output results of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator;

[0013] Adjust parameters in at least one of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator so that the value of the loss function tends to an optimal value.

[0014] According to a third aspect of the present application, there is provided an image classification device, comprising:

[0015] A first input module, used to input the first style image into the style transfer model to obtain a second style image corresponding to the first style image;

[0016] The second input module is used to input the second style image into the image classification model to obtain the classification result of the second style image; wherein,

[0017] The style transfer model is trained based on sample images of the first style and sample images of the second style; and the image classification model is trained based on sample images of the second style.

[0018] According to a fourth aspect of the present application, a style transfer model training device is provided, comprising:

[0019] A setting module is used to set a first residual generation network, a second residual generation network, an image feature extractor, a first discriminator, and a second discriminator; wherein the first residual generation network is used to generate a residual of a first style image converted into a second style image; the second residual generation network is used to generate a residual of a second style image converted into the first style image; the image feature extractor is used to extract feature information of the first style image or the second style image; the first discriminator is used to determine whether the image is a first style image; and the second discriminator is used to determine whether the image is a second style image;

[0020] A calculation module, used for inputting training samples and calculating a loss function using output results of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator;

[0021] The optimization module is used to adjust the parameters of at least one of the first residual generation network, the second residual generation network, the first discriminator and the second discriminator so that the value of the loss function tends to an optimal value.

[0022] According to a fifth aspect of the present application, an electronic device is provided, including:

[0023] at least one processor; and

[0024] a memory communicatively connected to at least one processor; wherein,

[0025] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that the at least one processor can execute the method in any of the above embodiments.

[0026] According to a sixth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to enable a computer to execute the method in any of the above embodiments.

[0027] According to a seventh aspect of the present application, a computer program product is provided, comprising a computer program, wherein the computer program implements the method as described above when executed by a processor.

[0028] The embodiment of the present application uses a style transfer model to transfer the style of the first style image, and inputs the obtained second style image into the image classification model; wherein the image classification model is trained based on the sample image of the second style. Since the style of the image processed by the image classification model during actual image classification is consistent with the style of the image used during training, the problem of decreased accuracy of the deep learning model caused by the difference between the training set and the actual scene is avoided, and thus the situation where the accuracy of the actual scene is significantly lower than the accuracy in the laboratory can be avoided, thereby improving the accuracy of image classification.

[0029] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0031] Figure 1 This is a schematic diagram of an implementation flow of an image classification method according to an embodiment of the present application;

[0032] Figure 2 is a schematic diagram of a style transfer network structure in an embodiment of the present application;

[0033] Figure 3 It is a schematic diagram of a flow chart of a style transfer model training method according to an embodiment of the present application;

[0034] Figure 4 It is a schematic diagram of a loss function calculation method of a style transfer model in an embodiment of the present application;

[0035] Figure 5 It is a schematic diagram of an implementation flow of calculating a cyclic loss function in a style transfer model training method according to an embodiment of the present application;

[0036] Figure 6 It is a schematic diagram of an implementation process of calculating an adversarial loss function in a style transfer model training method according to an embodiment of the present application;

[0037] Figure 7 is a schematic diagram of the structure of an image classification device according to an embodiment of the present application;

[0038] Figure 8 It is a schematic diagram of the structure of a style transfer model training device in an embodiment of the present application;

[0039] Fig. 9 It is a schematic diagram of the structure of another style transfer model training device according to an embodiment of the present application.

[0040] Fig.10 It is a block diagram of an electronic device used to implement the embodiment of the present application. DETAILED DESCRIPTION

[0041] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0042] The embodiment of the present application proposes an image classification method that can solve the problem of low accuracy of the image classification model caused by the difference in image style between the training set and the actual scene. The embodiment of the present application designs a style transfer model to convert the style of the image in the actual scene into the style of the image in the training set; the image after style transfer (i.e., style conversion) is then input into the image classification model, and a high-accuracy classification result can be obtained.

[0043] Figure 1 This is a schematic diagram of an implementation flow of an image classification method according to an embodiment of the present application, including:

[0044] Step S101: inputting a first style image into a style transfer model to obtain a second style image corresponding to the first style image;

[0045] Step S102: input the second style image into an image classification model to obtain a classification result of the second style image; wherein,

[0046] The style transfer model is trained based on sample images of the first style and sample images of the second style; and the image classification model is trained based on sample images of the second style.

[0047] The style of the above-mentioned image may be related to the model of the camera used to take the image. For example, the first-style image includes an image taken by a first-model camera, and the second-style image includes an image taken by a second-model camera.

[0048] The second style image corresponding to the first style image includes: an image having the same image content as the first style image and conforming to the shooting style of a camera of the second model.

[0049] That is to say, for the same target, the image taken by the first model of camera is the first style image, and the image taken by the second model of camera is the second style image; the content of these two images is the same, so they correspond to each other. The style transfer model can be used to transfer the style of the first style image and change it into the corresponding second style image. Since the image classification model is trained based on the sample images of the second style, the classification accuracy of the actual scene can basically reach the classification accuracy of the laboratory scene, thereby improving the accuracy of image classification.

[0050] Taking the application of an image classification model to the diagnosis of fundus photographs as an example, in some embodiments, the image classification model is a disease diagnosis model. Figure 2 Schematic diagram of a style transfer network structure in an embodiment of the present application. Figure 2In the embodiment, the first style is specifically the fundus image style in the actual scene, and the second style is specifically the fundus image style in the laboratory scene.

[0051] Figure 2 The following three steps are mainly shown:

[0052] First, based on actual scene data without disease labels and laboratory scene data with disease labels, a style transfer model can be obtained through unsupervised adversarial training.

[0053] Second, based on the laboratory scene data containing disease labels, a disease diagnosis model suitable for the laboratory scene can be obtained through common supervised training. Optionally, the disease diagnosis model is a convolutional neural network.

[0054] Third, for the fundus image of the real scene, first input it into the style transfer model in the above step one to obtain a fundus image similar to the laboratory scene; then input this migrated fundus image into the disease diagnosis model in the above step two to obtain a highly accurate diagnosis result (the diagnosis result can be considered as a classification result).

[0055] In some embodiments, the style transfer model includes a residual generation network including a convolutional layer and a pooling layer; and the image classification model includes a convolutional neural network.

[0056] The present application also proposes a style transfer model training method. Figure 3 : is a schematic diagram of a flow chart of a style transfer model training method according to an embodiment of the present application, including:

[0057] Step S301: setting a first residual generation network, a second residual generation network, an image feature extractor, a first discriminator and a second discriminator; wherein,

[0058] The first residual generation network is used to generate the residual of the first style image converted into the second style image;

[0059] The second residual generation network is used to generate the residual of the second style image converted into the first style image;

[0060] The image feature extractor is used to extract feature information of the first style image or the second style image;

[0061] The first discriminator is used to determine whether the image is a first style image;

[0062] The second discriminator is used to determine whether the image is a second style image;

[0063] Step S302: input a training sample, and calculate a loss function using the output results of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator;

[0064] Step S303: adjusting parameters in at least one of the first residual generation network, the second residual generation network, the first discriminator and the second discriminator so that the value of the loss function tends to an optimal value.

[0065] In some embodiments, the first style transfer model is used to perform style transfer on the first style image to obtain a corresponding second style image; the first style transfer model includes the first residual generation network. The second style transfer model is used to perform style transfer on the second style image to obtain a corresponding first style image; the second style transfer model includes the second residual generation network.

[0066] In some embodiments, the above steps S302 and S303 may be repeatedly performed. For example, a batch of training samples are input and the loss function is calculated, and the parameters in the above network are adjusted so that the loss function tends to the optimal value; then a batch of training samples are input again and the loss function is calculated, and the parameters are readjusted so that the loss function tends to the optimal value; until the value of the loss function reaches the ideal range, the training of the style transfer model is terminated.

[0067] In some embodiments, the above loss function includes a cyclic loss function and an adversarial loss function.

[0068] Figure 4 It is a schematic diagram of a method for calculating a loss function of a style transfer model in an embodiment of the present application.

[0069] Figure 4 The contents are explained as follows:

[0070] a: Image from model A; corresponds to the first style image mentioned above.

[0071] b: Image from model B; corresponds to the second style image mentioned above.

[0072] F: The first residual generation network, which consists of convolution and pooling layers and is responsible for generating the residual from model A to model B.

[0073] G: The second residual generation network, which consists of convolution and pooling layers and is responsible for generating the residual from model A to model B.

[0074] a B : Image a converted to the style of model B.

[0075] b A : Converted to style image b of model A.

[0076] f: Feature extractor for the model.

[0077] D A : A discriminator that determines whether the image is from model A. Corresponds to the first discriminator mentioned above.

[0078] D B : A discriminator that determines whether the image is from model B. Corresponds to the second discriminator mentioned above.

[0079] L cyc : Cycle loss, used to guide the image after double migration of F and G to be as similar as possible to the original image. Figure 4 Two cycle losses, namely the first cycle loss and the second cycle loss, are shown in FIG.

[0080] Reference Figure 4 In some embodiments, the process of calculating the cycle loss function is as follows Figure 5 As shown, including:

[0081] Step S501: inputting a sample image of the first style into a first style transfer model including a first residual generation network to obtain a corresponding second style image; inputting the second style image into a second residual generation network, adding the calculation result to the calculation result obtained by inputting the sample image of the first style into the first residual generation network, and calculating the first cycle loss using the addition result;

[0082] Step S502: inputting the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image; inputting the first style image into the first residual generation network, adding the calculation result and the calculation result obtained by inputting the sample image of the second style into the second residual generation network, and calculating the second cycle loss using the addition result;

[0083] Step S503: Determine a loop loss function using the first loop loss and the second loop loss.

[0084] There is no restriction on the execution order of the above steps S501 and S502, and the two can be executed one after the other or simultaneously.

[0085] In some embodiments, parameters in the first residual generation network and the second residual generation network are adjusted to minimize the value of the cycle loss function.

[0086] L GAN : Adversarial loss, used to guide the generated residual to conform to the characteristics of the target model. Figure 4 Two adversarial losses, namely the first adversarial loss and the second adversarial loss, are shown in FIG.

[0087] Reference Figure 4 In some embodiments, the adversarial loss function is calculated as Figure 6 As shown, including:

[0088] Step S601: inputting a sample image of the first style into a first style transfer model including a first residual generation network to obtain a corresponding second style image; inputting the second style image and / or the sample image of the second style into an image feature extractor, and inputting the extraction result of the image feature extractor into a second discriminator; calculating a first adversarial loss according to the output result of the second discriminator;

[0089] Step S602: inputting the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image; inputting the first style image and / or the sample image of the first style into the image feature extractor, and inputting the extraction result of the image feature extractor into the first discriminator; calculating the second adversarial loss according to the output result of the first discriminator;

[0090] Step S603: Determine an adversarial loss function using the first adversarial loss and the second adversarial loss.

[0091] There is no restriction on the execution order of the above steps S601 and S602, and the two can be executed one after the other or simultaneously.

[0092] In some embodiments, an overall loss function is determined using an adversarial loss function and a cyclic loss function;

[0093] When the parameters in the first residual generation network and the second residual generation network are fixed, the parameters in the first discriminator and the second discriminator are adjusted to maximize the value of the overall loss function; and,

[0094] When the parameters in the first discriminator and the second discriminator are fixed, the parameters in the first residual generation network and the second residual generation network are adjusted to minimize the value of the overall loss function.

[0095] The following combination Figure 4 The content in details introduces the optimization process of the above loss function. In the embodiment of the present application, the optimization of the loss function includes two parts, namely the optimization of the cyclic loss function and the optimization of the adversarial loss function.

[0096] Part 1, optimization of the cyclic loss function:

[0097] like Figure 2 As shown, the original image a from model A enters the residual generation network F, and the calculation result is added to the original image a to obtain a B Similarly, the original image b from model B enters the residual generation network G, and the result of the operation is added to the original image b to obtain b A The details are as follows:

[0098] aB =a+λ1F(a)

[0099] b A =b+λ2G(b)

[0100] Explicitly splitting the style-transferred image into the original image and the residual can effectively preserve the physiological structure information. By limiting the size of λ1 and λ2, the impact of the residual on the authenticity of the image structure can be further limited.

[0101] After that, it is converted into image a of model B (i.e. a B ) enters the residual generation network G, and the result of the operation is added to F(a) to obtain the L2 norm (L2-norm), and the expected value of the result after taking the L2 norm is calculated to obtain the first cycle loss mentioned above. Symmetrically, the image b (i.e. b A ) enters the residual generation network F, and the operation result is added to G(b) to take the L2 norm (L2-norm), and the expected value of the result after taking the L2 norm is calculated to obtain the above-mentioned second loop loss. Adding the first loop loss and the second loop loss can obtain the loop loss function, which is as follows:

[0102]

[0103] Minimizing Lcyc during optimization can ensure that the difference between an image of model A and the original image is as small as possible after it is migrated to a similar model B through F and then migrated to model A through G.

[0104] The second part is the optimization of adversarial loss function:

[0105] In order to make it easier for the discriminator to distinguish fundus photos of different models (that is, indirectly enhance the authenticity of model generation), the embodiment of the present application selects to add prior features related to fundus models and combines the image feature extractor f with the discriminator D (including D A and D B ) are constructed separately. The features extracted by the feature extractor include at least the following three parts:

[0106] (1) Mutual information between image channels;

[0107] (2) Normalized color histogram;

[0108] (3) Deep features extracted from the fundus disease discrimination model; wherein the fundus disease discrimination model is an image classification model.

[0109] Optionally, the discriminator D A and D B It is a fully connected shallow neural network.

[0110] like Figure 2As shown, the original image a from model A enters the residual generation network F, and the calculation result is added to the original image a to obtain a B . Then a B Input image feature extractor f, and the original image b from model B can be input into image feature extractor f. The extraction result of f is input into discriminator D B According to D B The first adversarial loss is calculated based on the output result of . In this embodiment, the first adversarial loss is recorded as L GAN (F,D B ). Symmetrically, the original image b from model B enters the residual generation network G, and the operation result is added to the original image b to obtain b A . Then b A Input image feature extractor f, and the original image a from model A can be input into image feature extractor f. The extraction result of f is input into discriminator D A According to D A The second adversarial loss is calculated based on the output result of L. In this embodiment, the second adversarial loss is recorded as L GAN (G,D A ).

[0111] The adversarial loss function includes the first adversarial loss and the second adversarial loss mentioned above.

[0112] The overall loss function is determined by using the above adversarial loss function and cycle loss function as follows:

[0113] L(F,G,D A ,D B )=L GAN (F,D B )+L GAN (G,D A )+λ3L cyc (F,G)

[0114] In some embodiments, the optimization of the overall loss function adopts the adversarial method of the minimax algorithm. A and D B , to maximize L(F,G,D A ,D B ), at a fixed D A and D B Adjust F and G to minimize L(F,G,D A ,D B ).

[0115] That is, the above optimization objectives are as follows:

[0116]

[0117] The optimized F * and G * That is, the new first residual generation network and the new second residual generation network.

[0118] After a round of optimization, you can select and input another batch of training samples, repeat the optimization process of the first and second parts, and readjust the parameters to make the loss function tend to the optimal value. When the value of the loss function reaches the ideal range, the training of the style transfer model is completed.

[0119] The image classification method and style transfer model proposed in the embodiment of the present application can be applied to the screening of fundus diseases. The embodiment of the present application can realize the decoupling of the training process. That is, it is not required to intervene in the initial laboratory model training, and the model trained with laboratory data can also be directly connected to the style transfer model proposed in the embodiment of the present application for use. In addition, the embodiment of the present application does not require professional annotation data. The style transfer model proposed in the embodiment of the present application adopts an unsupervised solution when training the style transfer of various fundus cameras, that is, there is no need to know the true disease diagnosis results of the fundus images in each scene. In addition, the embodiment of the present application can retain the main physiological structure information of the original image. By processing the style transfer model with residuals, the structural information of the original image can be retained as much as possible to ensure that the image after style transfer is consistent with the diagnostic results of the original image. The embodiment of the present application describes that the target fundus image can be style-converted, so that it is more similar to the training set sample in terms of discrimination, so that the deep learning discrimination model trained on a specific style data set can achieve higher accuracy on other style images.

[0120] The present application also provides an image classification device. Figure 7 This is a schematic diagram of the structure of an image classification device according to an embodiment of the present application, comprising:

[0121] A first input module 701, configured to input a first style image into a style transfer model to obtain a second style image corresponding to the first style image;

[0122] The second input module 702 is used to input the second style image into the image classification model to obtain the classification result of the second style image; wherein,

[0123] The style transfer model is trained based on sample images of the first style and sample images of the second style; and the image classification model is trained based on sample images of the second style.

[0124] In some embodiments, the first style image includes an image taken with a first model of camera, and the second style image includes an image taken with a second model of camera;

[0125] The second style image corresponding to the first style image includes: an image having the same image content as the first style image and conforming to the shooting style of a camera of a second model.

[0126] In some embodiments, the first style image, the second style image, the sample image of the first style, and the sample image of the second style are all fundus images;

[0127] The style transfer model is trained based on sample images of the first style without disease labels and sample images of the second style with disease labels, and is trained using an unsupervised adversarial training method;

[0128] The image classification model is trained based on sample images of the second style containing disease labels and is trained using a supervised training method.

[0129] In some embodiments, the style transfer model includes a residual generation network; the residual generation network includes a convolution layer and a pooling layer;

[0130] Image classification models include convolutional neural networks.

[0131] The present application also provides a style transfer model training device. Figure 8 This is a schematic diagram of the structure of a style transfer model training device according to an embodiment of the present application, including:

[0132] The setting module 810 is used to set a first residual generation network, a second residual generation network, an image feature extractor, a first discriminator, and a second discriminator; wherein the first residual generation network is used to generate a residual of the first style image converted into the second style image; the second residual generation network is used to generate a residual of the second style image converted into the first style image; the image feature extractor is used to extract feature information of the first style image or the second style image; the first discriminator is used to determine whether the image is the first style image; and the second discriminator is used to determine whether the image is the second style image;

[0133] A calculation module 820 is used to input a training sample and calculate a loss function using the output results of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator;

[0134] The optimization module 830 is used to adjust the parameters of at least one of the first residual generation network, the second residual generation network, the first discriminator and the second discriminator so that the value of the loss function tends to an optimal value.

[0135] In some implementations, the loss function includes a cyclic loss function and an adversarial loss function.

[0136] like Fig. 9 As shown, in some embodiments, the calculation module 820 includes:

[0137] The first calculation submodule 821 is used to input the sample image of the first style into the first style transfer model including the first residual generation network to obtain the corresponding second style image; input the second style image into the second residual generation network, add the calculation result and the calculation result obtained by inputting the sample image of the first style into the first residual generation network, and calculate the first cycle loss using the addition result;

[0138] The second calculation submodule 822 is used to input the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image; input the first style image into the first residual generation network, add the calculation result and the calculation result obtained by inputting the sample image of the second style into the second residual generation network, and calculate the second cycle loss using the addition result;

[0139] The loop loss function determination submodule 823 is used to determine the loop loss function using the first loop loss and the second loop loss.

[0140] In some implementations, the optimization module 830 includes:

[0141] The first optimization submodule 831 is used to adjust the parameters in the first residual generation network and the second residual generation network to minimize the value of the cyclic loss function.

[0142] In some other embodiments, the calculation module 820 includes:

[0143] The third calculation submodule 824 is used to input the sample image of the first style into the first style transfer model including the first residual generation network to obtain the corresponding second style image; input the second style image and / or the sample image of the second style into the image feature extractor, and input the extraction result of the image feature extractor into the second discriminator; calculate the first adversarial loss according to the output result of the second discriminator;

[0144] The fourth calculation submodule 825 is used to input the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image; input the first style image and / or the sample image of the first style into the image feature extractor, and input the extraction result of the image feature extractor into the first discriminator; calculate the second adversarial loss according to the output result of the first discriminator;

[0145] The adversarial loss function determination submodule 826 determines the adversarial loss function using the first adversarial loss and the second adversarial loss.

[0146] In some implementations, the optimization module 830 includes:

[0147] An overall loss function determination submodule 832, for determining an overall loss function using an adversarial loss function and a cyclic loss function;

[0148] A second optimization submodule 833 is used to adjust the parameters in the first discriminator and the second discriminator to maximize the value of the overall loss function when the parameters in the first residual generation network and the second residual generation network are fixed;

[0149] The third optimization submodule 834 is used to adjust the parameters in the first residual generation network and the second residual generation network when the parameters in the first discriminator and the second discriminator are fixed, so as to minimize the value of the overall loss function.

[0150] In some embodiments, the image feature extractor is used to extract at least one of the following information:

[0151] Mutual information between image channels;

[0152] Normalized color histogram of the image;

[0153] Deep features extracted in image classification models.

[0154] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and will not be repeated here.

[0155] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.

[0156] like Fig.10 , is a block diagram of an electronic device according to a method for image classification according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0157] like Fig.10As shown, the electronic device includes: one or more processors 1001, memory 1002, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses, and can be installed on a common mainboard or installed in other ways as needed. Processor 1001 can process instructions executed in the electronic device, including instructions stored in memory 1002 or on memory 1002 to display graphical information of GUI on an external input / output device 1004 (such as, a display device coupled to the interface). In other embodiments, if necessary, multiple processors 1001 and / or multiple buses can be used together with multiple memories 1002 and multiple memories 1002. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor 1001 system). Fig.10 A processor 1001 is taken as an example.

[0158] The memory 1002 is a non-transitory computer-readable storage medium provided in the present application. The memory 1002 stores instructions executable by at least one processor 1001, so that at least one processor 1001 performs the image classification method provided in the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the image classification method provided in the present application.

[0159] The memory 1002 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the image classification method in the embodiment of the present application or the style transfer model training method in the embodiment of the present application. The program instructions / modules (for example, the attached Figure 7 The first input module 701 and the second input module 702 shown, or Figure 8 The processor 1001 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1002, that is, the image classification method in the above method embodiment is implemented.

[0160] The memory 1002 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the electronic device for image classification, etc. In addition, the memory 1002 may include a high-speed random access memory 1002, and may also include a non-transient memory 1002, such as at least one disk memory 1002 piece, a flash memory device, or other non-transient solid-state memory 1002 piece. In some embodiments, the memory 1002 may optionally include a memory 1002 remotely arranged relative to the processor 1001, and these remote memories 1002 may be connected to the electronic device for image classification via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0161] The electronic device of the image classification method may further include: an input device 1003 and an output device 1004. The processor 1001, the memory 1002, the input device 1003 and the output device 1004 may be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.

[0162] The input device 1003 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device for image classification, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 1004 may include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.

[0163] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor 1001, which can be a dedicated or general purpose programmable processor 1001, which can receive data and instructions from a storage system, at least one input device 1003, and at least one output device 1004, and transmit data and instructions to the storage system, the at least one input device 1003, and the at least one output device 1004.

[0164] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processor 1001, and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., a disk, an optical disk, memory 1002, a programmable logic device (PLD)) for providing machine instructions and / or data to programmable processor 1001, including a machine-readable medium that receives machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to programmable processor 1001.

[0165] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0166] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0167] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0168] According to the technical solution of the embodiment of the present application, a style transfer model is used to transfer the style of the first style image, and the obtained second style image is input into the image classification model; wherein the image classification model is trained based on the sample image of the second style. Since the style of the image processed by the image classification model during actual image classification is consistent with the style of the image used during training, the problem of decreased accuracy of the deep learning model caused by the difference between the training set and the actual scene is avoided, and thus the situation where the accuracy of the actual scene is significantly lower than the accuracy in the laboratory can be avoided, thereby improving the accuracy of image classification.

[0169] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

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

Claims

1. A style transfer model training method, comprising: A first residual generation network, a second residual generation network, an image feature extractor, a first discriminator and a second discriminator are set; wherein the first residual generation network is used to generate a residual of the first style image converted into the second style image; the second residual generation network is used to generate a residual of the second style image converted into the first style image; the image feature extractor is used to extract feature information of the first style image or the second style image; the first discriminator is used to determine whether the image is the first style image; the second discriminator is used to determine whether the image is the second style image; Input a training sample, and calculate a loss function using the output results of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator; Adjusting parameters of at least one of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator so that the value of the loss function tends to an optimal value; The loss function includes: a cyclic loss function calculated based on the first cyclic loss and the second cyclic loss, and an adversarial loss function calculated based on the first adversarial loss and the second adversarial loss; The first cycle loss and the first adversarial loss are respectively the cycle loss obtained by adding the operation result obtained by the first residual generation network processing the sample image of the first style and the operation result obtained by the second residual generation network processing the corresponding second style image after inputting the sample image of the first style into the first style transfer model including the first residual generation network to obtain the corresponding second style image, and the adversarial loss obtained by processing the corresponding second style image and / or the sample image of the second style based on the image feature extractor and the second discriminator; The second cycle loss and the second adversarial loss are respectively the cycle loss obtained by adding the operation result obtained by the second residual generation network for processing the sample image of the second style and the operation result obtained by the first residual generation network for processing the corresponding first style image after inputting the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image, and the adversarial loss obtained by processing the corresponding first style image and / or the sample image of the first style based on the image feature extractor and the second discriminator.

2. The method according to claim 1, wherein: Calculating the cycle loss function includes: Inputting a sample image of a first style into a first style transfer model including the first residual generation network to obtain a corresponding second style image; inputting the second style image into the second residual generation network, adding a calculation result to a calculation result obtained by inputting the sample image of the first style into the first residual generation network, and calculating a first cycle loss using the addition result; Inputting a sample image of a second style into a second style transfer model including the second residual generation network to obtain a corresponding first style image; inputting the first style image into the first residual generation network, adding a calculation result to a calculation result obtained by inputting the sample image of the second style into the second residual generation network, and calculating a second cycle loss using the addition result; The loop loss function is determined using the first loop loss and the second loop loss.

3. The method according to claim 2, wherein: The adjusting the parameters of at least one of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator so that the value of the loss function tends to an optimal value includes: Parameters in the first residual generation network and the second residual generation network are adjusted to minimize the value of the cyclic loss function.

4. The method according to claim 3, wherein: Calculating the adversarial loss function includes: Inputting a sample image of a first style into a first style transfer model including the first residual generation network to obtain a corresponding second style image; inputting the second style image and / or the sample image of the second style into the image feature extractor, and inputting the extraction result of the image feature extractor into the second discriminator; calculating a first adversarial loss according to the output result of the second discriminator; Inputting a sample image of the second style into a second style transfer model including the second residual generation network to obtain a corresponding first style image; inputting the first style image and / or the sample image of the first style into the image feature extractor, and inputting the extraction result of the image feature extractor into the first discriminator; calculating a second adversarial loss according to the output result of the first discriminator; The adversarial loss function is determined using the first adversarial loss and the second adversarial loss.

5. The method according to claim 4, wherein: The adjusting the parameters of at least one of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator so that the value of the loss function tends to an optimal value includes: Determine an overall loss function using the adversarial loss function and the cyclic loss function; When the parameters in the first residual generating network and the second residual generating network are fixed, the parameters in the first discriminator and the second discriminator are adjusted to maximize the value of the overall loss function; and When the parameters in the first discriminator and the second discriminator are fixed, the parameters in the first residual generation network and the second residual generation network are adjusted to minimize the value of the overall loss function.

6. The method according to claim 1, wherein: The image feature extractor is used to extract at least one of the following information: Mutual information between image channels; Normalized color histogram of the image; Deep features extracted in image classification models.

7. An image classification method, comprising: Inputting the first style image into a style transfer model to obtain a second style image corresponding to the first style image; Inputting the second style image into an image classification model to obtain a classification result of the second style image; The image classification model is trained based on sample images of the second style, and the style transfer model is trained based on the style transfer model training method according to any one of claims 1 to 6.

8. The method according to claim 7, wherein: The first style image includes an image taken by a camera of a first model, and the second style image includes an image taken by a camera of a second model; The second style image corresponding to the first style image includes: an image having the same image content as the first style image and conforming to the shooting style of the camera of the second model.

9. The method according to claim 7 or 8, wherein: The first style image, the second style image, the first style sample image and the second style sample image are all fundus images; The style transfer model is trained based on sample images of a first style without disease labels and sample images of a second style with disease labels, and is trained using an unsupervised adversarial training method; The image classification model is trained based on sample images of a second style containing disease labels and is trained using a supervised training method.

10. The method according to claim 7 or 8, wherein: The style transfer model includes a residual generation network; the residual generation network includes a convolution layer and a pooling layer; The image classification model includes a convolutional neural network.

11. A style transfer model training device, comprising: A setting module is used to set a first residual generation network, a second residual generation network, an image feature extractor, a first discriminator and a second discriminator; wherein the first residual generation network is used to generate a residual of a first style image converted into a second style image; the second residual generation network is used to generate a residual of a second style image converted into the first style image; the image feature extractor is used to extract feature information of the first style image or the second style image; the first discriminator is used to determine whether the image is a first style image; the second discriminator is used to determine whether the image is a second style image; A calculation module, used for inputting training samples, and calculating a loss function using the output results of the first residual generation network, the second residual generation network, the first discriminator, and the second discriminator; an optimization module, used to adjust parameters in at least one of the first residual generation network, the second residual generation network, the first discriminator and the second discriminator, so that the value of the loss function tends to an optimal value; The loss function includes: a cyclic loss function calculated based on the first cyclic loss and the second cyclic loss, and an adversarial loss function calculated based on the first adversarial loss and the second adversarial loss; The first cycle loss and the first adversarial loss are respectively the cycle loss obtained by adding the operation result obtained by the first residual generation network processing the sample image of the first style and the operation result obtained by the second residual generation network processing the corresponding second style image after inputting the sample image of the first style into the first style transfer model including the first residual generation network to obtain the corresponding second style image, and the adversarial loss obtained by processing the corresponding second style image and / or the sample image of the second style based on the image feature extractor and the second discriminator; The second cycle loss and the second adversarial loss are respectively the cycle loss obtained by adding the operation result obtained by the second residual generation network for processing the sample image of the second style and the operation result obtained by the first residual generation network for processing the corresponding first style image after inputting the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image, and the adversarial loss obtained by processing the corresponding first style image and / or the sample image of the first style based on the image feature extractor and the second discriminator.

12. The device according to claim 11, wherein: The calculation module comprises: A first calculation submodule is configured to input a sample image of a first style into a first style transfer model including the first residual generation network to obtain a corresponding second style image; input the second style image into the second residual generation network, add a calculation result to a calculation result obtained by inputting the sample image of the first style into the first residual generation network, and calculate a first cycle loss using the addition result; A second calculation submodule is used to input the sample image of the second style into the second style transfer model including the second residual generation network to obtain a corresponding first style image; input the first style image into the first residual generation network, add the calculation result and the calculation result obtained by inputting the sample image of the second style into the second residual generation network, and calculate the second cycle loss using the addition result; A cycle loss function determination submodule is used to determine the cycle loss function using the first cycle loss and the second cycle loss.

13. The device according to claim 12, wherein: The optimization module includes: The first optimization submodule is used to adjust the parameters in the first residual generation network and the second residual generation network to minimize the value of the cyclic loss function.

14. The device according to claim 12, wherein: The calculation module comprises: A third calculation submodule is used to input the sample image of the first style into the first style transfer model including the first residual generation network to obtain a corresponding second style image; input the second style image and / or the sample image of the second style into the image feature extractor, and input the extraction result of the image feature extractor into the second discriminator; and calculate the first adversarial loss according to the output result of the second discriminator; A fourth calculation submodule is used to input the sample image of the second style into the second style transfer model including the second residual generation network to obtain the corresponding first style image; input the first style image and / or the sample image of the first style into the image feature extractor, and input the extraction result of the image feature extractor into the first discriminator; and calculate the second adversarial loss according to the output result of the first discriminator; An adversarial loss function determination submodule determines the adversarial loss function using the first adversarial loss and the second adversarial loss.

15. The device according to claim 14, wherein: The optimization module includes: An overall loss function determination submodule, used to determine an overall loss function using the adversarial loss function and the cyclic loss function; A second optimization submodule, configured to adjust the parameters in the first discriminator and the second discriminator while fixing the parameters in the first residual generation network and the second residual generation network, so as to maximize the value of the overall loss function; The third optimization submodule is used to adjust the parameters in the first residual generation network and the second residual generation network when the parameters in the first discriminator and the second discriminator are fixed, so as to minimize the value of the overall loss function.

16. The device according to claim 11, wherein The image feature extractor is used to extract at least one of the following information: Mutual information between image channels; Normalized color histogram of the image; Deep features extracted in image classification models.

17. An image classification device, comprising: A first input module, used to input a first style image into a style transfer model to obtain a second style image corresponding to the first style image; A second input module, used to input the second style image into an image classification model to obtain a classification result of the second style image; The image classification model is trained based on sample images of the second style, and the style transfer model is trained based on the style transfer model training method according to any one of claims 1 to 6.

18. The device according to claim 17, wherein: The first style image includes an image taken by a camera of a first model, and the second style image includes an image taken by a camera of a second model; The second style image corresponding to the first style image includes: an image having the same image content as the first style image and conforming to the shooting style of the camera of the second model.

19. The device according to claim 17 or 18, wherein: The first style image, the second style image, the first style sample image and the second style sample image are all fundus images; The style transfer model is trained based on sample images of a first style without disease labels and sample images of a second style with disease labels, and is trained using an unsupervised adversarial training method; The image classification model is trained based on sample images of a second style containing disease labels and is trained using a supervised training method.

20. The device according to claim 17 or 18, wherein: The style transfer model includes a residual generation network; the residual generation network includes a convolution layer and a pooling layer; The image classification model includes a convolutional neural network.

21. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

22. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 10.

23. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 10.