Image prediction method, device, computer equipment and storage medium

By introducing a multi-loss function training method based on standard and sample images into the image prediction model, the problem of low accuracy of traditional image prediction methods is solved and higher image prediction accuracy is achieved.

CN112348012BActive Publication Date: 2024-09-24刘丽
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011155152.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-26
Publication Date
2024-09-24
Estimated Expiration
2040-10-26

AI Technical Summary

Technical Problem

The prediction images generated by traditional image prediction methods have low accuracy and are difficult to effectively predict the future state of the image.

Method used

An image prediction method is adopted by obtaining the image to be tested and inputting it into a preset image prediction model. The model is trained according to a preset loss function. The loss function includes a first loss function and a second loss function. The first loss function Based on standard images and sample prediction images, the second loss function is based on the category information of the image area, and the image prediction model is trained through a weighted summation loss function to improve prediction accuracy.

Benefits of technology

Through a more accurate training model, the impact of different intensity areas on the prediction results is avoided, and the accuracy of image prediction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112348012B
    Figure CN112348012B
Patent Text Reader

Abstract

The present application relates to an image prediction method, device, computer equipment and storage medium. The method comprises: obtaining an image to be tested; the image to be tested comprises multiple image regions, and different image regions correspond to different classification categories; inputting the image to be tested into a preset image prediction model to obtain a predicted image; wherein the image prediction model is obtained by training according to a preset loss function, and the preset loss function comprises a first loss function and a second loss function, the value of the first loss function is obtained according to a standard image and a sample predicted image, and the value of the second loss function is obtained according to the sample category to which each image region in the sample predicted image belongs and the standard category to which each image region in the standard image belongs. The use of this method can improve the accuracy of the obtained predicted image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of deep learning technology, deep learning technology has gradually been used in image prediction or image generation tasks. For example, precipitation cloud maps are predicted through deep learning technology to obtain precipitation cloud maps in the future.

[0003] In traditional technology, image prediction or image generation usually treats each pixel of the image to be generated as a regression problem, regresses the value of the current pixel through a neural network, and generates an image based on the regressed value of the current pixel.

[0004] However, traditional image prediction methods have the problem of low accuracy of generated prediction images. Summary of the invention

[0005] Based on this, it is necessary to provide an image prediction method, apparatus, computer device and storage medium that can improve the accuracy of the generated predicted image in response to the above technical problems.

[0006] An image prediction method, the method comprising:

[0007] Acquire an image to be tested; the image to be tested includes multiple image areas, and different image areas correspond to different classification categories;

[0008] The image to be tested is input into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to a standard image and a sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0009] In one embodiment, the training process of the image prediction model includes:

[0010] Inputting the sample image into a preset image prediction model to be trained to obtain the sample prediction image;

[0011] Obtaining a value of the first loss function according to the standard image and the sample prediction image;

[0012] Obtaining the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs;

[0013] Obtaining a value of the second loss function according to the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs;

[0014] According to the value of the first loss function and the value of the second loss function, the value of the loss function of the image prediction model to be trained is obtained, and the image prediction model to be trained is trained to obtain the image prediction model.

[0015] In one of the embodiments, the step of obtaining the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs includes:

[0016] According to a preset conversion formula, the value range of the pixel value of each image area in the standard image is converted into a corresponding standard probability value, and the standard category to which each image area in the standard image belongs is obtained according to the standard probability value;

[0017] According to the preset conversion formula, the value range of the pixel value of each image area in the sample prediction image is converted into a corresponding sample probability value, and the sample category to which each image area in the sample prediction image belongs is obtained according to the sample probability value.

[0018] In one embodiment, obtaining the value of the loss function of the image prediction model to be trained according to the value of the first loss function and the value of the second loss function, training the image prediction model to be trained to obtain the image prediction model, includes:

[0019] Performing a weighted summation on the value of the first loss function and the value of the second loss function to obtain the value of the loss function of the image prediction model to be trained;

