Image processing method, device, readable medium and electronic device
The image attributes and lighting information are processed through the information extraction model and relighting technology, which solves the problem of inconsistent shadows when adding images, improves the image processing effect, makes lighting changes more consistent, and improves the overall effect of the image.
Patent Information
- Application Number
- CN202011159192.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-26
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-10-26
AI Technical Summary
In image processing, when one image is directly added to another image, the light and shadow changes are inconsistent, resulting in poor image processing results.
The target attribute information and illumination information are determined through the information extraction model, and the relighting technology is used to render the image to obtain the processed target image so that its illumination changes are consistent with the target image.
The image processing effect is improved, making the lighting changes of the added image more consistent with the lighting changes of the target image, improving the overall effect of the image.
Smart Images

Figure CN112258622B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing, and in particular, to an image processing method, device, readable medium and electronic device. Background Art
[0002] In some scenarios, it is often necessary to add an image to another image (for example, a single image, an image in a video, etc.), and then place the content of one image into the scene of another image. For example, in house decoration design, an image of a certain furniture is added to a room image to place the furniture into the room scene, so as to observe the effect of placing the furniture in a certain position in the room. For another example, in the process of product display, it is usually necessary to observe the effect of adding a certain product to a specific scene, so it is necessary to add the product image to the scene image. In general, the image to be added corresponds to certain light and shadow changes, and there are also light and shadow changes in the image scene of the added content. The two light and shadow changes are usually different. If the image is added directly, the light and shadow of one of the new images obtained after the addition will be inconsistent with the light and shadow of the other, or even contradictory, and the image processing effect is not good. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides an image processing method, the method comprising:
[0005] Acquire a first image and a second image;
[0006] Determining target attribute information of the first image through an information extraction model, where the attribute information includes at least one of depth information, normal information, color information, and material information;
[0007] Acquire target illumination information at a specified position in the second image;
[0008] According to the target attribute information and the target illumination information, rendering the first image by using a re-illumination technique to obtain a processed target image;
[0009] The information extraction model is obtained based on the initial model, and the initial model is used to extract attribute information and lighting information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If the training stopping condition is not met, the target loss value is used to update the initial model, and the updated initial model is used for the next training.
[0010] In a second aspect, the present disclosure provides an image processing device, the device comprising:
[0011] A first acquisition module, used to acquire a first image and a second image;
[0012] A determination module, configured to determine target attribute information of the first image through an information extraction model, wherein the attribute information includes at least one of depth information, normal information, color information, and material information;
[0013] A second acquisition module, used to acquire target illumination information at a specified position in the second image;
[0014] A first processing module, configured to render the first image using a re-illumination technique according to the target attribute information and the target illumination information, to obtain a processed target image;
[0015] The information extraction model is obtained based on the initial model, and the initial model is used to extract attribute information and lighting information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If the training stopping condition is not met, the target loss value is used to update the initial model, and the updated initial model is used for the next training.
[0016] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of the present disclosure.
[0017] In a fourth aspect, the present disclosure provides an electronic device, including:
[0018] a storage device having a computer program stored thereon;
[0019] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
[0020] Through the above technical solution, after obtaining the first image and the second image, the target attribute information of the first image is determined through the information extraction model, and the target illumination information at the specified position in the second image is obtained. After that, according to the target attribute information and the target illumination information, the first image is rendered using the re-illumination technology to obtain the processed target image. The information extraction model is obtained based on the initial model, and the initial model is used to extract the attribute information and illumination information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and the target loss value of the synthetic image compared with the training image is determined. If the training stop condition is not met, the initial model is updated using the target loss value, and the updated initial model is used for the next training. In this way, when training the information extraction model, the attribute information and illumination information extracted from the original image by the initial model are used to synthesize an image, and the loss value between the synthesized image and the original image is calculated, and the loss value is applied to the update of the initial model to obtain the final information extraction model, so that the target attribute information extracted by the information extraction model is more accurate and can better reflect the depth, normal, color, and material attributes of the first image. In addition, the target lighting information of the specified position is extracted from the second image, and the first image is processed by re-lighting technology in combination with the target lighting information and the target attribute information. The lighting changes in the obtained target image can better fit the lighting changes in the second image, and the image effect is better.
[0021] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:
[0023] Figure 1 is a flowchart of an image processing method provided according to an embodiment of the present disclosure;
[0024] Figure 2 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;
[0025] Figure 3 is a block diagram of an image processing device provided according to an embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0027] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0028] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0029] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0030] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0031] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0032] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0033] Figure 1 FIG. 1 is a flowchart of an image processing method provided according to an embodiment of the present disclosure. Figure 1 Said method may include the following steps.
[0034] In step 11, a first image and a second image are acquired.
[0035] In the scenario provided by the present disclosure, it is necessary to add the image content of the first image to a specified position in the second image, and make the obtained new image conform to the original light and shadow changes of the second image.
[0036] In a possible implementation, a certain image needs to be added to another image, and the first image and the second image are both independent images. In this implementation, the user specifies the first image and the second image, and thus, the first image and the second image can be obtained according to the user's specified content.
[0037] In another possible implementation, an image needs to be added to a video, and the video contains multiple video frames. In this implementation, the user specifies the first image and the video, so that at least one video frame in the video can be used as the second image, and subsequent related steps are performed to add the first image to the video frame. After that, after the processing of the video frame is completed, another video frame can be used as the second image, and related steps are performed again. In this implementation, obtaining the first image and the second image is actually obtaining the first image and the currently processed video frame.
[0038] In step 12, target attribute information of the first image is determined through an information extraction model.
[0039] In the solution provided by the present disclosure, the attribute information may include at least one of depth information, normal information, color information and material information.
[0040] The information extraction model is used to extract the attribute information of the image. It is a pre-trained model. The type or types of attribute information to be extracted is also set during the training process. For example, the information extraction model can be used to extract four types of attribute information: depth information, normal information, color information, and material information. Correspondingly, the target attribute information can include depth information, normal information, color information, and material information. In this way, the types of attribute information extracted by the information extraction model are rich enough, which is conducive to improving the accuracy of subsequent data processing.
[0041] Among them, the information extraction model is obtained based on the initial model, and the initial model is used to extract the attribute information and lighting information of the image. In addition, in each process of training the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and the target loss value of the synthetic image compared with the training image is determined. If the training stopping condition is not met, the target loss value is used to update the initial model, and the updated initial model is used for the next training.
[0042] Among them, the initial model is a model that is trained in a conventional manner and can extract attribute information and lighting information. The accuracy of the attribute information extracted by the initial model cannot be guaranteed. Therefore, further training can be performed based on the initial model to obtain an information extraction model with more accurate attribute extraction.
[0043] The idea of obtaining the information extraction model is that the attribute information and lighting information of the image can be extracted through the initial model. By using the extracted information and using the re-lighting technology to render the image, an image can be obtained. If the extraction of the attribute information is accurate enough, the obtained image should be the same as the original image. Based on this idea, iterative training can be performed based on the initial model. In addition, in each training process, the training image is first input into the initial model. The initial model will output certain output content (including attribute information and lighting information) for the training image. After that, based on this output content, the image is rendered using the re-lighting technology to obtain a synthetic image, and the target loss value of the synthetic image compared to the training image is determined, and the target loss value is used to update the internal parameters of the model. Therefore, after several iterative trainings, the updated model will have a sufficiently good attribute information extraction capability, which is the information extraction model required in the end.
[0044] It should be noted that the method of rendering images using the re-lighting technology is common knowledge in the art, so the more detailed processing methods in this solution are not given here.
[0045] In each training process of the information extraction model, after determining the target loss value, it can be determined whether the stop training condition is met. The stop training condition can be flexibly set according to actual needs, for example, the number of training times reaches a preset number of times, the target loss value is less than a preset threshold, the training time reaches a preset time, etc. When the stop training condition is not met, the initial model is updated using the target loss value, and the updated initial model is used for the next training. When the stop training condition is met, the initial model used in this training is used as the information extraction model.
[0046] After the information extraction model is trained, it can be applied to extract attribute information of the first image. By inputting the first image into the information extraction model, the attribute information output by the information extraction model for the first image, that is, the target attribute information, can be obtained. For example, the output result of the information extraction model can be reflected as an image corresponding to different types of attributes, and the value corresponding to each pixel in the image is the attribute value corresponding to the pixel.
[0047] In step 13, target illumination information at a specified position in the second image is obtained.
[0048] The designated position may be the entire or a part of the second image. Also, the technology of extracting the illumination information of a certain position belongs to common knowledge, so a more detailed processing method is not given.
[0049] In step 14, the first image is rendered using a re-illumination technique according to the target attribute information and the target illumination information to obtain a processed target image.
[0050] According to the target attribute information extracted from the first image and the target illumination information extracted from the second image, the first image can be rendered using the existing re-illumination technology to obtain a processed target image. In addition, in the target image, the illumination change is consistent with the illumination change at the specified position in the second image.
[0051] Through the above technical solution, after obtaining the first image and the second image, the target attribute information of the first image is determined through the information extraction model, and the target illumination information at the specified position in the second image is obtained. After that, according to the target attribute information and the target illumination information, the first image is rendered using the re-illumination technology to obtain the processed target image. The information extraction model is obtained based on the initial model, and the initial model is used to extract the attribute information and illumination information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and the target loss value of the synthetic image compared with the training image is determined. If the training stop condition is not met, the initial model is updated using the target loss value, and the updated initial model is used for the next training. In this way, when training the information extraction model, the attribute information and illumination information extracted from the original image by the initial model are used to synthesize an image, and the loss value between the synthesized image and the original image is calculated, and the loss value is applied to the update of the initial model to obtain the final information extraction model, so that the target attribute information extracted by the information extraction model is more accurate and can better reflect the depth, normal, color, and material attributes of the first image. In addition, the target lighting information of the specified position is extracted from the second image, and the first image is processed by re-lighting technology in combination with the target lighting information and the target attribute information. The lighting changes in the obtained target image can better fit the lighting changes in the second image, and the image effect is better.
[0052] In order to enable those skilled in the art to better understand the technical solution provided by the embodiment of the present invention, the following 25 describes in detail the corresponding steps and related concepts in the above text.
[0053] First, the training method of the initial model is described in detail. As mentioned above, the function of the initial model is to extract the attribute information and illumination information of the image.
[0054] In a possible implementation, the initial model may include multiple cascaded sub-models, each of which is used to extract one of the illumination information or the attribute information. For example, if the initial model is used to extract the depth information, normal information, and illumination information of the image, the initial model may include three cascaded sub-models, which are used to extract the depth information, normal information, and illumination information of the image, respectively.
[0055] In this embodiment, the initial model can be obtained as follows:
[0056] Each sub-model is trained in turn from the input layer of the initial model to the output layer of the initial model until the sub-model closest to the output layer of the initial model is trained, so as to obtain a trained initial model.
[0057] That is to say, if the initial model contains N (N is a positive integer) sub-models, from the input layer of the initial model to the output layer of the initial model, they are the first sub-model, the second sub-model, and so on until the Nth sub-model. Then, when training the initial model, you can first train the first sub-model. After the first sub-model is trained, fix the parameters of the first sub-model and continue to train the second sub-model. After the second sub-model is trained, fix the parameters of the first two sub-models and continue to train the third sub-model. And so on, until the Nth sub-model is trained, and the obtained model is used as the initial model.
[0058] That is, the training of each sub-model is performed independently, and the training method of each sub-model is similar. Therefore, the training of the target sub-model for extracting the specified information is taken as an example to explain the training method of the target sub-model. The specified information is one of the illumination information or the attribute information.
[0059] For example, the target submodel can be obtained as follows:
[0060] Obtain the training data required for the target sub-model;
[0061] According to the training data, the neural network model is trained to obtain the target sub-model;
[0062] The training data required by the target sub-model may include the third image and the first information that the third image corresponds to the specified information. For example, if the target sub-model is used to extract depth information, its training data includes the third image and the depth information of the third image.
[0063] In each training process, the third image is used as the input of the neural network model, and the first information is used as the target output of the neural network model. The model loss value is calculated according to the actual output of the neural network model for the third image and the target output. When the training stop condition is not met, the neural network model is updated with the model loss value until the training stop condition is met, and the obtained neural network model is used as the target sub-model.
[0064] In addition, if there are other sub-models between the target sub-model and the initial model input layer, the training data required for the target sub-model may also include second information. The second information may include the output content of any one or more of the other sub-models for the third image. For example, if the target sub-model is used to extract illumination information, and there is a first sub-model for extracting depth information and a second sub-model for extracting normal information between the target sub-model and the initial model input layer, then its training data includes not only the third image and the illumination information of the third image, but also the depth information output by the first sub-model for the third image and / or the normal information output by the second sub-model for the third image.
[0065] In each training process, the third image and the second information are used as inputs of the neural network model, and the first information is used as the target output of the neural network model. The model loss value is calculated based on the actual output of the neural network model for the third image and the target output, and when the stop training condition is not met, the neural network model is updated with the model loss value until the stop training condition is met, and the corresponding neural network model is used as the target sub-model. The present disclosure does not limit the way in which the third image and the second information are input into the neural network model. For example, they can be input into the neural network model as two types of information, or the third image and the second information can be superimposed, and the superposition result (e.g., a new image generated based on the third image and the second information) can be input into the neural network model.
[0066] Using the above method, if the target sub-model is in the middle position, when training the target sub-model, it can be further combined with the information extracted from other sub-models that have completed training (attribute information or lighting information), so that the data used to train the target sub-model is richer, thereby improving the accuracy of the target sub-model.
[0067] Optionally, when setting the structure of the sub-models within the initial model, the sub-models can be laid out in order from low to high attribute complexity, from the input layer of the initial model to the output layer of the initial model. In this way, the sub-models trained later can obtain more information, thereby ensuring the accuracy of the sub-models.
[0068] Generally, the complexity of depth, normal, color, lighting, and material increases from low to high. Therefore, for example, the initial model may include 5 cascaded sub-models, and, in the direction from the initial model input layer to the initial model output layer, they are, respectively, a sub-model for extracting depth information, a sub-model for extracting normal information, a sub-model for extracting color information, a sub-model for extracting lighting information, and a sub-model for extracting material information.
[0069] In addition, after the target image is obtained in step 14, the method provided by the present disclosure may further include the following steps: Figure 2 As shown:
[0070] In step 21 , a target image is added to a designated position in the second image.
[0071] By adding the target image to the specified position in the second image, a desired new image can be obtained in which the first image is added to the specified position in the second image and the lighting conditions are consistent with those of the second image. Through this new image, the effect formed by adding the content in the first image to the scene in the second image can be very intuitively and accurately displayed.
[0072] Figure 3 is a block diagram of an image processing device provided according to an embodiment of the present disclosure. Figure 3 As shown, the device 30 may include:
[0073] A first acquisition module 31, used to acquire a first image and a second image;
[0074] A determination module 32, configured to determine target attribute information of the first image through an information extraction model, wherein the attribute information includes at least one of depth information, normal information, color information and material information;
[0075] A second acquisition module 33, used to acquire target illumination information at a specified position in the second image;
[0076] A first processing module 34 is used to render the first image using a re-illumination technique according to the target attribute information and the target illumination information to obtain a processed target image;
[0077] The information extraction model is obtained based on the initial model, and the initial model is used to extract attribute information and lighting information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If the training stopping condition is not met, the target loss value is used to update the initial model, and the updated initial model is used for the next training.
[0078] Optionally, the device 30 is used to use the initial model used in each training as the information extraction model if a training stop condition is met during each training of the information extraction model.
[0079] Optionally, the initial model includes a plurality of cascaded sub-models, each sub-model being used to extract one of illumination information or attribute information;
[0080] And, the initial model is obtained by:
[0081] Each sub-model is trained in turn from the input layer of the initial model to the output layer of the initial model until the sub-model closest to the output layer of the initial model is trained, so as to obtain a trained initial model.
[0082] Optionally, the target sub-model for extracting the specified information is obtained by:
[0083] Acquire training data required by the target sub-model, the training data comprising a third image and first information that the third image corresponds to the specified information;
[0084] Training the neural network model according to the training data to obtain the target sub-model;
[0085] The specified information is one of illumination information and attribute information.
[0086] Optionally, if there are other sub-models between the target sub-model and the initial model input layer, the training data also includes second information, and the second information includes the output content of any one or more of the other sub-models for the third image.
[0087] Optionally, the initial model includes 5 cascaded sub-models, and, in the direction from the initial model input layer to the initial model output layer, they are, in sequence, a sub-model for extracting depth information, a sub-model for extracting normal information, a sub-model for extracting color information, a sub-model for extracting lighting information, and a sub-model for extracting material information.
[0088] Optionally, the device 30 further includes:
[0089] The second processing module is used to add the target image to the designated position in the second image.
[0090] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0091] Reference below Figure 4 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0092] like Figure 4 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0093] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0094] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0095] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0096] In some embodiments, any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) can be used for communication, and can be interconnected with any form or medium of digital data communication (e.g., communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), internets (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
[0097] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0098] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a first image and a second image; determines target attribute information of the first image through an information extraction model, the attribute information including at least one of depth information, normal information, color information and material information; obtains target illumination information at a specified position in the second image; and renders the first image using a re-illumination technique based on the target attribute information and the target illumination information to obtain a processed target image; wherein the information extraction model is obtained based on an initial model, the initial model is used to extract attribute information and illumination information of the image, and, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained based on the output content of the initial model for the training image, and a target loss value of the synthetic image compared to the training image is determined. If the training stop condition is not met, the initial model is updated using the target loss value, and the updated initial model is used for the next training.
[0099] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0100] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0101] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, the first acquisition module may also be described as a "module for acquiring a first image and a second image".
[0102] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0103] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0104] According to one or more embodiments of the present disclosure, there is provided an image processing method, the method comprising:
[0105] Acquire a first image and a second image;
[0106] Determining target attribute information of the first image through an information extraction model, where the attribute information includes at least one of depth information, normal information, color information, and material information;
[0107] Acquire target illumination information at a specified position in the second image;
[0108] According to the target attribute information and the target illumination information, rendering the first image by using a re-illumination technique to obtain a processed target image;
[0109] The information extraction model is obtained based on the initial model, and the initial model is used to extract attribute information and lighting information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If the training stopping condition is not met, the target loss value is used to update the initial model, and the updated initial model is used for the next training.
[0110] According to one or more embodiments of the present disclosure, an image processing method is provided. During each training of the information extraction model, if a training stop condition is met, the initial model used in this training is used as the information extraction model.
[0111] According to one or more embodiments of the present disclosure, there is provided an image processing method, wherein the initial model comprises a plurality of cascaded sub-models, each sub-model being used to extract one of illumination information or attribute information;
[0112] And, the initial model is obtained by:
[0113] Each sub-model is trained in turn from the input layer of the initial model to the output layer of the initial model until the sub-model closest to the output layer of the initial model is trained, so as to obtain a trained initial model.
[0114] According to one or more embodiments of the present disclosure, an image processing method is provided, wherein a target sub-model for extracting specified information is obtained by:
[0115] Acquire training data required by the target sub-model, the training data comprising a third image and first information that the third image corresponds to the specified information;
[0116] Training the neural network model according to the training data to obtain the target sub-model;
[0117] The specified information is one of illumination information and attribute information.
[0118] According to one or more embodiments of the present disclosure, an image processing method is provided. If there are other sub-models between the target sub-model and the initial model input layer, the training data also includes second information, and the second information includes the output content of any one or more of the other sub-models for the third image.
[0119] According to one or more embodiments of the present disclosure, an image processing method is provided, wherein the initial model includes 5 cascaded sub-models, and, in the direction from the initial model input layer to the initial model output layer, they are, in sequence, a sub-model for extracting depth information, a sub-model for extracting normal information, a sub-model for extracting color information, a sub-model for extracting lighting information, and a sub-model for extracting material information.
[0120] According to one or more embodiments of the present disclosure, there is provided an image processing method, the method further comprising:
[0121] The target image is added to the second image at the designated position.
[0122] According to one or more embodiments of the present disclosure, there is provided an image processing apparatus, the apparatus comprising:
[0123] A first acquisition module, used to acquire a first image and a second image;
[0124] A determination module, configured to determine target attribute information of the first image through an information extraction model, wherein the attribute information includes at least one of depth information, normal information, color information, and material information;
[0125] A second acquisition module, used to acquire target illumination information at a specified position in the second image;
[0126] A first processing module, configured to render the first image using a re-illumination technique according to the target attribute information and the target illumination information, to obtain a processed target image;
[0127] The information extraction model is obtained based on the initial model, and the initial model is used to extract attribute information and lighting information of the image. In addition, in each training process of the information extraction model, after the training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If the training stopping condition is not met, the target loss value is used to update the initial model, and the updated initial model is used for the next training.
[0128] According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processing device, the steps of the image processing method described in any embodiment of the present disclosure are performed.
[0129] According to one or more embodiments of the present disclosure, there is provided an electronic device, including:
[0130] a storage device having a computer program stored thereon;
[0131] A processing device is used to execute the computer program in the storage device to implement the steps of the image processing method described in any embodiment of the present disclosure.
[0132] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0133] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0134] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. An image processing method, It is characterized in that The method comprises: Acquire a first image and a second image; Determining target attribute information of the first image through an information extraction model, where the attribute information includes at least one of depth information, normal information, color information, and material information; Acquire target illumination information at a specified position in the second image; According to the target attribute information and the target illumination information, rendering the first image by using a re-illumination technique to obtain a processed target image; The information extraction model is obtained based on an initial model, and the initial model is used to extract attribute information and illumination information of an image. In addition, in each training process of the information extraction model, after a training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If a stop training condition is not met, the initial model is updated using the target loss value, and the updated initial model is used for the next training. The initial model is obtained in the following manner: each sub-model is trained in sequence from the initial model input layer to the initial model output layer until the sub-model closest to the initial model output layer is trained to obtain a trained initial model; wherein the initial model includes 5 cascaded sub-models, which are, in the direction from the initial model input layer to the initial model output layer, a sub-model for extracting depth information, a sub-model for extracting normal information, a sub-model for extracting color information, a sub-model for extracting illumination information, and a sub-model for extracting material information.
2. The method according to claim 1, It is characterized in that In each process of training the information extraction model, if the training stop condition is met, the initial model used in this training is used as the information extraction model.
3. The method according to claim 1, It is characterized in that The target submodel for extracting the specified information is obtained as follows: Acquire training data required by the target sub-model, the training data comprising a third image and first information that the third image corresponds to the specified information; Training the neural network model according to the training data to obtain the target sub-model; The specified information is one of illumination information and attribute information.
4. The method according to claim 3, It is characterized in that If there are other sub-models between the target sub-model and the initial model input layer, the training data also includes second information, and the second information includes the output content of any one or more of the other sub-models for the third image.
5. The method according to claim 1, It is characterized in that The method further comprises: The target image is added to the second image at the designated position.
6. An image processing device, It is characterized in that The device comprises: A first acquisition module, used to acquire a first image and a second image; A determination module, configured to determine target attribute information of the first image through an information extraction model, wherein the attribute information includes at least one of depth information, normal information, color information, and material information; A second acquisition module, used to acquire target illumination information at a specified position in the second image; A first processing module, configured to render the first image using a re-illumination technique according to the target attribute information and the target illumination information, to obtain a processed target image; The information extraction model is obtained based on an initial model, and the initial model is used to extract attribute information and illumination information of an image. In addition, in each training process of the information extraction model, after a training image is input into the initial model, a synthetic image is obtained according to the output content of the initial model for the training image, and a target loss value of the synthetic image compared with the training image is determined. If a stop training condition is not met, the initial model is updated using the target loss value, and the updated initial model is used for the next training. The initial model is obtained in the following manner: each sub-model is trained in sequence from the initial model input layer to the initial model output layer until the sub-model closest to the initial model output layer is trained to obtain a trained initial model; wherein the initial model includes 5 cascaded sub-models, which are, in the direction from the initial model input layer to the initial model output layer, a sub-model for extracting depth information, a sub-model for extracting normal information, a sub-model for extracting color information, a sub-model for extracting illumination information, and a sub-model for extracting material information.
7. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 5 are implemented.
8. An electronic device, It is characterized in that include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 5.
