Model training method, image processing method, electronic equipment and storage medium

By combining the demosaic module and the purple edge removal module in the image processing model, and using iterative training to determine the loss value, the problem of the purple edge removal module occupies a lot of resources, achieving more efficient image processing.

CN120510464APending Publication Date: 2025-08-19XIAN UNISOC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510536785.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the prior art, the individual purple edge removal module occupies more computing resources, resulting in low image processing efficiency.

Method used

By obtaining the original image training set, input the image processing model for color interpolation and purple edge elimination, use the number of iterations to determine the target loss value, update the model until converge, thereby combining the demosaic module and purple edge elimination module into one module, reducing computing resources.

Benefits of technology

The purple edges are removed simultaneously during the color interpolation process, which reduces the use of computing resources and improves image processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120510464A_ABST
    Figure CN120510464A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a model training method, an image processing method, electronic equipment and a storage medium, and the method comprises the steps: obtaining an original image training set which comprises a plurality of original images and a tag image corresponding to each original image, inputting the plurality of original images to an image processing model, and obtaining a tag image corresponding to each original image; the prediction images are images subjected to color interpolation and purple edge elimination, determining the current number of iterations, determining a target loss value between each prediction image and the corresponding label image according to the current number of iterations, and determining a target loss value between each prediction image and the corresponding label image according to the target loss value. The target loss values are used for indicating structural similarity loss or content similarity loss between the predicted image and the corresponding label image, and according to the multiple target loss values, updating the image processing model until the image processing model converges. According to the method, the image processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of image processing, and specifically relates to a model training method, an image processing method, an electronic device, and a storage medium. Background Art

[0002] During the imaging process of digital cameras, the refractive index of the camera lens varies for different wavelengths of light. This prevents different colors of light from being completely focused on the same spot, resulting in chromatic aberration. This can manifest as purple fringing at the boundary between high and low light levels. Purple fringing is a common problem that affects image quality.

[0003] Currently, image processing algorithms can be used to remove purple fringing from images. The image processing process can include a raw image (RAW) stage, a red, green, and blue (RGB) color space (YUV) stage, or a luma-chroma encoding (YUV) stage. To remove purple fringing from images, a separate purple fringing removal module must be configured during the image processing process. This module can be implemented at any stage of the image processing process.

[0004] During the image processing process, a separate purple fringing removal module requires more computing resources, resulting in low image processing efficiency. Summary of the Invention

[0005] The embodiments of the present application relate to a model training method, an image processing method, an electronic device and a storage medium, which are used to solve the defect in the prior art that a separate purple fringing removal module requires more computing resources, resulting in low image processing efficiency.

[0006] In a first aspect, an embodiment of the present application provides a model training method, the method comprising:

[0007] Obtaining an original image training set, wherein the original image training set includes multiple original images and a label image corresponding to each original image;

[0008] Inputting the plurality of original images into an image processing model to obtain a plurality of predicted images output by the image processing model, wherein the predicted images are images after color interpolation and purple fringing elimination;

[0009] Determine the current iteration number;

[0010] Determining a target loss value between each predicted image and a corresponding labeled image according to the current number of iterations, the target loss value being used to indicate a structural similarity loss or a content similarity loss between the predicted image and the corresponding labeled image;

[0011] The image processing model is updated according to multiple target loss values until the image processing model converges.

[0012] In one possible implementation, determining a target loss value between each predicted image and a corresponding label image according to the current number of iterations includes:

[0013] Determine whether the current number of iterations is less than a preset number of generations;

[0014] If yes, determine a structural similarity loss value between each predicted image and the corresponding label image, and determine the structural similarity loss value as the target loss value;

[0015] If not, determine content similarity loss values between the multiple predicted images and the multiple label images, and determine the content similarity loss values as the target loss values.

[0016] In a possible implementation, for any predicted image, determining a structural similarity loss value between the predicted image and a corresponding label image includes:

[0017] Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image;

[0018] Determining, according to the label image, label pixel data corresponding to each of the plurality of channels;

[0019] For any one channel, determining a first similarity loss value between the predicted pixel data and the label pixel data;

[0020] The first similarity loss values corresponding to the multiple channels are added together to determine the structural similarity loss value.

[0021] In one possible implementation, the predicted pixel data includes predicted data values corresponding to a plurality of pixels, the label pixel data includes label data values corresponding to the plurality of pixels, and determining a first similarity loss value between the predicted pixel data and the label pixel data includes:

[0022] For any pixel, determining the structural similarity between the predicted data value corresponding to the pixel and the label data value corresponding to the pixel;

[0023] respectively determining the difference between the first preset value and the structural similarity corresponding to each pixel;

[0024] An average value of the sums of the plurality of difference values is determined as a first similarity loss value.

[0025] In a possible implementation, for any predicted image, determining a content similarity loss value between the predicted image and a corresponding label image includes:

[0026] Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image;

[0027] Determining, according to the label image, label pixel data corresponding to each of the plurality of channels;

[0028] For any one channel, determining a second similarity loss value between the predicted pixel data and the label pixel data;

[0029] The second similarity loss values corresponding to the multiple channels are added together to determine the content similarity loss value.

[0030] In one possible implementation, the predicted pixel data includes predicted data values corresponding to a plurality of pixels, the label pixel data includes label data values corresponding to the plurality of pixels, and determining a second similarity loss value between the predicted pixel data and the label pixel data includes:

[0031] For any pixel, determining a first difference between a predicted data value corresponding to the pixel and a label data value corresponding to the pixel;

[0032] Determine the square value of the first difference corresponding to each pixel;

[0033] An average value of the sums of the plurality of square values is determined as a second similarity loss value.

[0034] In a possible implementation, before obtaining the original image training set, the method further includes:

[0035] Get multiple red, green and blue RGB images;

[0036] performing recognition and classification processing on the plurality of RGB images to obtain a first image set and a second image set, wherein each RGB image in the first image set is an RGB image describing an indoor scene, and each RGB image in the second image set is an RGB image describing an outdoor scene;

[0037] The original image training set is determined according to the first image set and the second image set.

[0038] In a possible implementation, determining the original image training set according to the first image set and the second image set includes:

[0039] Preprocessing the plurality of RGB images in the second image set to obtain a third image set, wherein each RGB image in the third image set is an RGB image having a purple fringing phenomenon;