[0020] The image prediction model to be trained is trained according to the value of the loss function of the image prediction model to be trained to obtain the image prediction model.

[0021] In one embodiment, the second loss function includes a Focal Loss function.

[0022] In one embodiment, the first loss function comprises a BCELoss function.

[0023] In one embodiment, the preset conversion formula is: In the formula, Rate represents the probability value, sigmoid represents the sigmoid function, r is a parameter, x is the pixel value of each image area in the standard image or the sample prediction image, the value of threshold is the value of the center point position of the value order of each image area in the standard image or the sample prediction image, and the value of range is half of the value order range of each image area in the standard image or the sample prediction image.

[0024] An image prediction device, comprising:

[0025] A first acquisition module is used to acquire an image to be tested; the image to be tested includes a plurality of image regions, and different image regions correspond to different classification categories;

[0026] A prediction module is used to input the image to be tested into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to a standard image and a sample prediction image, and the value of the second loss function is obtained according to a sample category to which each image area in the sample prediction image belongs and a standard category to which each image area in the standard image belongs.

[0027] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0028] Acquire an image to be tested; the image to be tested includes multiple image areas, and different image areas correspond to different classification categories;

[0029] The image to be tested is input into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to a standard image and a sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0030] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0031] Acquire an image to be tested; the image to be tested includes multiple image areas, and different image areas correspond to different classification categories;

[0032] The image to be tested is input into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to a standard image and a sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0033] The above-mentioned image prediction method, device, computer equipment and storage medium, since the image prediction model is trained according to the preset first loss function and the second loss function, and the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category described in each image area in the sample prediction image and the standard category described in each image area in the standard image, the image prediction model can be trained more accurately through the first loss function and the second loss function, so that the obtained image prediction model avoids the influence of different proportions of image areas of different intensities on the image prediction results when predicting the image to be tested, thereby improving the accuracy of the obtained predicted image. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A schematic diagram of the internal structure of a computer device provided by an embodiment;

[0035] Figure 2 is a schematic diagram of a flow chart of an image prediction method in an embodiment;

[0036] Figure 3 is a schematic flow chart of an image prediction method in another embodiment;

[0037] Figure 4 is a schematic flow chart of an image prediction method in another embodiment;

[0038] Figure 5 is a schematic flow chart of an image prediction method in another embodiment;

[0039] Figure 6 A schematic diagram of the structure of an image prediction device provided by an embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] The image prediction method provided in the embodiment of the present application can be applied to Figure 1The computer device shown. The computer device includes a processor and a memory connected by a system bus, and a computer program is stored in the memory. When the processor executes the computer program, the steps of the following method embodiment can be executed. Optionally, the computer device may also include a network interface, a display screen and an input device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory, and the non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. Optionally, the computer device can be a server, a personal computer, a personal digital assistant, or other terminal devices, such as a tablet computer, a mobile phone, etc., or a cloud or remote server. The embodiment of the present application does not limit the specific form of the computer device.

[0042] In one embodiment, Figure 2 As shown, an image prediction method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:

[0043] S201, obtaining an image to be tested; the image to be tested includes multiple image regions, and different image regions correspond to different classification categories.

[0044] The image to be tested includes multiple image areas, and different image areas correspond to different classification categories. Exemplarily, the image to be tested may be a radar cloud map. Specifically, the computer device obtains the image to be tested including multiple image areas, and different image areas among the multiple image areas correspond to different classification categories. Optionally, taking the image to be tested as a radar cloud map as an example, the computer device may obtain the image to be tested in real time from a meteorological website, or may obtain the image to be tested from an image database storing historical radar cloud maps.

[0045] S202, input the image to be tested into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, and the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0046] Specifically, the computer device inputs the image to be tested into a preset image prediction model, and obtains a predicted image through the image prediction model. The image prediction model is obtained by training according to a preset loss function, and the preset loss function includes a first loss function and a second loss function. The value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs. It can be understood that for some image prediction tasks, the generated image does not need to be too accurate, and it is only necessary to predict that the pixel value of a certain point is within a certain interval. For example, for the prediction of precipitation cloud images, it is only necessary to predict that the radar echo intensity of a certain point or a certain area is within a certain interval. In this embodiment, the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs. The second loss function can make the prediction of the image prediction model in different intervals more accurate, and can also avoid the influence of different proportions of image areas with different intensities on the image prediction results, so that the image prediction results are more accurate.

[0047] In the above-mentioned image prediction method, since the image prediction model is trained according to the preset first loss function and the second loss function, and the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category of each image area in the sample prediction image and the standard category of each image area in the standard image, the image prediction model can be trained more accurately through the first loss function and the second loss function, so that the obtained image prediction model avoids the influence of different proportions of image areas of different intensities on the image prediction results when predicting the image to be tested, thereby improving the accuracy of the obtained predicted image.

[0048] In one embodiment, Figure 3 As shown, based on the above embodiment, as an optional implementation manner, the training process of the above image prediction model includes:

[0049] S301, inputting a sample image into a preset image prediction model to be trained to obtain a sample prediction image.

[0050] Specifically, the computer device inputs the sample image into a preset image prediction model to be trained, and obtains the sample prediction image through the image prediction model to be trained. Optionally, the sample image may be a radar cloud image. Optionally, the computer device may scale the size of the sample image input into the image prediction model to be trained to 64x64, and convert the value range corresponding to the sample image to -1 to 1. Optionally, the image prediction model to be trained may be a ConvLSTM picture prediction network. Exemplarily, the ConvLSTM picture prediction network may use 5 sample images to predict 1 image, that is, input 5 images and output 1 image, and the image uses a single channel, and the others use default settings.

[0051] S302, obtaining a value of a first loss function according to the standard image and the sample prediction image.

[0052] Specifically, the computer device obtains the value of the first loss function of the image prediction model to be trained according to the standard image corresponding to the sample image and the sample prediction image obtained above. Optionally, the first loss function includes a BCELoss function. Optionally, the computer device can obtain the value of the first loss function according to the pixel value of the standard image and the pixel value of the sample prediction image.

[0053] S303, obtaining the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs.

[0054] Specifically, the computer device obtains the standard category to which each image area in the above-mentioned standard image belongs and the sample category to which each image area in the sample prediction image belongs. Exemplarily, taking the standard image as a radar cloud map as an example, the standard category to which each image area in the standard image belongs may be any one of a few clouds, light rain, heavy rain, rainstorm, and extreme weather. Correspondingly, the sample prediction image is also a radar cloud map, and the sample category to which each image area in the sample prediction image belongs may also be any one of a few clouds, light rain, heavy rain, rainstorm, and extreme weather. Optionally, taking the standard image and the sample prediction image as radar cloud maps as an example, the computer device may obtain the standard category to which each image area in the standard image belongs based on the reflectivity of each image area in the standard image, and obtain the sample category to which each image area in the sample prediction image belongs based on the reflectivity of each image area in the sample prediction image.

[0055] S304, obtaining a value of a second loss function according to the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs.

[0056] Specifically, the computer device obtains the value of the second loss function of the image prediction model to be trained according to the standard category to which each image area in the standard image belongs and the sample category to which each image area in the sample prediction image belongs. Optionally, the second loss function includes a Focal Loss function. Optionally, the computer device can obtain the value of the second loss function of the image prediction model to be trained according to the difference between the standard category to which each image area in the standard image belongs and the sample category to which each image area in the sample prediction image belongs.

[0057] S305 , obtaining the value of the loss function of the image prediction model to be trained according to the value of the first loss function and the value of the second loss function, and training the image prediction model to be trained to obtain the image prediction model.