[0040] determining a target image set according to the first image set and the third image set, wherein the target image set includes a plurality of RGB images in the first image set and a plurality of RGB images in the third image set;

[0041] Determining each RGB image in the target image set as a label image, and performing mosaic processing on each label image in the target image set to obtain multiple original images;

[0042] The multiple original images and the label image corresponding to each original image are determined as the original image training set.

[0043] In a possible implementation, preprocessing the plurality of RGB images in the second image set to obtain a third image set includes:

[0044] Performing high-contrast region detection on a plurality of RGB images in the second image set to obtain a plurality of detection results, the detection results including the presence of high-contrast regions and the absence of high-contrast regions;

[0045] Determine the RGB image having a high-contrast area as a first RGB image;

[0046] Purple fringing processing is performed on the plurality of first RGB images to obtain a third image set.

[0047] In a second aspect, an image processing method is provided, the method comprising:

[0048] Get the target image sent by the preset hardware;

[0049] Inputting the target image into an image processing model to obtain an output image, wherein the output image is an image after color interpolation and purple fringing removal, and the image processing model is trained according to any one of the methods described in the first aspect;

[0050] The output image is sent to the preset hardware.

[0051] In a third aspect, an embodiment of the present application provides a model training device, comprising:

[0052] An acquisition module is used to acquire an original image training set, where the original image training set includes multiple original images and a label image corresponding to each original image;

[0053] a processing module, configured to input the plurality of original images into an image processing model to obtain a plurality of predicted images output by the image processing model, wherein the predicted images are images after color interpolation and purple fringing elimination;

[0054] A first determining module is used to determine the current number of iterations;

[0055] a second determining module, configured to determine a target loss value between each predicted image and a corresponding labeled image according to the current number of iterations, wherein the target loss value is used to indicate a structural similarity loss or a content similarity loss between the predicted image and the corresponding labeled image;

[0056] An updating module is used to update the image processing model according to multiple target loss values until the image processing model converges.

[0057] In a possible implementation, the second determining module is specifically configured to:

[0058] Determine whether the current number of iterations is less than a preset number of generations;

[0059] If yes, determine a structural similarity loss value between each predicted image and the corresponding label image, and determine the structural similarity loss value as the target loss value;

[0060] If not, determine content similarity loss values between the multiple predicted images and the multiple label images, and determine the content similarity loss values as the target loss values.

[0061] In a possible implementation, for any predicted image, the second determination module is specifically configured to:

[0062] Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image;

[0063] Determining, according to the label image, label pixel data corresponding to each of the plurality of channels;

[0064] For any one channel, determining a first similarity loss value between the predicted pixel data and the label pixel data;

[0065] The first similarity loss values corresponding to the multiple channels are added together to determine the structural similarity loss value.

[0066] In a possible implementation, the predicted pixel data includes predicted data values corresponding to a plurality of pixels, the label pixel data includes label data values corresponding to the plurality of pixels, and the second determining module is specifically configured to:

[0067] For any pixel, determining the structural similarity between the predicted data value corresponding to the pixel and the label data value corresponding to the pixel;

[0068] respectively determining the difference between the first preset value and the structural similarity corresponding to each pixel;

[0069] An average value of the sums of the plurality of difference values is determined as a first similarity loss value.

[0070] In a possible implementation, for any predicted image, the second determination module is specifically configured to:

[0071] Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image;

[0072] Determining, according to the label image, label pixel data corresponding to each of the plurality of channels;

[0073] For any one channel, determining a second similarity loss value between the predicted pixel data and the label pixel data;

[0074] The second similarity loss values corresponding to the multiple channels are added together to determine the content similarity loss value.

[0075] In a possible implementation, the predicted pixel data includes predicted data values corresponding to a plurality of pixels, the label pixel data includes label data values corresponding to the plurality of pixels, and the second determining module is specifically configured to:

[0076] For any pixel, determining a first difference between a predicted data value corresponding to the pixel and a label data value corresponding to the pixel;

[0077] Determine the square value of the first difference corresponding to each pixel;

[0078] An average value of the sums of the plurality of square values is determined as a second similarity loss value.

[0079] In a possible implementation, before obtaining the original image training set, the apparatus further includes a generation module, wherein the generation module is configured to:

[0080] Get multiple red, green and blue RGB images;

[0081] performing recognition and classification processing on the plurality of RGB images to obtain a first image set and a second image set, wherein each RGB image in the first image set is an RGB image describing an indoor scene, and each RGB image in the second image set is an RGB image describing an outdoor scene;

[0082] The original image training set is determined according to the first image set and the second image set.

[0083] In a possible implementation, the generating module is specifically configured to:

[0084] Preprocessing the plurality of RGB images in the second image set to obtain a third image set, wherein each RGB image in the third image set is an RGB image having a purple fringing phenomenon;

[0085] determining a target image set according to the first image set and the third image set, wherein the target image set includes a plurality of RGB images in the first image set and a plurality of RGB images in the third image set;

[0086] Determining each RGB image in the target image set as a label image, and performing mosaic processing on each label image in the target image set to obtain multiple original images;

[0087] The multiple original images and the label image corresponding to each original image are determined as the original image training set.

[0088] In a possible implementation, the generating module is specifically configured to:

[0089] Performing high-contrast region detection on a plurality of RGB images in the second image set to obtain a plurality of detection results, the detection results including the presence of high-contrast regions and the absence of high-contrast regions;

[0090] Determine the RGB image having a high-contrast area as a first RGB image;

[0091] Purple fringing processing is performed on the plurality of first RGB images to obtain a third image set.

[0092] In a fourth aspect, an embodiment of the present application provides an image processing device, comprising:

[0093] An acquisition module is used to acquire a target image sent by a preset hardware;

[0094] a processing module, configured to input the target image into an image processing model to obtain an output image, wherein the output image is an image after color interpolation and purple fringing removal, and the image processing model is trained using the method described in any one of the first aspects;

[0095] A sending module is used to send the output image to the preset hardware.

[0096] In a fifth aspect, the present application provides a chip having a computer program stored thereon, and when the computer program is executed by the chip, the model training method as described in any one of the first aspects is implemented.

[0097] In a sixth aspect, the present application provides a chip having a computer program stored thereon, and when the computer program is executed by the chip, the image processing method as described in any one of the second aspects is implemented.

[0098] In a seventh aspect, the present application provides a chip module having a computer program stored thereon. When the computer program is executed by the chip module, the model training method as described in any one of the first aspects is implemented.