[0058] Specifically, the computer device obtains the value of the loss function of the image prediction model to be trained according to the value of the first loss function obtained above and the value of the second loss function obtained above, and trains the image prediction model to be trained to obtain the image prediction model. Optionally, the computer device may determine the image prediction model to be trained corresponding to when the value of the loss function of the image prediction model to be trained reaches a stable value or a minimum value as the image prediction model.

[0059] In this embodiment, the computer device inputs the sample image into a preset image prediction model to be trained, and the sample prediction image can be obtained through the image prediction model to be trained, and then the value of the first loss function of the image prediction model to be trained can be accurately obtained based on the standard image and the sample prediction image, and the standard category to which each image area in the standard image belongs and the sample category to which each image area in the sample prediction image belongs can be accurately obtained based on the sample prediction image and the standard image, and then the value of the second loss function of the image prediction model to be trained can be accurately obtained based on the standard category to which each image area in the standard image belongs and the sample category to which each image area in the sample prediction image belongs, and then the image prediction model to be trained can be accurately trained based on the value of the first loss function and the value of the second loss function of the image prediction model to be trained, and then the image prediction model can be accurately obtained.

[0060] In the above scenario of obtaining the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs, the computer device can obtain the standard category to which each image region in the standard image belongs according to the standard probability value corresponding to each image region in the standard image, and obtain the sample category to which each image region in the sample prediction image belongs according to the sample probability value corresponding to each image region in the sample prediction image. In one embodiment, Figure 4 As shown, based on the above embodiment, as an optional implementation manner, the above S303 includes:

[0061] S401, according to a preset conversion formula, convert the value range of the pixel value of each image area in the standard image into a corresponding standard probability value, and obtain the standard category to which each image area in the standard image belongs according to the standard probability value.

[0062] Specifically, the computer device converts the value range of the pixel value of each image area in the standard image into a corresponding standard probability value according to a preset conversion formula, and obtains the standard category to which each image area in the standard image belongs according to the standard probability value corresponding to each image area in the standard image. Optionally, the preset conversion formula is Wherein, Rate represents the probability value, sigmoid represents the sigmoid function, r is a parameter, x is the pixel value of each image region in the above standard image, the value of threshold is the value of the center point position of the value order of each image region in the above standard image, and the value of range is half of the value order range value of each image region in the above standard image. Exemplarily, taking the standard image as a radar cloud map as an example, the value order range of the radar cloud map can be divided into (0-20), (20-30), (30-40), (40-50), (50-80), corresponding to a few clouds, light rain, heavy rain, rainstorm, and extreme weather, respectively. Optionally, the computer device can set the value of the center point position of the value order of each image region of the radar cloud map to (10, 25, 35, 45, 65), and correspondingly, half of the value order range value of each image region of the radar cloud map can be set to (10, 5, 5, 5, 15).

[0063] S402, according to a preset conversion formula, convert the value range of the pixel value of each image area in the sample prediction image into a corresponding sample probability value, and obtain the sample category to which each image area in the sample prediction image belongs according to the sample probability value.

[0064] Specifically, the computer device converts the value range of the pixel values ​​of each image area in the sample prediction image into a corresponding sample probability value according to the above-mentioned preset conversion formula, and obtains the sample category to which each image area in the sample prediction image belongs according to the sample probability value of each image area in the sample prediction image. Optionally, according to the preset conversion formula, the value range of the pixel values ​​of each image area in the sample prediction image is converted into a corresponding sample probability value. The process of converting the value range of the pixel values ​​of each image area in the standard image into a corresponding standard probability value according to the preset conversion formula in S401 above can be referred to, and this embodiment will not be repeated here.

[0065] In this embodiment, the computer device can accurately convert the value range of pixel values ​​of each image area in the standard image and the value range of pixel values ​​of each image area in the sample prediction image into corresponding standard probability values ​​and corresponding sample probability values ​​according to a preset conversion formula, and then can accurately obtain the standard category to which each image area in the standard image belongs according to the standard probability value corresponding to each image area in the standard image, and accurately obtain the sample category to which each image area in the sample prediction image belongs according to the sample probability value corresponding to each image area in the sample prediction image.

[0066] In the above scenario where the value of the loss function of the image prediction model to be trained is obtained based on the value of the first loss function of the image prediction model to be trained and the value of the second loss function of the image prediction model to be trained, and the image prediction model to be trained is trained to obtain the image prediction model, the computer device may perform a weighted summation of the value of the first loss function of the image prediction model to be trained and the value of the first loss function of the image prediction model to be trained to obtain the value of the loss function of the image prediction model to be trained. In one embodiment, Figure 5 As shown, based on the above embodiment, as an optional implementation manner, the above S305 includes:

[0067] S501, performing weighted summation on the value of the first loss function and the value of the second loss function to obtain the value of the loss function of the image prediction model to be trained.

[0068] Specifically, the computer device performs weighted summation on the value of the first loss function of the image prediction model to be trained and the value of the second loss function of the image prediction model to be trained, to obtain the value of the loss function of the image prediction model to be trained. Exemplarily, taking L1 as the first loss function of the image prediction model to be trained, L2 as the second loss function of the image prediction model to be trained, and L as the value of the loss function of the image prediction model to be trained, L=(αL1+βL2) / 2, where α and β are weighting parameters.

[0069] S502, training the image prediction model to be trained according to the value of the loss function of the image prediction model to be trained to obtain an image prediction model.

[0070] Specifically, the computer device trains the image prediction model to be trained according to the value of the loss function of the image prediction model to be trained obtained above, and obtains the above-mentioned image prediction model by training the image prediction model to be trained corresponding to the image prediction model to be trained when the value of the loss function of the image prediction model to be trained reaches a stable value or a minimum value.

[0071] In this embodiment, the computer device performs weighted summation of the values ​​of the first loss function and the second loss function of the image prediction model to be trained, and can accurately obtain the value of the loss function of the image prediction model to be trained, so that the image prediction model to be trained can be accurately trained according to the value of the loss function of the image prediction model to be trained, thereby obtaining an accurate image prediction model, thereby improving the accuracy of the obtained image prediction model.

[0072] To facilitate understanding by those skilled in the art, the image prediction method provided by the present application is described in detail below. The method may include:

[0073] S601, inputting a sample image into a preset image prediction model to be trained to obtain a sample prediction image.

[0074] S602, obtaining a value of a first loss function according to the standard image and the sample prediction image; the first loss function includes a BCELoss function.

[0075] S603, according to the preset conversion formula The value range of the pixel values ​​of each image area in the standard image is converted into the corresponding standard probability value, and the standard category to which each image area in the standard image belongs is obtained according to the standard probability value; wherein, Rate represents the probability value, sigmoid represents the sigmoid function, r is the parameter, x is the pixel value of each image area in the standard image, the value of threshold is the value of the center point position of the value order of each image area in the standard image, and the value of range is half of the value order range of each image area in the standard image.

[0076] S604, according to the preset conversion formula The value range of the pixel value of each image area in the sample prediction image is converted into the corresponding sample probability value, and the sample category to which each image area in the sample prediction image belongs is obtained according to the sample probability value; wherein Rate represents the probability value, sigmoid represents the sigmoid function, r is the parameter, x is the pixel value of each image area in the sample prediction image, the value of threshold is the value of the center point position of the value order of each image area in the sample prediction image, and the value of range is half of the value order range of each image area in the sample prediction image.

[0077] S605, obtaining a value of a second loss function according to the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs; the second loss function includes a Focal Loss function.

[0078] S606: Perform a weighted summation on the value of the first loss function and the value of the second loss function to obtain the value of the loss function of the image prediction model to be trained.

[0079] S607, training the image prediction model to be trained according to the value of the loss function of the image prediction model to be trained to obtain an image prediction model.

[0080] S608, obtaining an image to be tested; the image to be tested includes multiple image regions, and different image regions correspond to different classification categories.