[0099] In an eighth aspect, the present application provides a chip module having a computer program stored thereon. When the computer program is executed by the chip module, the image processing method as described in any one of the second aspects is implemented.

[0100] In a ninth aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor, and a transceiver;

[0101] The memory stores computer-executable instructions;

[0102] The processor executes the computer-executable instructions stored in the memory to implement the model training method as described in any one of the first aspects.

[0103] In a tenth aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a transceiver;

[0104] The memory stores computer-executable instructions;

[0105] The processor executes the computer-executable instructions stored in the memory to implement the image processing method as described in any one of the second aspects.

[0106] In the eleventh aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement the model training method as described in any one of the first aspects.

[0107] In the twelfth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement the image processing method as described in any one of the second aspects.

[0108] In the thirteenth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the model training method as described in any one of the first aspects.

[0109] In a fourteenth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the image processing method as described in any one of the second aspects.

[0110] The embodiments of the present application provide a model training method, an image processing method, an electronic device, and a storage medium. In this method, an original image training set is obtained, the original image training set includes multiple original images and a label image corresponding to each original image, the multiple original images are input into an image processing model, and multiple predicted images output by the image processing model are obtained. The predicted images are images after color interpolation and purple fringing removal. The current number of iterations is determined, and based on the current number of iterations, a target loss value between each predicted image and the corresponding label image is determined. The target loss value is used to indicate the structural similarity loss or content similarity loss between the predicted image and the corresponding label image. Based on the multiple target loss values, the image processing model is updated until the image processing model converges. In this way, the powerful nonlinear fitting capability of the image processing model is utilized to simultaneously remove purple fringing during the color interpolation process. The de-mosaicing module and the purple fringing removal module can be merged into one module, eliminating the need to set up a separate purple fringing removal module, reducing computing resources, and improving image processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0111] In order to more clearly illustrate the technical solutions in this application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0112] Figure 1 A schematic diagram of the processing process of an image processing algorithm provided in an embodiment of the present application;

[0113] Figure 2 A flowchart of a model training method provided in an embodiment of the present application;

[0114] Figure 3 A flowchart of another model training method provided in an embodiment of the present application;

[0115] Figure 4 A flowchart of another model training method provided in an embodiment of the present application;

[0116] Figure 5 A flowchart of an image processing method provided in an embodiment of the present application;

[0117] Figure 6 A schematic diagram of the processing process of another image processing algorithm provided in an embodiment of the present application;

[0118] Figure 7 A schematic diagram of the structure of a model training device provided in an embodiment of the present application;

[0119] Figure 8 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application;

[0120] Figure 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0121] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0122] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0123] It should be noted that although the terms "first" and "second" are used to describe various information in the embodiments of this application, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from each other. Alternatively, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.

[0124] It should be understood that the terms "comprise" and "include" indicate the presence of the previously mentioned features, steps, or operations, but do not exclude the presence, occurrence, or addition of one or at least one other feature, step, or operation. The terms "and / or" and the like used in this application may be interpreted as inclusive, or may mean any one or any combination. Alternatively, "A and / or B" means "any of the following: A; B; A and B." In addition, the character " / " in this document generally indicates that the preceding and following objects are in an "or" relationship.

[0125] During the imaging process of digital cameras, the refractive index of the camera lens varies for different wavelengths of light. This prevents different colors of light from being completely focused on the same spot, resulting in chromatic aberration. This can manifest as purple fringing at the boundary between high and low light levels. Purple fringing is a common problem that affects image quality.

[0126] In related technologies, purple fringing can be removed from images using image processing algorithms. The image processing algorithm's processing process can include a raw image (RAW) stage, a red, green, and blue (RGB) color space domain (RGB) stage, or a luma-chroma encoding domain (YUV) stage. To remove purple fringing from images, a separate purple fringing removal module is required during the image processing process. The purple fringing removal module can be set at any stage in the image processing process.

[0127] Next, combine Figure 1 , the processing process of the image processing algorithm is illustrated with examples.

[0128] Figure 1 This is a schematic diagram of the processing process of an image processing algorithm provided in an embodiment of the present application. Figure 1 , Figure 1 The image processing process may include a black level correction module, a lens shading correction module, an automatic white balance module, a demosaicing module, a color correction module, a gamma enhancement module, a color conversion module, and a specially designed purple fringing removal module.

[0129] The purple fringing removal module may be located after the automatic white balance module and before the demosaicing module, or after the gamma enhancement module and before the color conversion module, which is not limited here.

[0130] The black level correction module detects the sensor's output signal in a dark environment and determines the black level offset. This offset is then subtracted from the actual captured image data, rendering areas that should be black truly black. This effectively reduces noise in dark areas of the image and improves contrast and detail.

[0131] The lens shading correction module can increase the brightness of the edge of the image based on the characteristics of the lens, so that the brightness of the edge and the center is balanced. The lens shading correction module can be used to adjust the brightness of different areas of the image.

[0132] The automatic white balance module determines the color temperature of the light source by analyzing the white or gray areas in the image. The automatic white balance module can adjust the gain of the red, green, and blue channels according to a preset algorithm.

[0133] For example, if it is detected that the image is yellowish (low color temperature light source), the gain of the red channel will be reduced and the gain of the blue channel will be relatively increased to restore the correct display of white.

[0134] The demosaicing module can calculate the other color components that the pixel should have based on the distance and color intensity of the surrounding pixels through weighted averaging and other methods. The demosaicing module can use a variety of interpolation algorithms, such as bilinear interpolation and bicubic interpolation.

[0135] The color correction module adjusts the color balance of the red, green, and blue channels using a preset color correction matrix. For example, if the image has an overall reddish tint, the color correction module can adjust the matrix to reduce the intensity of the red channel. The color correction module can also perform more sophisticated color correction using methods such as color space conversion and color lookup tables.

[0136] The Gamma Enhancement module can change the distribution of bright and dark areas of an image by adjusting the gamma value, thereby enhancing the image's layering. The gamma function is a nonlinear function. Generally, a gamma value less than 1 will brighten the image, while a gamma value greater than 1 will darken the image.

[0137] The color conversion module can be implemented using a color space conversion matrix. This matrix contains the conversion relationship between two color spaces. Through mathematical operations such as matrix multiplication, it converts the image coordinates in the original color space into the target color space. Different color space conversions require different conversion matrices, and the mapping and adjustment of the color range must also be considered.

[0138] The purple fringing removal module can be used to reduce or eliminate the purple fringing phenomenon that occurs at the boundary between high light and low light in the image during the imaging process of a digital camera, thereby improving image quality.

[0139] If the purple fringing removal module is set in the RAW stage, it can use the information in the original data that has not undergone complex color conversion to identify areas where purple fringing may occur by analyzing the color gradient and edge information of the pixels, and then use some algorithms (such as chromatic aberration compensation algorithm) to remove the purple fringing.

[0140] If the purple fringing removal module is in the RGB stage, it can remove the purple fringing by analyzing the color values of the red, green, and blue channels, finding the purple area, and adjusting the balance between channels.

[0141] If the purple fringing removal module is set in the YUV stage, color anomalies can be eliminated by adjusting the chrominance components (U and V) while avoiding excessive interference with the brightness information (Y).

[0142] During the image processing process, a separate purple fringing removal module requires more computing resources, resulting in low image processing efficiency.

[0143] In order to solve the above technical problems, an embodiment of the present application provides a model training method, which obtains an original image training set, wherein the original image training set includes multiple original images and a label image corresponding to each original image, and inputs the multiple original images into an image processing model to obtain multiple predicted images, wherein the predicted images are images after color interpolation and purple fringing removal. According to the current number of iterations of the image processing model, multiple target loss values are determined, and the image processing model is trained according to the multiple target loss values until the image processing model converges to obtain a trained image processing model. The target loss value can indicate the structural similarity loss or content similarity loss between the predicted image and the corresponding label image. In this way, the powerful nonlinear fitting ability of the image processing model is utilized to simultaneously remove purple fringing during the color interpolation process, and the de-mosaicing module and the purple fringing removal module can be merged into one module, without the need to set up a separate purple fringing removal module, thereby reducing computing resources and improving image processing efficiency.

[0144] The technical solutions shown in this application are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be repeated in different embodiments.

[0145] Figure 2 This is a flow chart of a model training method provided in an embodiment of the present application. The execution subject of the embodiment of the present application can be an electronic device or a model training device provided in the electronic device. The model training device can be implemented by software or a combination of software and hardware.

[0146] See Figure 2 , the method comprising:

[0147] S201. Obtain an original image training set.

[0148] The original image training set includes multiple original images and a label image corresponding to each original image.

[0149] The multiple original images may include multiple original images describing indoor scenes and multiple original images describing outdoor scenes.

[0150] The original image may be an image corresponding to a RAW format.

[0151] The label image can be an ideal image of the original image after color difference and purple fringing elimination.

[0152] The label image can be an image in RGB format.

[0153] The original image training set can be used to train the image processing model so that the error between the predicted image output by the image processing model and the label image is within a preset range.

[0154] The original image training set can be obtained in the storage space.

[0155] S202: Input multiple original images into an image processing model to obtain multiple predicted images output by the image processing model.

[0156] The predicted image is the image after color interpolation and purple fringing removal.

[0157] The image processing model can be used to perform color interpolation and purple fringing removal on images.

[0158] Each original image may be input into an image processing model, and the image processing model outputs an output image after color interpolation and purple fringing elimination, and multiple output images are determined as multiple predicted images.

[0159] S203: Determine the current number of iterations.

[0160] The current iteration number can be used to indicate the number of current training iterations of the image processing model.

[0161] The current number of iterations corresponding to the initial image processing model is 1.

[0162] The historical training data of the image processing model can be obtained, and the current number of iterations can be determined based on the historical training data.

[0163] For example, the current number of iterations is 5.

[0164] S204: Determine the target loss value between each predicted image and the corresponding label image based on the current number of iterations.

[0165] The target loss value is used to indicate the structural similarity loss or content similarity loss between the predicted image and the corresponding label image.

[0166] Structural similarity loss can be used to measure the structural similarity between the predicted image and the corresponding label image.

[0167] The structural similarity loss can be determined based on multiple means, multiple variances, and multiple covariances between multiple predicted image blocks corresponding to the predicted image and multiple label image blocks corresponding to the label image, which is not limited here.

[0168] Content similarity loss can be used to measure the similarity of content details between the predicted image and the corresponding label image.

[0169] The content similarity loss can be determined based on the minimum mean square error between the predicted image and the corresponding label image, which is not limited here.

[0170] It can be determined whether the current number of iterations is less than a preset number of generations. If so, the structural similarity loss is determined as the target loss value. If not, the content similarity loss is determined as the target loss value.

[0171] Optionally, the target loss value between each predicted image and the corresponding label image can be determined according to the current number of iterations in the following manner: determine whether the current number of iterations is less than a preset number of generations; if so, determine the structural similarity loss value between each predicted image and the corresponding label image, and determine the structural similarity loss value as the target loss value; if not, determine the content similarity loss value between multiple predicted images and multiple label images, and determine the content similarity loss value as the target loss value.

[0172] S205. Update the image processing model according to the multiple target loss values until the image processing model converges.

[0173] Updating the image processing model can be used to update the parameters of the image processing model to reduce the target loss value.

[0174] The convergence of the image processing model can be used to indicate that the target loss value no longer decreases significantly in multiple consecutive iterations, indicating that the training of the image processing model is completed.

[0175] Based on multiple target loss values, the gradient of each parameter in the image processing model can be calculated through the back propagation algorithm, and the parameters of the image processing model can be updated according to the gradient through the optimization algorithm until the image processing model converges.

[0176] The gradient can be used to indicate how to adjust the parameters to reduce the target loss value.

[0177] The model training method provided in this embodiment obtains an original image training set, which includes multiple original images and a label image corresponding to each original image. The multiple original images are input into an image processing model to obtain multiple predicted images output by the image processing model. The predicted images are images after color interpolation and purple fringing removal. The current number of iterations is determined. Based on the current number of iterations, a target loss value is determined between each predicted image and the corresponding label image. The target loss value is used to indicate the structural similarity loss or content similarity loss between the predicted image and the corresponding label image. Based on the multiple target loss values, the image processing model is updated until the image processing model converges. In this way, the powerful nonlinear fitting capability of the image processing model is utilized to simultaneously remove purple fringing during the color interpolation process. The de-mosaicing module and the purple fringing removal module can be combined into one module, eliminating the need for a separate purple fringing removal module, reducing computing resources, and improving image processing efficiency.