[0081] S609: Input the image to be tested into a preset image prediction model to obtain a predicted image.

[0082] It should be noted that for the description in the above S601-S609, reference may be made to the relevant description in the above embodiment, and the effects are similar, which will not be repeated in this embodiment.

[0083] It should be understood that although Figure 2-5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-5 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0084] In one embodiment, Figure 6 As shown, an image prediction device is provided, comprising: a first acquisition module and a prediction module, wherein:

[0085] The first acquisition module is used to acquire the image to be tested; the image to be tested includes multiple image areas, and different image areas correspond to different classification categories.

[0086] A prediction module is used to input the image to be tested into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0087] The image prediction device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0088] On the basis of the above embodiment, optionally, the above device further includes: a second acquisition module, a third acquisition module, a fourth acquisition module, a fifth acquisition module and a training module, wherein:

[0089] The second acquisition module is used to input the sample image into a preset image prediction model to be trained to obtain a sample prediction image.

[0090] The third acquisition module is used to obtain the value of the first loss function according to the standard image and the sample prediction image.

[0091] The fourth acquisition module is used to acquire the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs.

[0092] The fifth acquisition module is used to obtain the value of the second loss function according to the standard category to which each image area in the standard image belongs and the sample category to which each image area in the sample prediction image belongs.

[0093] The training module is used to obtain the value of the loss function of the image prediction model to be trained according to the value of the first loss function and the value of the second loss function, and to train the image prediction model to be trained to obtain the image prediction model.

[0094] Optionally, the first loss function includes a BCELoss function.

[0095] Optionally, the second loss function includes a Focal Loss function.

[0096] The image prediction device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0097] On the basis of the above embodiment, optionally, the fourth acquisition module includes: a first acquisition unit and a second acquisition unit, wherein:

[0098] The first acquisition unit is used to convert the value range of the pixel value of each image area in the standard image into a corresponding standard probability value according to a preset conversion formula, and obtain the standard category to which each image area in the standard image belongs according to the standard probability value.

[0099] The second acquisition unit is used to convert the value range of the pixel value of each image area in the sample prediction image into a corresponding sample probability value according to a preset conversion formula, and obtain the sample category to which each image area in the sample prediction image belongs according to the sample probability value.

[0100] Optional, the default conversion formula is: Wherein, Rate represents the probability value, sigmoid represents the sigmoid function, r is a parameter, x is the pixel value of each image region in the standard image or the sample prediction image, the value of threshold is the value of the center point position of the value order of each image region in the standard image or the sample prediction image, and the value of range is half of the value order range of each image region in the standard image or the sample prediction image.

[0101] The image prediction device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0102] Based on the above embodiment, optionally, the above training module includes: a third acquisition unit and a training unit, wherein:

[0103] The third acquisition unit is used to perform weighted summation on the value of the first loss function and the value of the second loss function to obtain the value of the loss function of the image prediction model to be trained.

[0104] The training unit is used to train the image prediction model to be trained according to the value of the loss function of the image prediction model to be trained to obtain the image prediction model.

[0105] The image prediction device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0106] For the specific definition of the image prediction device, please refer to the definition of the image prediction method above, which will not be repeated here. Each module in the above-mentioned image prediction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0107] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0108] Acquire an image to be tested; the image to be tested includes multiple image regions, and different image regions correspond to different classification categories;

[0109] The image to be tested is input into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0110] The implementation principle and technical effect of the computer device provided in the above embodiment are similar to those of the above method embodiment, and will not be repeated here.

[0111] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0112] Acquire an image to be tested; the image to be tested includes multiple image regions, and different image regions correspond to different classification categories;

[0113] The image to be tested is input into a preset image prediction model to obtain a predicted image; wherein the image prediction model is trained according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs.

[0114] The computer-readable storage medium provided in the above embodiment has similar implementation principles and technical effects as those of the above method embodiment, and will not be described in detail here.