[0178] Next, combine Figure 3 , the process (S204) of determining the target loss value between each predicted image and the corresponding label image according to the current number of iterations is explained.

[0179] Figure 3 This is a flow chart of another model training method provided in the embodiment of the present application. Based on the above embodiment, please refer to Figure 3 , the method comprising:

[0180] S301: Determine whether the current number of iterations is less than a preset number of generations.

[0181] If yes, execute S302;

[0182] If not, execute S307.

[0183] It can be determined whether the current number of iterations is less than the preset number of generations. If the current number of iterations is less than the preset number of generations, the structural similarity loss value between each predicted image and the corresponding label image can be determined, and the structural similarity loss value can be determined as the target loss value; if the current number of iterations is greater than or equal to the preset number of generations, the content similarity loss value between multiple predicted images and multiple label images can be determined, and the content similarity loss value can be determined as the target loss value.

[0184] The following explanation is given by taking any one of the multiple predicted images as an example.

[0185] S302: Determine predicted pixel data corresponding to the plurality of channels according to the predicted image.

[0186] The multiple channels may be multiple channels in RGB channels, such as an R channel, a G channel, and a B channel.

[0187] The predicted pixel data can be used to represent multiple pixel values corresponding to any channel in the predicted image.

[0188] Based on the predicted image, channel predicted images corresponding to the multiple channels can be determined, and based on the multiple channel predicted images, predicted pixel data corresponding to the multiple channels can be determined.

[0189] S303: Determine label pixel data corresponding to the multiple channels according to the label image.

[0190] The label pixel data can be used to represent multiple pixel values corresponding to any channel in the label image.

[0191] Channel label images corresponding to the multiple channels can be determined based on the label image, and label pixel data corresponding to the multiple channels can be determined based on the multiple channel label images.

[0192] The following explanation is given by taking any one of the multiple channels as an example.

[0193] S304: Determine a first similarity loss value between the predicted pixel data and the label pixel data.

[0194] The first similarity loss value may be used to represent a structural similarity loss value between the predicted pixel data and the corresponding label pixel data.

[0195] A preset formula may be obtained, and a first similarity loss value between the predicted pixel data and the label pixel data may be determined according to the preset formula.

[0196] Optionally, the predicted pixel data may include predicted data values corresponding to multiple pixels, and the label pixel data may include label data values corresponding to multiple pixels. The first similarity loss value between the predicted pixel data and the label pixel data can be determined in the following manner: for any pixel, determine the structural similarity between the predicted data value corresponding to the pixel and the label data value corresponding to the pixel; determine the difference between the first preset value and the structural similarity corresponding to each pixel respectively; and determine the average value of the sum of multiple differences as the first similarity loss value.

[0197] Structural similarity can be a measure of the similarity between two images.

[0198] The first preset value may be a preset value. For example, the first preset value is 1.

[0199] Optionally, the first similarity loss value between the predicted pixel data and the label pixel data can be determined by the following formula:

[0200]

[0201] Among them, L SSIM It can represent the first similarity loss value corresponding to any channel. The predicted image and the label image have the same height and width. h can represent the height of the predicted image or the label image, and w can represent the width of the predicted image or the label image.

[0202] Taking the lower left corner of the predicted image or label image as the origin, a h×w rectangular coordinate can be formed. i,j It can represent the predicted data value of the pixel point (i, j); i,j It can represent the label data value of the pixel point (i, j); SSIM(x i,j ,y i,j ) can represent the structural similarity between the predicted data value of the pixel point corresponding to (i, j) and the label data value of the pixel point.

[0203] S305 : Add the first similarity loss values corresponding to the multiple channels to determine a structural similarity loss value.

[0204] The structural similarity loss value may be a value corresponding to the structural similarity loss.

[0205] Alternatively, the structural similarity loss value can be determined by the following formula:

[0206] L1=L SSIM 1+L SSIM 2+L SSIM 3

[0207] Among them, the multiple channels include 3 channels, and the first similarity loss values corresponding to the 3 channels can be expressed as L SSIM 1. L SSIM 2. L SSIM 3 to indicate that L1 can represent the structural similarity loss value.

[0208] S306: Determine the structural similarity loss value as the target loss value.

[0209] For example, assuming that the structural similarity loss value is L1, L1 can be determined as the target loss value.

[0210] The following explanation is given by taking any one of the multiple predicted images as an example.

[0211] S307 : Determine predicted pixel data corresponding to the plurality of channels according to the predicted image.

[0212] The execution process of S307 can refer to the execution process of S302, and will not be repeated here.

[0213] S308 : Determine label pixel data corresponding to the multiple channels according to the label image.

[0214] The execution process of S308 can refer to the execution process of S303, and will not be repeated here.

[0215] The following explanation is given by taking any one of the multiple channels as an example.

[0216] S309: Determine a second similarity loss value between the predicted pixel data and the label pixel data.

[0217] The second similarity loss value may be used to represent a content similarity loss value between the predicted pixel data and the corresponding label pixel data.

[0218] A preset formula may be obtained, and a second similarity loss value between the predicted pixel data and the label pixel data may be determined according to the preset formula.

[0219] Optionally, the predicted pixel data includes predicted data values corresponding to multiple pixels, and the label pixel data includes label data values corresponding to multiple pixels. The second similarity loss value between the predicted pixel data and the label pixel data can be determined in the following manner: for any pixel, determine the first difference between the predicted data value corresponding to the pixel and the label data value corresponding to the pixel; determine the square value of the first difference corresponding to each pixel; and determine the average value of the sum of the multiple square values as the second similarity loss value.

[0220] Optionally, the second similarity loss value between the predicted pixel data and the label pixel data may be determined in the following manner:

[0221]

[0222] Among them, L MSE It can represent the second similarity loss value corresponding to any channel. The predicted image and the label image have the same height. h can represent the height of the predicted image or the label image, and w can represent the width of the predicted image or the label image.

[0223] Taking the lower left corner of the predicted image or label image as the origin, a h×w rectangular coordinate can be formed. i,j It can represent the predicted data value of the pixel point (i, j); i,j It can represent the label data value of the pixel corresponding to (i, j).

[0224] S310 : Add the second similarity loss values corresponding to the multiple channels to determine a content similarity loss value.

[0225] The content similarity loss value may be a value corresponding to the content similarity loss.

[0226] Alternatively, the structural similarity loss value can be determined by the following formula:

[0227] L2=L MSE 1+L MSE 2+L MSE 3

[0228] Among them, the multiple channels include 3 channels, and the second similarity loss values corresponding to the 3 channels can be expressed as L MSE 1. L MSE 2. L MSE 3, L2 can represent the content similarity loss value.

[0229] S311: Determine the content similarity loss value as the target loss value.

[0230] For example, assuming that the content similarity loss value is L2, L2 can be determined as the target loss value.

[0231] The implementation content of each step in the embodiment of the present application can refer to the description of the corresponding steps or operations in the above method embodiment, and repeated content will not be repeated.

[0232] The model training method provided by this embodiment determines whether the current number of iterations is less than a preset number of generations. If so, for any predicted image, based on the predicted image, the predicted pixel data corresponding to multiple channels are determined, and based on the label image, the label pixel data corresponding to multiple channels are determined. For any channel, a first similarity loss value between the predicted pixel data and the label pixel data is determined, and the first similarity loss values corresponding to the multiple channels are added to determine a structural similarity loss value, and the structural similarity loss value is determined as a target loss value. If not, for any predicted image, based on the predicted image, the predicted pixel data corresponding to multiple channels are determined, and based on the label image, the label pixel data corresponding to multiple channels are determined. For any channel, a second similarity loss value between the predicted pixel data and the label pixel data is determined, and the second similarity loss values corresponding to the multiple channels are added to determine a content similarity loss value, and the content similarity loss value is determined as the target loss value. In this way, the image processing model is updated by the target loss value, and the powerful nonlinear fitting ability of the image processing model is utilized to synchronously remove the purple fringing during the color interpolation process. The demosaicing module and the purple fringing removal module can be merged into one module, without the need to set up a separate purple fringing removal module, thereby reducing computing resources and improving image processing efficiency.

[0233] In a possible implementation, before obtaining the original image training set, the process further includes generating the original image training set.

[0234] Next, combine Figure 4 , explaining the process of generating the original image training set.

[0235] Figure 4 This is a flow chart of another model training method provided in the embodiment of the present application. Based on the above embodiment, please refer to Figure 4 , the method comprising:

[0236] S401: Acquire multiple red, green, and blue (RGB) images.

[0237] Multiple red, green, and blue (RGB) images can be collected in multiple high-quality image sets.

[0238] S402 : Perform recognition and classification processing on the multiple RGB images to obtain a first image set and a second image set.

[0239] Each RGB image in the first image set is an RGB image describing an indoor scene, and each RGB image in the second image set is an RGB image describing an outdoor scene.

[0240] The multiple RGB images may be recognized to obtain multiple recognition results, and the multiple RGB images may be classified based on the multiple recognition results to obtain a first image set and a second image set.

[0241] The multiple recognition results may include descriptions of indoor scenes and descriptions of outdoor scenes.

[0242] S403: Preprocess the multiple RGB images in the second image set to obtain a third image set.

[0243] Each RGB image in the third image set is an RGB image with a purple-fringe phenomenon.

[0244] High-contrast region detection and purple-fringe construction processing may be performed on the plurality of RGB images in the second image set to obtain a third image set.

[0245] Optionally, the plurality of RGB images in the second image set may be preprocessed in the following manner to obtain a third image set: high-contrast area detection is performed on the plurality of RGB images in the second image set to obtain a plurality of detection results; an RGB image having a high-contrast area as detected by the first RGB image is determined as the first RGB image; and purple-fringe construction processing is performed on the plurality of first RGB images to obtain a third image set.

[0246] The detection results include the presence of high-contrast areas and the absence of high-contrast areas.

[0247] S404: Determine a target image set according to the first image set and the third image set.

[0248] The target image set includes multiple RGB images in the first image set and multiple RGB images in the third image set.

[0249] A preset ratio may be obtained, and a plurality of RGB images are respectively obtained from the first image set and the third image set according to the preset ratio to determine the target image set.

[0250] S405 : Determine each RGB image in the target image set as a label image, and perform mosaic processing on each label image in the target image set to obtain multiple original images.

[0251] Each RGB image in the target image set can be determined as a label image, preset parameters corresponding to mosaic processing can be obtained, and mosaic processing can be performed on each label image in the target image set according to the preset parameters to obtain multiple original images.

[0252] S406: Determine the multiple original images and the label image corresponding to each original image as an original image training set.

[0253] The original image training set may include multiple original images and a label image corresponding to each original image.

[0254] The label image can be the ground truth image of the original image.

[0255] The model training method provided in this embodiment obtains multiple red, green, and blue (RGB) images, identifies and classifies the multiple RGB images to obtain a first image set and a second image set, where each RGB image in the first image set is an RGB image describing an indoor scene, and each RGB image in the second image set is an RGB image describing an outdoor scene. The multiple RGB images in the second image set are preprocessed to obtain a third image set, where each RGB image in the third image set is an RGB image with purple fringing. Based on the first image set and the third image set, a target image set is determined, where the target image set includes the multiple RGB images in the first image set and the multiple RGB images in the third image set. Each RGB image in the target image set is determined as a label image, and each label image in the target image set is mosaic processed to obtain multiple original images. The multiple original images and the label image corresponding to each original image are determined as the original image training set. In this way, by generating the original image training set to train the image processing model, and utilizing the powerful nonlinear fitting ability of the image processing model, the purple fringing can be removed synchronously during the color interpolation process. The demosaicing module and the purple fringing removal module can be merged into one module, without the need to set up a separate purple fringing removal module, thereby reducing computing resources and improving image processing efficiency.

[0256] Figure 5 This is a flowchart of an image processing method provided by an embodiment of the present application. The execution subject of the embodiment of the present application can be a processor or an image processing device set in the processor.

[0257] See Figure 5 , the method comprising:

[0258] S501: Acquire a target image sent by preset hardware.

[0259] Preset hardware can transfer the target image to the processor.

[0260] The preset hardware may be a memory or other hardware, which is not limited here.

[0261] The transmission data sent by the preset hardware can be obtained, and the transmission data can be analyzed to obtain the target image.

[0262] S502: Input the target image into the image processing model to obtain an output image.

[0263] The output image is an image after color interpolation and purple fringing elimination, and the image processing model is trained according to any of the above model training methods.

[0264] The target image is preprocessed to obtain a processed target image, and the processed target image is input into a trained image processing model to obtain an output image.

[0265] S503: Send the output image to the preset hardware.