[0115] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0116] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0117] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. An image prediction method, characterized in that: The method comprises: Acquire an image to be tested; the image to be tested includes multiple image areas, and different image areas correspond to different classification categories; Input the image to be tested into a preset image prediction model to obtain a predicted image; wherein the image prediction model is obtained by training according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs; The training process of the image prediction model includes: Inputting the sample image into a preset image prediction model to be trained to obtain the sample prediction image; Obtaining a value of the first loss function according to the standard image and the sample prediction image; Acquire the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs; Obtaining a value of the second loss function according to the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs; According to the value of the first loss function and the value of the second loss function, the value of the loss function of the image prediction model to be trained is obtained, and the image prediction model to be trained is trained to obtain the image prediction model.

2. The method according to claim 1, characterized in that: The obtaining of the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs includes: According to a preset conversion formula, the value range of the pixel value of each image area in the standard image is converted into a corresponding standard probability value, and the standard category to which each image area in the standard image belongs is obtained according to the standard probability value; According to the preset conversion formula, the value range of the pixel value of each image area in the sample prediction image is converted into a corresponding sample probability value, and the sample category to which each image area in the sample prediction image belongs is obtained according to the sample probability value.

3. The method according to claim 1, characterized in that The step of obtaining the value of the loss function of the image prediction model to be trained according to the value of the first loss function and the value of the second loss function, and training the image prediction model to be trained to obtain the image prediction model comprises: Performing a weighted summation on the value of the first loss function and the value of the second loss function to obtain the value of the loss function of the image prediction model to be trained; The image prediction model to be trained is trained according to the value of the loss function of the image prediction model to be trained to obtain the image prediction model.

4. The method according to any one of claims 1 to 3, characterized in that: The second loss function includes a FocalLoss function.

5. The method according to any one of claims 1 to 3, characterized in that: The first loss function includes a BCELoss function.

6. The method according to claim 2, characterized in that The preset conversion formula is: In the formula, Rate represents the probability value, sigmoid represents the sigmoid function, r is a parameter, x is the pixel value of each image area in the standard image or the sample prediction image, the value of threshold is the value of the center point position of the value order of each image area in the standard image or the sample prediction image, and the value of range is half of the value order range of each image area in the standard image or the sample prediction image.

7. An image prediction device, characterized in that: The device comprises: A first acquisition module is used to acquire an image to be tested; the image to be tested includes a plurality of image regions, and different image regions correspond to different classification categories; A prediction module, used for inputting the image to be tested into a preset image prediction model to obtain a predicted image; wherein the image prediction model is obtained by training according to a preset loss function, and the preset loss function includes a first loss function and a second loss function, the value of the first loss function is obtained according to the standard image and the sample prediction image, and the value of the second loss function is obtained according to the sample category to which each image area in the sample prediction image belongs and the standard category to which each image area in the standard image belongs; A second acquisition module is used to input the sample image into a preset image prediction model to be trained to obtain a sample prediction image; A third acquisition module is used to obtain a value of a first loss function according to a standard image and a sample prediction image; A fourth acquisition module, used to acquire the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs; A fifth acquisition module, used to obtain a value of a second loss function according to the standard category to which each image region in the standard image belongs and the sample category to which each image region in the sample prediction image belongs; The training module is used to obtain the value of the loss function of the image prediction model to be trained according to the value of the first loss function and the value of the second loss function, and to train the image prediction model to be trained to obtain the image prediction model.

8. The device according to claim 7, characterized in that The fourth acquisition module includes: a first acquisition unit and a second acquisition unit, wherein: The first acquisition unit is used to convert the value range of the pixel value of each image area in the standard image into a corresponding standard probability value according to a preset conversion formula, and obtain the standard category to which each image area in the standard image belongs according to the standard probability value; The second acquisition unit is used to convert the value range of the pixel value of each image area in the sample prediction image into a corresponding sample probability value according to a preset conversion formula, and obtain the sample category to which each image area in the sample prediction image belongs according to the sample probability value.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

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