[0266] The output image can be optimized to obtain an optimized output image, and the optimized output image can be sent to the preset hardware.

[0267] Next, combine Figure 6 , giving examples of the connection structure of the preset hardware.

[0268] Figure 6 This is a schematic diagram of the processing process of another image processing algorithm provided in the embodiment of this application. Figure 6 , Figure 6 The image processing process may include a black level correction module, a lens shading correction module, an automatic white balance module, a preset hardware module, a color correction module, a gamma enhancement module, and a color conversion module, wherein the preset hardware module may be connected to the processor.

[0269] The processor may be configured to execute S501 - 503 .

[0270] The image processing method provided in this embodiment obtains a target image sent by preset hardware and inputs the target image into an image processing model to obtain an output image. The output image is an image that has undergone color interpolation and purple fringing removal. The image processing model is trained using any of the aforementioned model training methods, and the output image is sent to the preset hardware. This utilizes the powerful nonlinear fitting capabilities of the image processing model to simultaneously remove purple fringing during color interpolation. This allows the demosaicing module and the purple fringing removal module to be combined into a single module, eliminating the need for a separate purple fringing removal module. This reduces computing resources and improves image processing efficiency.

[0271] Figure 7 This is a schematic diagram of the structure of a model training device provided in an embodiment of the present application. Figure 7 The model training device 700 includes an acquisition module 701, a processing module 702, a first determination module 703, a second determination module 704 and an update module 705, wherein:

[0272] An acquisition module 701 is configured to acquire an original image training set, where the original image training set includes multiple original images and a label image corresponding to each original image.

[0273] A processing module 702 is configured to input the plurality of original images into an image processing model to obtain a plurality of predicted images output by the image processing model, wherein the predicted images are images after color interpolation and purple fringing removal;

[0274] A first determining module 703 is used to determine the current number of iterations;

[0275] A second determining module 704 is configured to determine a target loss value between each predicted image and a corresponding labeled image based on the current number of iterations, wherein the target loss value indicates a structural similarity loss or a content similarity loss between the predicted image and the corresponding labeled image.

[0276] The updating module 705 is used to update the image processing model according to multiple target loss values until the image processing model converges.

[0277] In a possible implementation, the second determining module 704 is specifically configured to:

[0278] Determine whether the current number of iterations is less than a preset number of generations;

[0279] If yes, determine a structural similarity loss value between each predicted image and the corresponding label image, and determine the structural similarity loss value as the target loss value;

[0280] If not, determine content similarity loss values between the multiple predicted images and the multiple label images, and determine the content similarity loss values as the target loss values.

[0281] In a possible implementation, for any predicted image, the second determining module 704 is specifically configured to:

[0282] Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image;

[0283] Determining, according to the label image, label pixel data corresponding to each of the plurality of channels;

[0284] For any one channel, determining a first similarity loss value between the predicted pixel data and the label pixel data;

[0285] The first similarity loss values corresponding to the multiple channels are added together to determine the structural similarity loss value.

[0286] In a possible implementation, the predicted pixel data includes predicted data values corresponding to a plurality of pixels, and the label pixel data includes label data values corresponding to the plurality of pixels. The second determining module 704 is specifically configured to:

[0287] For any pixel, determining the structural similarity between the predicted data value corresponding to the pixel and the label data value corresponding to the pixel;

[0288] respectively determining the difference between the first preset value and the structural similarity corresponding to each pixel;

[0289] An average value of the sums of the plurality of difference values is determined as a first similarity loss value.

[0290] In a possible implementation, for any predicted image, the second determining module 704 is specifically configured to:

[0291] Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image;

[0292] Determining, according to the label image, label pixel data corresponding to each of the plurality of channels;

[0293] For any one channel, determining a second similarity loss value between the predicted pixel data and the label pixel data;

[0294] The second similarity loss values corresponding to the multiple channels are added together to determine the content similarity loss value.

[0295] In a possible implementation, the predicted pixel data includes predicted data values corresponding to a plurality of pixels, and the label pixel data includes label data values corresponding to the plurality of pixels. The second determining module 704 is specifically configured to:

[0296] For any pixel, determining a first difference between a predicted data value corresponding to the pixel and a label data value corresponding to the pixel;

[0297] Determine the square value of the first difference corresponding to each pixel;

[0298] An average value of the sums of the plurality of square values is determined as a second similarity loss value.

[0299] In a possible implementation, before obtaining the original image training set, the apparatus further includes a generating module 706, wherein the generating module 706 is configured to:

[0300] Get multiple red, green and blue RGB images;

[0301] performing recognition and classification processing on the plurality of RGB images to obtain a first image set and a second image set, wherein each RGB image in the first image set is an RGB image describing an indoor scene, and each RGB image in the second image set is an RGB image describing an outdoor scene;

[0302] The original image training set is determined according to the first image set and the second image set.

[0303] In a possible implementation, the generating module 706 is specifically configured to:

[0304] Preprocessing the plurality of RGB images in the second image set to obtain a third image set, wherein each RGB image in the third image set is an RGB image having a purple fringing phenomenon;

[0305] determining a target image set according to the first image set and the third image set, wherein the target image set includes a plurality of RGB images in the first image set and a plurality of RGB images in the third image set;

[0306] Determining each RGB image in the target image set as a label image, and performing mosaic processing on each label image in the target image set to obtain multiple original images;

[0307] The multiple original images and the label image corresponding to each original image are determined as the original image training set.

[0308] In a possible implementation, the generating module 706 is specifically configured to:

[0309] Performing high-contrast region detection on a plurality of RGB images in the second image set to obtain a plurality of detection results, the detection results including the presence of high-contrast regions and the absence of high-contrast regions;

[0310] Determine the RGB image having a high-contrast area as a first RGB image;

[0311] Purple fringing processing is performed on the plurality of first RGB images to obtain a third image set.

[0312] Figure 8 This is a structural diagram of an image processing device provided in an embodiment of the present application. Figure 8 The image processing device 800 includes an acquisition module 801, a processing module 802 and a sending module 803, wherein:

[0313] An acquisition module 801 is used to acquire a target image sent by a preset hardware;

[0314] Processing module 802, configured to input the target image into an image processing model to obtain an output image, wherein the output image is an image after color interpolation and purple fringing removal, and the image processing model is trained using the above-mentioned model training method;

[0315] The sending module 803 is configured to send the output image to the preset hardware.

[0316] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 9 , the electronic device 900 may include: a memory 901 , a processor 902 , and a transceiver 903 .

[0317] The memory 901 is used to store program instructions;

[0318] The processor 902 is used to execute the program instructions stored in the memory to enable the electronic device 900 to execute any of the model training methods or image processing methods shown above.

[0319] The transceiver 903 may include a transmitter and / or a receiver. The transmitter may also be referred to as a transmitter, a transmitter, a transmission port, a transmission interface, or similar descriptions, and the receiver may also be referred to as a receiver, a reception port, a reception interface, or similar descriptions. For example, the memory 901, the processor 902, and the transceiver 903 are interconnected via a bus 904.

[0320] The present application also provides a chip having a computer program stored thereon. When the computer program is executed by the chip, the above-mentioned model training method or image processing method is implemented. The corresponding content and effects can be referred to the method embodiment part, which will not be repeated here.

[0321] The present application also provides a chip module, on which a computer program is stored. When the computer program is executed by the chip module, the above-mentioned model training method or image processing method is implemented. The corresponding content and effects can be referred to the method embodiment part, which will not be repeated here.

[0322] An embodiment of the present application also provides a computer program product, which can be executed by a processor. When the computer program product is executed, the above-mentioned model training method or image processing method can be implemented.

[0323] The model training device, electronic device, computer-readable storage medium and computer program product of the embodiments of the present application can execute the technical solutions shown in the above-mentioned model training method or image processing method embodiments. Their implementation principles and beneficial effects are similar and will not be repeated here.

[0324] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.

[0325] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer-executable instructions. These computer-executable instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0326] These computer-executable instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0327] These computer-executable instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0328] Obviously, those skilled in the art may make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations.

Claims

1. A model training method, characterized in that: The method comprises: Obtaining an original image training set, wherein the original image training set includes multiple original images and a label image corresponding to each original image; Inputting the plurality of original images into an image processing model to obtain a plurality of predicted images output by the image processing model, wherein the predicted images are images after color interpolation and purple fringing elimination; Determine the current iteration number; Determining a target loss value between each predicted image and a corresponding labeled image according to the current number of iterations, the target loss value being used to indicate a structural similarity loss or a content similarity loss between the predicted image and the corresponding labeled image; The image processing model is updated according to multiple target loss values until the image processing model converges.

2. The method according to claim 1, characterized in that Determining a target loss value between each predicted image and the corresponding label image based on the current number of iterations, including: Determine whether the current number of iterations is less than a preset number of generations; If yes, determine a structural similarity loss value between each predicted image and the corresponding label image, and determine the structural similarity loss value as the target loss value; If not, determine content similarity loss values between the multiple predicted images and the multiple label images, and determine the content similarity loss values as the target loss values.

3. The method according to claim 2, characterized in that For any predicted image, determining the structural similarity loss value between the predicted image and the corresponding label image includes: Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image; Determining, according to the label image, label pixel data corresponding to each of the plurality of channels; For any one channel, determining a first similarity loss value between the predicted pixel data and the label pixel data; The first similarity loss values corresponding to the multiple channels are added together to determine the structural similarity loss value.

4. The method according to claim 3, characterized in that The predicted pixel data includes predicted data values corresponding to a plurality of pixels, the label pixel data includes label data values corresponding to the plurality of pixels, and determining a first similarity loss value between the predicted pixel data and the label pixel data includes: For any pixel, determining the structural similarity between the predicted data value corresponding to the pixel and the label data value corresponding to the pixel; respectively determining the difference between the first preset value and the structural similarity corresponding to each pixel; An average value of the sums of the plurality of difference values is determined as a first similarity loss value.

5. The method according to claim 2, characterized in that For any predicted image, determining a content similarity loss value between the predicted image and the corresponding label image includes: Determining predicted pixel data corresponding to a plurality of channels respectively according to the predicted image; Determining, according to the label image, label pixel data corresponding to each of the plurality of channels; For any one channel, determining a second similarity loss value between the predicted pixel data and the label pixel data; The second similarity loss values corresponding to the multiple channels are added together to determine the content similarity loss value.

6. The method according to claim 5, characterized in that The predicted pixel data includes predicted data values corresponding to a plurality of pixels, the label pixel data includes label data values corresponding to the plurality of pixels, and determining a second similarity loss value between the predicted pixel data and the label pixel data includes: For any pixel, determining a first difference between a predicted data value corresponding to the pixel and a label data value corresponding to the pixel; Determine the square value of the first difference corresponding to each pixel; An average value of the sums of the plurality of square values is determined as a second similarity loss value.

7. The method according to any one of claims 1 to 6, characterized in that Before obtaining the original image training set, it also includes: Get multiple red, green and blue RGB images; performing recognition and classification processing on the plurality of RGB images to obtain a first image set and a second image set, wherein each RGB image in the first image set is an RGB image describing an indoor scene, and each RGB image in the second image set is an RGB image describing an outdoor scene; The original image training set is determined according to the first image set and the second image set.

8. The method according to claim 7, characterized in that Determining the original image training set according to the first image set and the second image set includes: Preprocessing the plurality of RGB images in the second image set to obtain a third image set, wherein each RGB image in the third image set is an RGB image having a purple fringing phenomenon; determining a target image set according to the first image set and the third image set, wherein the target image set includes a plurality of RGB images in the first image set and a plurality of RGB images in the third image set; Determining each RGB image in the target image set as a label image, and performing mosaic processing on each label image in the target image set to obtain multiple original images; The multiple original images and the label image corresponding to each original image are determined as the original image training set.

9. The method according to claim 8, characterized in that Preprocessing the plurality of RGB images in the second image set to obtain a third image set includes: Performing high-contrast region detection on a plurality of RGB images in the second image set to obtain a plurality of detection results, the detection results including the presence of high-contrast regions and the absence of high-contrast regions; Determine the RGB image having a high-contrast area as a first RGB image; Purple fringing processing is performed on the plurality of first RGB images to obtain a third image set.

10. An image processing method, characterized in that: The method comprises: Get the target image sent by the preset hardware; Inputting the target image into an image processing model to obtain an output image, wherein the output image is an image after color interpolation and purple fringing removal, and the image processing model is trained using the method according to any one of claims 1 to 9; The output image is sent to the preset hardware.

11. An electronic device, characterized in that: include: memory, processors, and transceivers; wherein the memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.