Image processing method and related device thereof
By performing image block matching and fusion on multiple LDR images in the target model, and combining the self-attention mechanism and the interactive attention mechanism, the artifact problem in LDR image fusion is solved and high-quality HDR images are generated.
Patent Information
- Application Number
- PCT/CN2024/080717
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-15
- Filing Date
- 2024-03-08
- Publication Date
- 2024-09-19
AI Technical Summary
When acquiring high dynamic range (HDR) images, multiple low dynamic range (LDR) images have different contents due to the movement of the target object. Artifacts are prone to occur after direct fusion, and existing technologies may ignore them in the process of suppressing artifacts. Image details, resulting in low HDR image quality.
By performing image block matching on multiple LDR images in the target model, a one-to-one correspondence between image blocks is constructed, and this relationship is used for fusion, combining the self-attention mechanism and the interactive attention mechanism to achieve better fusion. Ensure the final HDR image is artifact-free and has good detail.
It achieves high-quality fusion of multiple LDR images, generates artifact-free and detailed HDR images, and improves the quality and accuracy of image processing.
Smart Images

Figure CN2024080717_19092024_PF_FP_ABST
Abstract
Description
Image processing method and related device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 15, 2023, with application number 202310277464.6 and invention name “An image processing method and related equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of artificial intelligence (AI) technology, and in particular to an image processing method and related equipment. Background Art
[0003] High dynamic range (HDR) imaging, a key issue in computer vision applications, has attracted increasing attention. With the rapid development of AI technology, more and more device manufacturers are integrating AI-based neural network models into their devices to achieve high-quality HDR images.
[0004] In related technologies, a target object in a scene is photographed at multiple exposure rates to capture multiple low dynamic range (LDR) images of the target object. These multiple LDR images are then fed into a neural network model to fuse them together, yielding an HDR image of the target object.
[0005] In the above process, when capturing multiple LDR images, the target object may move in the scene, resulting in differences between the contents presented by the multiple LDR images captured. Therefore, the HDR image directly obtained by fusing these multiple LDR images is prone to artifacts.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide an image processing method and related devices, which can achieve higher-quality fusion of multiple LDR images, so that the final HDR image is free of artifacts.
[0008] A first aspect of an embodiment of the present application provides an image processing method, which can be implemented by a target model. The method includes:
[0009] When it is necessary to obtain an HDR image of a target object, the target object can be photographed using different exposure rates, thereby acquiring a first LDR image of the target object and a second LDR image of the target object. It should be noted that the exposure rate used to capture the second LDR image can be greater than the exposure rate used to capture the first LDR image, and can also be less than the exposure rate used to capture the first LDR image.
[0010] After obtaining the first LDR image of the target object and the second LDR image of the target object, the first LDR image of the target object and the second LDR image of the target object can be input into the target model. After receiving the first LDR image of the target object and the second LDR image of the target object, the target model can perform image block matching on the plurality of first image blocks of the first LDR image of the target object and the plurality of second image blocks of the second LDR image of the target object, thereby establishing a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks.
[0011] After obtaining a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks, the target model can use the one-to-one correspondence between the multiple first image blocks and the multiple second image blocks to fuse the first LDR image and the second LDR image, thereby obtaining and outputting an HDR image of the target object.
[0012] As can be seen from the above method, when an HDR image of a target object is required, a first LDR image and a second LDR image of the target object can be first acquired and input into a target model. The target model can then perform image block matching on the first and second LDR images, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first and second LDR images, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image is equivalent to performing a one-to-one alignment of the content of the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image. Using this correspondence as a guide to fuse the first and second LDR images, a higher-quality fusion can be achieved, resulting in an artifact-free HDR image of the target object.
[0013] In one possible implementation, obtaining a correspondence between the plurality of first image blocks of the first LDR image and the plurality of second image blocks of the second LDR image based on the first LDR image and the second LDR image includes: obtaining similarities between the plurality of first image blocks of the first LDR image and the plurality of second image blocks of the second LDR image based on the first LDR image and the second LDR image; and obtaining a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks based on the similarities. In the aforementioned implementation, after receiving the first LDR image and the second LDR image of the target object, the target model may perform a series of processing on the first LDR image and the second LDR image to obtain similarities between the plurality of first image blocks of the first LDR image and the plurality of second image blocks of the second LDR image. After obtaining the similarities between the plurality of first image blocks and the plurality of second image blocks, the target model may use the similarities between the plurality of first image blocks and the plurality of second image blocks to accurately construct a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks.
[0014] In one possible implementation, based on a first LDR image and a second LDR image, obtaining similarities between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image includes: performing feature extraction on the first LDR image and the second LDR image to obtain first features of the plurality of first image blocks of the first LDR image and second features of the plurality of second image blocks of the second LDR image; and calculating the first features of the plurality of first image blocks and the second features of the plurality of second image blocks to obtain similarities between the plurality of first image blocks and the plurality of second image blocks. In the aforementioned implementation, after receiving the first LDR image and the second LDR image of the target object, the target model performs feature extraction on the first LDR image and the second LDR image, respectively, to obtain first features of the plurality of first image blocks of the first LDR image and second features of the plurality of second image blocks of the second LDR image. After obtaining the first features of the plurality of first image blocks and the second features of the plurality of second image blocks, the target model may further calculate the first features of the plurality of first image blocks and the second features of the plurality of second image blocks to accurately obtain similarities between the plurality of first image blocks and the plurality of second image blocks.
[0015] In one possible implementation, the plurality of first image blocks includes a third image block, and based on similarity, obtaining a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks includes: determining, based on the similarity between the third image block and the plurality of second image blocks, the second image block with the greatest similarity among the plurality of second image blocks as the fourth image block; and establishing a correspondence between the third image block and the fourth image block. In the aforementioned implementation, for any first image block among the plurality of first image blocks (i.e., the aforementioned third image block), the target model may, based on the similarity between the first image block and the plurality of second image blocks, select the second image block with the greatest similarity among the plurality of second image blocks as the second image block most similar to the first image block (i.e., the aforementioned fourth image block). The target model may then establish a correspondence between the first image block and the second image block most similar to the first image block. In addition, the target model may also perform the same operation as performed on the first image block on the remaining first image blocks among the plurality of first image blocks, excluding the first image block, thereby ultimately obtaining a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks.
[0016] In one possible implementation, fusing the first LDR image and the second LDR image based on the correspondence relationship to obtain a high dynamic range (HDR) image of the target object includes: extracting features from the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjusting the order of the fourth features of the multiple second image blocks based on the correspondence relationship to obtain fourth features of the adjusted and ordered multiple second image blocks; and processing the third features of the multiple first image blocks and the fourth features of the adjusted and ordered multiple second image blocks to obtain the HDR image of the target object. In the aforementioned implementation, after receiving the first LDR image and the second LDR image, the target model may further extract features from the first LDR image and the second LDR image to obtain third features of the multiple first image blocks of the first LDR image and fourth features of the multiple second image blocks of the second LDR image. After obtaining the fourth features of the multiple second image blocks and the one-to-one correspondence between the multiple first image blocks and the multiple second image blocks, since the correspondence indicates a new ordering of the fourth features of the multiple second image blocks, the target model can adjust the ordering of the fourth features of the multiple second image blocks based on the correspondence, thereby obtaining the fourth features of the multiple second image blocks after the adjusted ordering. Then, after obtaining the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the adjusted ordering, the target model can perform a series of processing on the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the adjusted ordering, thereby ultimately obtaining and outputting an HDR image of the target object.
[0017] In one possible implementation, processing the third features of the plurality of first image blocks and the fourth features of the plurality of second image blocks after adjustment and sorting to obtain an HDR image of the target object includes: processing the third features of the plurality of first image blocks, the fourth features of the plurality of second image blocks, and the fourth features of the plurality of second image blocks after adjustment and sorting to obtain an HDR image of the target object. In the aforementioned implementation, after obtaining the third features of the plurality of first image blocks, the fourth features of the plurality of second image blocks, and the fourth features of the plurality of second image blocks after adjustment and sorting, the target model may perform a series of processing on the third features of the plurality of first image blocks, the fourth features of the plurality of second image blocks, and the fourth features of the plurality of second image blocks after adjustment and sorting, thereby ultimately obtaining and externally outputting an HDR image of the target object.
[0018] In one possible implementation, the aforementioned processing includes at least one of the following: processing based on a self-attention mechanism, processing based on an interactive attention mechanism, splicing processing, convolution processing, processing based on a transformer network, addition processing, and activation processing. In the aforementioned implementation, the target model can be based on the self-attention mechanism and the interactive attention mechanism to achieve fusion of the first LDR image and the second LDR image. In this fusion process, the detailed information of the first LDR image and the second LDR image itself can be effectively taken into account, so that the final HDR image maintains good details and is free of artifacts.
[0019] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0020] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0021] A second aspect of an embodiment of the present application provides a model training method, characterized in that the method includes: obtaining a first LDR image and a second LDR image of a target object, the first LDR image and the second LDR image being images obtained by photographing the target object based on different exposures; processing the first LDR image and the second LDR image by a to-be-trained model to obtain a high dynamic range (HDR) image of the target object, wherein the to-be-trained model is used to: obtain, based on the first LDR image and the second LDR image, a one-to-one correspondence between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; based on the correspondence, fuse the first LDR image and the second LDR image to obtain an HDR image of the target object; and train the to-be-trained model based on the HDR image to obtain a target model.
[0022] The target model trained by the above method has image processing functions (for example, the function of fusing multiple LDR images into an HDR image, etc.). Specifically, when it is necessary to obtain an HDR image of the target object, a first LDR image of the target object and a second LDR image of the target object can be first collected, and the first LDR image and the second LDR image can be input into the target model. Then, the target model can perform image block matching on the first LDR image and the second LDR image, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first LDR image and the second LDR image, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, in the process of obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image, it is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image in terms of content. Then, by using this correspondence as a guide to realize the fusion between the first LDR image and the second LDR image, a better fusion can be achieved, so that the HDR image of the target object finally obtained does not have artifacts.
[0023] In one possible implementation, the model to be trained is used to: obtain, based on the first LDR image and the second LDR image, a similarity between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and obtain, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0024] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain first features of multiple first image blocks of the first LDR image and second features of multiple second image blocks of the second LDR image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0025] In one possible implementation, multiple first image blocks include a third image block, and the model to be trained is used to: based on the similarity between the third image block and multiple second image blocks, determine the second image block with the greatest similarity among the multiple second image blocks as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0026] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjust the order of the fourth features of the multiple second image blocks based on the correspondence to obtain fourth features of the multiple second image blocks after the order is adjusted; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the order is adjusted to obtain an HDR image of the target object.
[0027] In one possible implementation, the model to be trained is used to process the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the fourth features of the multiple second image blocks after adjustment and sorting to obtain an HDR image of the target object.
[0028] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0029] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0030] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0031] A third aspect of an embodiment of the present application provides an image processing method, the method comprising: obtaining a first noisy image and a second noisy image of a target object, the first noisy image and the second noisy image being images obtained by photographing the target object based on different exposures; based on the first noisy image and the second noisy image, obtaining a one-to-one correspondence between multiple first image blocks of the first noisy image and multiple second image blocks of the second noisy image; and based on the correspondence, fusing the first noisy image and the second noisy image to obtain a denoised image of the target object.
[0032] In one possible implementation, obtaining, based on the first noisy image and the second noisy image, a correspondence between multiple first image blocks of the first noisy image and multiple second image blocks of the second noisy image includes: obtaining, based on the first noisy image and the second noisy image, a similarity between the multiple first image blocks of the first noisy image and the multiple second image blocks of the second noisy image; and obtaining, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0033] In one possible implementation, based on the first noisy image and the second noisy image, obtaining the similarity between multiple first image blocks of the first noisy image and multiple second image blocks of the second noisy image includes: performing feature extraction on the first noisy image and the second noisy image to obtain first features of the multiple first image blocks of the first noisy image and second features of the multiple second image blocks of the second noisy image; and calculating the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain the similarity between the multiple first image blocks and the multiple second image blocks.
[0034] In one possible implementation, the multiple first image blocks include a third image block, and based on the similarity, obtaining a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks includes: based on the similarity between the third image block and the multiple second image blocks, determining the second image block with the greatest similarity among the multiple second image blocks as the fourth image block; and establishing a correspondence between the third image block and the fourth image block.
[0035] In one possible implementation, based on the correspondence, the first noisy image and the second noisy image are fused to obtain a high dynamic range denoised image of the target object, including: extracting features from the first noisy image and the second noisy image to obtain third features of multiple first image blocks of the first noisy image and fourth features of multiple second image blocks of the second noisy image; based on the correspondence, adjusting the order of the fourth features of the multiple second image blocks to obtain fourth features of the adjusted and sorted multiple second image blocks; and processing the third features of the multiple first image blocks and the fourth features of the adjusted and sorted multiple second image blocks to obtain a denoised image of the target object.
[0036] In one possible implementation, processing the third features of the plurality of first image blocks and the fourth features of the plurality of second image blocks after adjustment and sorting to obtain a denoised image of the target object includes: processing the third features of the plurality of first image blocks, the fourth features of the plurality of second image blocks, and the fourth features of the plurality of second image blocks after adjustment and sorting to obtain a denoised image of the target object.
[0037] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0038] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0039] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0040] A fourth aspect of an embodiment of the present application provides an image processing method, the method comprising: acquiring a first low-resolution image and a second low-resolution image of a target object, the first low-resolution image and the second low-resolution image being images obtained by photographing the target object at different exposure levels; based on the first low-resolution image and the second low-resolution image, acquiring a one-to-one correspondence between multiple first image blocks of the first low-resolution image and multiple second image blocks of the second low-resolution image; and based on the correspondence, fusing the first low-resolution image and the second low-resolution image to obtain a high-resolution image of the target object.
[0041] In one possible implementation, based on the first low-resolution image and the second low-resolution image, obtaining the correspondence between multiple first image blocks of the first low-resolution image and multiple second image blocks of the second low-resolution image includes: based on the first low-resolution image and the second low-resolution image, obtaining the similarity between the multiple first image blocks of the first low-resolution image and the multiple second image blocks of the second low-resolution image; and based on the similarity, obtaining a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0042] In one possible implementation, based on a first low-resolution image and a second low-resolution image, obtaining the similarity between multiple first image blocks of the first low-resolution image and multiple second image blocks of the second low-resolution image includes: performing feature extraction on the first low-resolution image and the second low-resolution image to obtain first features of the multiple first image blocks of the first low-resolution image and second features of the multiple second image blocks of the second low-resolution image; and calculating the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain the similarity between the multiple first image blocks and the multiple second image blocks.
[0043] In one possible implementation, the multiple first image blocks include a third image block, and based on the similarity, obtaining a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks includes: based on the similarity between the third image block and the multiple second image blocks, determining the second image block with the greatest similarity among the multiple second image blocks as the fourth image block; and establishing a correspondence between the third image block and the fourth image block.
[0044] In one possible implementation, based on the correspondence, the first low-resolution image and the second low-resolution image are fused to obtain a high-dynamic range high-resolution image of the target object, including: extracting features from the first low-resolution image and the second low-resolution image to obtain third features of multiple first image blocks of the first low-resolution image and fourth features of multiple second image blocks of the second low-resolution image; based on the correspondence, adjusting the order of the fourth features of the multiple second image blocks to obtain fourth features of the adjusted and ordered multiple second image blocks; and processing the third features of the multiple first image blocks and the fourth features of the adjusted and ordered multiple second image blocks to obtain a high-resolution image of the target object.
[0045] In one possible implementation, processing the third feature of the plurality of first image blocks and the fourth feature of the plurality of second image blocks after adjustment and sorting to obtain a high-resolution image of the target object includes: processing the third feature of the plurality of first image blocks, the fourth feature of the plurality of second image blocks, and the fourth feature of the plurality of second image blocks after adjustment and sorting to obtain a high-resolution image of the target object.
[0046] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0047] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0048] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0049] A fifth aspect of an embodiment of the present application provides an image processing device, which includes a target model and comprises: a first acquisition module, used to acquire a first LDR image of a target object and a second LDR image of the target object, the first LDR image and the second LDR image being images obtained by photographing the target object based on different exposures; a second acquisition module, used to acquire, based on the first LDR image and the second LDR image, a one-to-one correspondence between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and a fusion module, used to fuse the first LDR image and the second LDR image based on the correspondence to obtain an HDR image of the target object.
[0050] As can be seen from the above device, when an HDR image of a target object is to be acquired, a first LDR image and a second LDR image of the target object can be first acquired and input into a target model. The target model can then perform image block matching on the first and second LDR images, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first and second LDR images, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image in terms of content. Using this correspondence as a guide to fuse the first and second LDR images, a higher-quality fusion can be achieved, resulting in an artifact-free HDR image of the target object.
[0051] In one possible implementation, the second acquisition module is used to: acquire, based on the first LDR image and the second LDR image, a similarity between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and acquire, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0052] In one possible implementation, the second acquisition module is configured to: perform feature extraction on the first LDR image and the second LDR image to obtain first features of multiple first image blocks of the first LDR image and second features of multiple second image blocks of the second LDR image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0053] In one possible implementation, the multiple first image blocks include a third image block, and the second acquisition module is configured to: based on similarities between the third image block and the multiple second image blocks, determine, among the multiple second image blocks, a second image block with the greatest similarity as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0054] In one possible implementation, the fusion module is configured to perform feature extraction on the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjust the order of the fourth features of the multiple second image blocks based on the correspondence to obtain fourth features of the multiple second image blocks after the order is adjusted; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the order is adjusted to obtain an HDR image of the target object.
[0055] In one possible implementation, the fusion module is configured to process the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the adjusted and sorted fourth features of the multiple second image blocks to obtain an HDR image of the target object.
[0056] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0057] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0058] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0059] A sixth aspect of an embodiment of the present application provides a model training device, which includes: an acquisition module, used to acquire a first LDR image of a target object and a second LDR image of the target object, the first LDR image and the second LDR image being images obtained by photographing the target object based on different exposures; a processing module, used to process the first LDR image and the second LDR image using a model to be trained to obtain a high dynamic range (HDR) image of the target object, wherein the model to be trained is used to: based on the first LDR image and the second LDR image, obtain a one-to-one correspondence between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; based on the correspondence, fuse the first LDR image and the second LDR image to obtain an HDR image of the target object; and a training module, used to train the model to be trained based on the HDR image to obtain a target model.
[0060] The target model obtained by training the above-mentioned device has image processing functions (for example, the function of fusing multiple LDR images into an HDR image, etc.). Specifically, when it is necessary to obtain an HDR image of the target object, a first LDR image of the target object and a second LDR image of the target object can be first collected, and the first LDR image and the second LDR image can be input into the target model. Then, the target model can perform image block matching on the first LDR image and the second LDR image, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first LDR image and the second LDR image, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, in the process of obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image, it is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image in terms of content. Then, by using this correspondence as a guide to realize the fusion between the first LDR image and the second LDR image, a better fusion can be achieved, so that the HDR image of the target object finally obtained does not have artifacts.
[0061] In one possible implementation, the model to be trained is used to: obtain, based on the first LDR image and the second LDR image, a similarity between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and obtain, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0062] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain first features of multiple first image blocks of the first LDR image and second features of multiple second image blocks of the second LDR image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0063] In one possible implementation, multiple first image blocks include a third image block, and the model to be trained is used to: based on the similarity between the third image block and multiple second image blocks, determine the second image block with the greatest similarity among the multiple second image blocks as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0064] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjust the order of the fourth features of the multiple second image blocks based on the correspondence to obtain fourth features of the multiple second image blocks after the order is adjusted; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the order is adjusted to obtain an HDR image of the target object.
[0065] In one possible implementation, the model to be trained is used to process the third features of multiple first image blocks, the fourth features of multiple second image blocks, and the fourth features of the multiple second image blocks after adjustment and sorting to obtain an HDR image of the target object.
[0066] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0067] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0068] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0069] A seventh aspect of an embodiment of the present application provides an image processing device, which includes a target model and comprises: a first acquisition module, used to acquire a first noisy image of a target object and a second noisy image of the target object, the first noisy image and the second noisy image being images obtained by photographing the target object based on different exposures; a second acquisition module, used to acquire, based on the first noisy image and the second noisy image, a one-to-one correspondence between multiple first image blocks of the first noisy image and multiple second image blocks of the second noisy image; and a fusion module, used to fuse the first noisy image and the second noisy image based on the correspondence to obtain a denoised image of the target object.
[0070] In one possible implementation, the second acquisition module is used to: obtain, based on the first noisy image and the second noisy image, the similarity between multiple first image blocks of the first noisy image and multiple second image blocks of the second noisy image; and based on the similarity, obtain a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0071] In one possible implementation, the second acquisition module is used to: perform feature extraction on the first noisy image and the second noisy image to obtain first features of multiple first image blocks of the first noisy image and second features of multiple second image blocks of the second noisy image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0072] In one possible implementation, the multiple first image blocks include a third image block, and the second acquisition module is configured to: based on similarities between the third image block and the multiple second image blocks, determine, among the multiple second image blocks, a second image block with the greatest similarity as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0073] In one possible implementation, a fusion module is used to extract features from a first noisy image and a second noisy image to obtain third features of multiple first image blocks of the first noisy image and fourth features of multiple second image blocks of the second noisy image; based on the correspondence, adjust the sorting of the fourth features of the multiple second image blocks to obtain the fourth features of the multiple second image blocks after the adjusted sorting; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the adjusted sorting to obtain a denoised image of the target object.
[0074] In one possible implementation, the fusion module is configured to process the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the adjusted and sorted fourth features of the multiple second image blocks to obtain a denoised image of the target object.
[0075] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0076] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0077] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0078] An eighth aspect of an embodiment of the present application provides an image processing device, which includes a target model and comprises: a first acquisition module, used to acquire a first low-resolution image of a target object and a second low-resolution image of the target object, the first low-resolution image and the second low-resolution image being images obtained by photographing the target object based on different exposures; a second acquisition module, used to acquire, based on the first low-resolution image and the second low-resolution image, a one-to-one correspondence between multiple first image blocks of the first low-resolution image and multiple second image blocks of the second low-resolution image; and a fusion module, used to fuse the first low-resolution image and the second low-resolution image based on the correspondence to obtain a high-resolution image of the target object.
[0079] In one possible implementation, the second acquisition module is used to: acquire, based on the first low-resolution image and the second low-resolution image, the similarity between multiple first image blocks of the first low-resolution image and multiple second image blocks of the second low-resolution image; and acquire, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0080] In one possible implementation, the second acquisition module is configured to: perform feature extraction on the first low-resolution image and the second low-resolution image to obtain first features of multiple first image blocks of the first low-resolution image and second features of multiple second image blocks of the second low-resolution image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0081] In one possible implementation, the multiple first image blocks include a third image block, and the second acquisition module is configured to: based on similarities between the third image block and the multiple second image blocks, determine, among the multiple second image blocks, a second image block with the greatest similarity as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0082] In one possible implementation, the fusion module is used to extract features from the first low-resolution image and the second low-resolution image to obtain third features of multiple first image blocks of the first low-resolution image and fourth features of multiple second image blocks of the second low-resolution image; based on the correspondence, adjust the sorting of the fourth features of the multiple second image blocks to obtain the fourth features of the multiple second image blocks after the adjusted sorting; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the adjusted sorting to obtain a high-resolution image of the target object.
[0083] In one possible implementation, the fusion module is configured to process the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the adjusted and sorted fourth features of the multiple second image blocks to obtain a high-resolution image of the target object.
[0084] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0085] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0086] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0087] A ninth aspect of an embodiment of the present application provides an image processing device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the image processing device executes the method described in the first aspect, any possible implementation of the first aspect, the third aspect, any possible implementation of the third aspect, the fourth aspect, or any possible implementation of the fourth aspect.
[0088] The tenth aspect of an embodiment of the present application provides a model training device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the model training device executes the method described in the second aspect or any possible implementation method of the second aspect.
[0089] The eleventh aspect of an embodiment of the present application provides a circuit system, which includes a processing circuit, and the processing circuit is configured to execute the method described in the first aspect, any possible implementation of the first aspect, the second aspect, any possible implementation of the second aspect, the third aspect, any possible implementation of the third aspect, the fourth aspect, or any possible implementation of the fourth aspect.
[0090] The twelfth aspect of an embodiment of the present application provides a chip system, which includes a processor for calling a computer program or computer instruction stored in a memory so that the processor executes a method as described in the first aspect, any possible implementation of the first aspect, the second aspect, any possible implementation of the second aspect, the third aspect, any possible implementation of the third aspect, the fourth aspect, or any possible implementation of the fourth aspect.
[0091] In a possible implementation, the processor is coupled to the memory through an interface.
[0092] In one possible implementation, the chip system further includes a memory, in which a computer program or computer instructions is stored.
[0093] A thirteenth aspect of an embodiment of the present application provides a computer storage medium storing a computer program, which, when executed by a computer, enables the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, any possible implementation of the second aspect, the third aspect, any possible implementation of the third aspect, the fourth aspect, or any possible implementation of the fourth aspect.
[0094] A fourteenth aspect of an embodiment of the present application provides a computer program product, which stores instructions that, when executed by a computer, enable the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, any possible implementation of the second aspect, the third aspect, any possible implementation of the third aspect, the fourth aspect, or any possible implementation of the fourth aspect.
[0095] In an embodiment of the present application, when an HDR image of a target object is required, a first LDR image and a second LDR image of the target object can be first acquired, and the first and second LDR images can be input into a target model. The target model can then perform image block matching on the first and second LDR images, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first and second LDR images, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image in terms of content. Using this correspondence as a guide to fuse the first and second LDR images can achieve higher-quality fusion, resulting in an artifact-free HDR image of the target object. BRIEF DESCRIPTION OF THE DRAWINGS
[0096] Figure 1 is a schematic diagram of the structure of the artificial intelligence main framework;
[0097] FIG2a is a schematic structural diagram of an image processing system provided in an embodiment of the present application;
[0098] FIG2 b is another schematic structural diagram of the image processing system provided in an embodiment of the present application;
[0099] FIG2c is a schematic diagram of an image processing device according to an embodiment of the present application;
[0100] FIG3 is a schematic diagram of the architecture of the system 100 provided in an embodiment of the present application;
[0101] FIG4 is a schematic diagram of a structure of a target model provided in an embodiment of the present application;
[0102] FIG5 is a flow chart of an image processing method provided in an embodiment of the present application;
[0103] FIG6 is a schematic diagram of a block search network according to an embodiment of the present application;
[0104] FIG7 is another schematic diagram of the structure of a block search network provided in an embodiment of the present application;
[0105] FIG8 is a schematic diagram of the structure of a fusion transformer network provided in an embodiment of the present application;
[0106] FIG9 is another schematic diagram of the structure of the fusion transformer network provided in an embodiment of the present application;
[0107] FIG10 is a schematic diagram of the structure of a local reconstruction transformer network provided in an embodiment of the present application;
[0108] FIG11 is a schematic diagram of the structure of a self-attention mechanism module or an interactive attention mechanism module provided in an embodiment of the present application;
[0109] FIG12 is a schematic diagram of the structure of a transformer module provided in an embodiment of the present application;
[0110] FIG13a is a schematic diagram of a comparison result provided by an embodiment of the present application;
[0111] FIG13b is another schematic diagram of the comparison results provided by an embodiment of the present application;
[0112] FIG14 is another schematic diagram of the comparison results provided by an embodiment of the present application;
[0113] FIG15 is another schematic diagram of the comparison results provided by an embodiment of the present application;
[0114] FIG16 is a flow chart of a model training method provided in an embodiment of the present application;
[0115] FIG17 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;
[0116] FIG18 is a schematic structural diagram of a model training device provided in an embodiment of the present application;
[0117] FIG19 is a schematic diagram of the structure of an execution device provided in an embodiment of the present application;
[0118] FIG20 is a schematic structural diagram of a training device provided in an embodiment of the present application;
[0119] FIG21 is a schematic structural diagram of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0120] The embodiments of the present application provide an image processing method and related devices, which can achieve higher-quality fusion of multiple LDR images, so that the final HDR image is free of artifacts.
[0121] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0122] HDR imaging, a key issue in computer vision applications, is gaining increasing attention. With the rapid development of AI technology, more and more device manufacturers are integrating AI-based neural network models into their devices to achieve high-quality HDR images.
[0123] In related technologies, a target object in a scene can be photographed at multiple exposure rates to capture multiple LDR images of the target object. These multiple LDR images can then be fed into a neural network model, which fuses them to produce an HDR image of the target object. For example, three LDR images of the same scene can be captured at three different exposure levels. After processing these images using a neural network model, an HDR image with optimized image metrics such as color, brightness, and contrast can be obtained.
[0124] In the above process, when shooting multiple LDR images, the target object may move in the scene, resulting in differences between the contents presented by the multiple LDR images. Therefore, the neural network model is directly based on the HDR image obtained by fusing these multiple LDR images, which is prone to artifacts.
[0125] Furthermore, in order to suppress the generation of artifacts, other related technologies usually allow the neural network model to ignore some information in the image during the fusion process of multiple LDR images. In this way, the fused HDR image will not have artifacts, but the details of the HDR image itself are often not good enough, that is, the quality of the HDR image is not high.
[0126] In order to solve the above problems, an embodiment of the present application provides an image processing method, which can be implemented in combination with artificial intelligence (AI) technology. AI technology is a technical discipline that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence. AI technology obtains the best results by perceiving the environment, acquiring knowledge and using knowledge. In other words, artificial intelligence technology is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Using artificial intelligence for data processing is a common application of artificial intelligence.
[0127] First, we will describe the overall workflow of an AI system. See Figure 1, which illustrates a schematic diagram of the AI framework. This framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.
[0128] (1) Infrastructure
[0129] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.
[0130] (2) Data
[0131] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.
[0132] (3) Data processing
[0133] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
[0134] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0135] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
[0136] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
[0137] (4) General ability
[0138] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0139] (5) Smart products and industry applications
[0140] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
[0141] Next, several application scenarios of this application are introduced.
[0142] Figure 2a is a schematic diagram of the structure of an image processing system provided in an embodiment of the present application. The image processing system includes a user device and a data processing device. The user device includes an intelligent terminal such as a mobile phone, a personal computer, or an information processing center. The user device is the initiator of image processing and is the initiator of image processing requests, typically initiated by a user through the user device.
[0143] The aforementioned data processing device can be a device or server with data processing capabilities, such as a cloud server, network server, application server, or management server. The data processing device receives image processing requests from smart terminals via an interactive interface and then performs image processing using methods such as machine learning, deep learning, search, reasoning, and decision-making through its memory and data processing processor. The memory in the data processing device is a general term that includes local storage and a database that stores historical data. The database can be located on the data processing device or on other network servers.
[0144] In the image processing system shown in FIG2a, a user device may receive a user instruction. For example, the user device may obtain multiple images input / selected by the user, and then initiate a request to a data processing device, causing the data processing device to execute an image fusion application on the multiple images obtained by the user device, thereby obtaining corresponding fusion results for the multiple images. For example, the user device may obtain multiple LDR images input by the user, and then initiate an image fusion request to the data processing device, causing the data processing device to perform a series of processing on the multiple LDR images based on the image fusion request, thereby obtaining a processing result of the multiple LDR images, that is, an HDR image obtained based on the fusion of the multiple LDR images.
[0145] In FIG. 2 a , the data processing device may execute the image processing method according to the embodiment of the present application.
[0146] Figure 2b is another structural schematic diagram of the image processing system provided in an embodiment of the present application. In Figure 2b, the user device directly serves as a data processing device. The user device can directly obtain input from the user and directly process it by the hardware of the user device itself. The specific process is similar to that of Figure 2a. Please refer to the above description and will not be repeated here.
[0147] In the image processing system shown in FIG2b , the user device may receive user instructions. For example, the user device may obtain multiple LDR images input by the user, and then perform a series of processing on the multiple LDR images to obtain processing results of the multiple LDR images, that is, an HDR image obtained based on the fusion of the multiple LDR images.
[0148] In FIG2 b , the user equipment itself can execute the image processing method of the embodiment of the present application.
[0149] FIG2c is a schematic diagram of an image processing related device provided in an embodiment of the present application.
[0150] The user device in the above Figures 2a and 2b can specifically be the local device 301 or the local device 302 in Figure 2c, and the data processing device in Figure 2a can specifically be the execution device 210 in Figure 2c, wherein the data storage system 250 can store the data to be processed of the execution device 210, and the data storage system 250 can be integrated on the execution device 210, or it can be set on the cloud or other network servers.
[0151] The processors in Figures 2a and 2b can perform data training / machine learning / deep learning through a neural network model or other models (for example, a model based on a support vector machine), and use the model finally trained or learned from the data to perform image processing applications on the image, thereby obtaining corresponding processing results.
[0152] Figure 3 is a schematic diagram of the system 100 architecture provided in an embodiment of the present application. In Figure 3, the execution device 110 is configured with an input / output (I / O) interface 112 for data interaction with an external device. The user can input data to the I / O interface 112 through the client device 140. The input data can include: various tasks to be scheduled, callable resources and other parameters in the embodiment of the present application.
[0153] When the execution device 110 preprocesses the input data, or when the computing module 111 of the execution device 110 performs calculations and other related processing (such as implementing the functions of the neural network in this application), the execution device 110 can call the data, code, etc. in the data storage system 150 for the corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 150.
[0154] Finally, the I / O interface 112 returns the processing result to the client device 140 so as to provide it to the user.
[0155] It is worth noting that the training device 120 can generate corresponding target models / rules based on different training data for different goals or tasks. The corresponding target models / rules can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results. The training data can be stored in the database 130 and come from training samples collected by the data collection device 160.
[0156] In the scenario shown in FIG3 , the user can manually input data, which can be performed through the interface provided by I / O interface 112. Alternatively, client device 140 can automatically send input data to I / O interface 112. If user authorization is required for client device 140 to automatically send input data, the user can set the corresponding permissions in client device 140. The user can view the output of execution device 110 on client device 140, which can be presented in a display, sound, action, or other specific form. Client device 140 can also serve as a data acquisition terminal, collecting input data and output results from I / O interface 112 as new sample data and storing them in database 130. Of course, collection can also be performed without client device 140, with I / O interface 112 directly storing the input data and output results from I / O interface 112 as new sample data in database 130.
[0157] It is worth noting that FIG3 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG3, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110. As shown in FIG3, a neural network can be trained according to the training device 120.
[0158] The present application also provides a chip including a neural network processor (NPU). The chip can be provided in the execution device 110 shown in FIG3 to complete the computational work of the computation module 111. The chip can also be provided in the training device 120 shown in FIG3 to complete the training work of the training device 120 and output the target model / rule.
[0159] The neural network processor (NPU) is a coprocessor mounted on the host central processing unit (CPU), which assigns tasks to it. The core of the NPU is the arithmetic circuit, which is controlled by a controller to extract data from memory (weight memory or input memory) and perform calculations.
[0160] In some implementations, the arithmetic circuit includes multiple processing engines (PEs). In some implementations, the arithmetic circuit is a two-dimensional systolic array. The arithmetic circuit can also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit is a general-purpose matrix processor.
[0161] For example, consider an input matrix A, a weight matrix B, and an output matrix C. The computational circuit retrieves the corresponding data for matrix B from the weight memory and caches it on each PE within the computational circuit. The computational circuit then performs a matrix operation on the matrix A data from the input memory and matrix B, storing the partial or final matrix results in the accumulator.
[0162] The vector computation unit can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector computation unit can be used for network calculations in non-convolutional / non-FC layers in neural networks, such as pooling, batch normalization, and local response normalization.
[0163] In some implementations, the vector computation unit can store the processed output vectors in a unified buffer. For example, the vector computation unit can apply a nonlinear function to the output of the computation circuit, such as a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit generates normalized values, merged values, or both. In some implementations, the processed output vectors can be used as activation inputs to the computation circuit, such as for use in subsequent layers in a neural network.
[0164] The unified memory is used to store input data and output data.
[0165] The weight data is directly transferred from the external memory to the input memory and / or unified memory through the direct memory access controller (DMAC), the weight data in the external memory is stored in the weight memory, and the data in the unified memory is stored in the external memory.
[0166] The bus interface unit (BIU) is used to implement interaction between the main CPU, DMAC and instruction fetch memory through the bus.
[0167] An instruction fetch buffer connected to the controller, used to store instructions used by the controller;
[0168] The controller is used to call the instructions cached in the memory to control the working process of the computing accelerator.
[0169] Generally, unified memory, input memory, weight memory and instruction fetch memory are all on-chip memories, and external memory is memory outside the NPU, which can be double data rate synchronous dynamic random access memory (DDR SDRAM), high bandwidth memory (HBM) or other readable and writable memory.
[0170] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0171] (1) Neural Network
[0172] A neural network can be composed of neural units. A neural unit can refer to an operation unit with xs and intercept 1 as input. The output of the operation unit can be:
[0173] Here, s = 1, 2, ..., n, where n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of this activation function can serve as the input of the next convolutional layer. The activation function can be a sigmoid function. A neural network is formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0174] The operation of each layer in a neural network can be described by the mathematical expression y = a(Wx + b). From a physical perspective, the operation of each layer in a neural network can be understood as transforming the input space (a set of input vectors) into the output space (i.e., from the row space to the column space of a matrix) through five operations. These operations include: 1. Dimensionality increase / decrease; 2. Scaling / reduction; 3. Rotation; 4. Translation; and 5. "Bending." Operations 1, 2, and 3 are performed by Wx, 4 by +b, and 5 by a(). The word "space" is used here because the objects being classified are not individual things, but rather a class of things, and space refers to the collection of all individuals within that class. W is the weight vector, each value in which represents the weight of a neuron in that layer of the neural network. This vector W determines the spatial transformation from input space to output space described above. That is, the weights W of each layer control how the space is transformed. The goal of training a neural network is to ultimately obtain the weight matrix for all layers of the trained neural network (a weight matrix formed by the vectors W of many layers). Therefore, the training process of a neural network is essentially about learning how to control spatial transformations, and more specifically, about learning the weight matrix.
[0175] Because we want the output of the neural network to be as close as possible to the value we really want to predict, we can compare the current network's predicted value with the desired target value, and then update the weight vector of each layer of the neural network based on the difference between the two (of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the neural network). For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value, and this adjustment is continued until the neural network can predict the desired target value. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value." This is the loss function or objective function, which is an important equation used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the neural network becomes a process of minimizing this loss as much as possible.
[0176] (2) Backpropagation algorithm
[0177] Neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during training, reducing the reconstruction error loss of the neural network model. Specifically, the forward propagation of the input signal to the output generates error loss. This error loss information is then backpropagated to update the parameters in the initial neural network model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
[0178] The method provided in this application is described below from the training side of the neural network and the application side of the neural network.
[0179] The model training method provided in the embodiment of the present application involves the processing of data sequences, and can be specifically applied to methods such as data training, machine learning, and deep learning. The training data (for example, the first LDR image of the target object and the second LDR image of the target object in the model training method provided in the embodiment of the present application) are subjected to symbolic and formalized intelligent information modeling, extraction, preprocessing, training, etc., and finally a trained neural network (for example, the target model in the model training method provided in the embodiment of the present application) is obtained; and the image processing method provided in the embodiment of the present application can use the above-mentioned trained neural network to input input data (for example, the first LDR image of the target object and the second LDR image of the target object in the image processing method provided in the embodiment of the present application) into the trained neural network to obtain output data (for example, the HDR image of the target object in the image processing method provided in the embodiment of the present application). It should be noted that the model training method and image processing method provided in the embodiment of the present application are inventions based on the same concept, and can also be understood as two parts in a system, or two stages of an overall process: such as the model training stage and the model application stage.
[0180] The image processing method provided by the embodiment of the present application can be implemented through a target model. The structure of the target model is briefly introduced below. Figure 4 is a structural diagram of the target model provided by the embodiment of the present application. As shown in Figure 4, the target model includes a block search network based on speech similarity, a fusion transformer network based on self-attention and interactive attention mechanisms, and a local reconstruction transformer network, wherein the input end of the block search network and the first input end of the fusion transformer network serve as the input end of the entire target model, the output end of the block search network is connected to the second input end of the fusion transformer network, the output end of the fusion transformer network is connected to the input end of the local reconstruction transformer network, and the output end of the local reconstruction transformer network serves as the output end of the entire target model. In order to understand the workflow of the target model shown in Figure 4, the workflow is introduced below in conjunction with Figure 5. Figure 5 is a flow chart of the image processing method provided by the embodiment of the present application. As shown in Figure 5, the method includes:
[0181] 501. Acquire a first LDR image and a second LDR image of a target object, where the first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels.
[0182] In this embodiment, when it is necessary to obtain an HDR image of a target object, the target object can be photographed using different exposure rates, thereby acquiring a first LDR image of the target object (also referred to as a reference image of the target object) and a second LDR image of the target object (also referred to as a supporting image of the target object). It should be noted that the target object can refer to an object in a scene, or an area in a scene containing an object, etc. For example, in a park scene, the target object can refer to a boy in the park, or the grass where the boy is in the park, etc.
[0183] It is worth noting that the number of second LDR images can be one or more. If multiple second LDR images are acquired, then these multiple second LDR images are captured using multiple exposure rates (the multiple exposure rates are different from each other). For any second LDR image among these multiple second LDR images, the exposure rate used to capture the second LDR image can be greater than the exposure rate used to capture the first LDR image, or it can be less than the exposure rate used to capture the first LDR image.
[0184] After obtaining the first LDR image of the target object and the second LDR image of the target object, the first LDR image of the target object and the second LDR image of the target object can be input into the target model, so that the target model performs a series of processing on the first LDR image of the target object and the second LDR image of the target object, thereby obtaining an HDR image of the target object.
[0185] 502. Based on the first LDR image and the second LDR image, obtain a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image.
[0186] After receiving the first LDR image of the target object and the second LDR image of the target object, the target model can perform block matching on multiple first image blocks of the first LDR image of the target object and multiple second image blocks of the second LDR image of the target object, thereby establishing a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image.
[0187] Specifically, the target model may obtain a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks in the following manner:
[0188] (1) After receiving a first LDR image of a target object and a second LDR image of the target object, a block search network of a target model may perform a series of processing on the first LDR image and the second LDR image, thereby obtaining similarities between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image.
[0189] (2) After obtaining the similarities between the multiple first image blocks and the multiple second image blocks, the block search network can use the similarities between the multiple first image blocks and the multiple second image blocks to construct a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0190] More specifically, as shown in FIG6 ( FIG6 is a schematic diagram of the structure of a block search network provided in an embodiment of the present application), the block search network includes a feature extraction module and a block search module. Then, the block search network can obtain the similarity between multiple first image blocks and multiple second image blocks in the following manner:
[0191] (1.1) After receiving the first LDR image and the second LDR image of the target object, the feature extraction module of the block search network (the module may include a classification backbone network, such as GhostNet, VGG network, etc.) may cooperate with the block search module to perform feature extraction on the first LDR image and the second LDR image, respectively, thereby obtaining first features of the plurality of first image blocks of the first LDR image (which may also be referred to as semantic features of the plurality of first image blocks, etc.), and second features of the plurality of second image blocks of the second LDR image (which may also be referred to as semantic features of the plurality of second image blocks, etc.).
[0192] For example, as shown in Figure 7 (Figure 7 is another structural diagram of the block search network provided in an embodiment of the present application), it is assumed that three LDR images are collected, namely support image 1, reference image and support image 2, and these three LDR images are taken using exposure rate 1, exposure rate 2 and exposure rate 3, respectively, wherein exposure rate 1>exposure rate 2>exposure rate 3. After the support image 1, the reference image and the support image 2 are input into the block search network, the feature extraction module can first extract the overall semantic features of the support image 1, the size of the overall semantic features of the support image 1 is c (channel) × H (height) × W (width), and send the overall semantic features of the support image 1 to the block search module. Similarly, the feature extraction module can also first extract the overall semantic features of the reference image, the size of the overall semantic features of the reference image is c×H×W, and send the overall semantic features of the reference image to the block search module. Similarly, the feature extraction module can also first extract the overall semantic features of the support image 2, the size of the overall semantic features of the support image 2 is c×H×W, and send the overall semantic features of the support image 2 to the block search module.
[0193] It can be understood that the supporting image 1 is composed of N2 supporting image blocks 1 (N can be 8 or 16, etc.), the reference image is composed of N2 reference image blocks, and the supporting image block 2 is composed of N2 supporting image blocks 2. Accordingly, the overall semantic features of the supporting image 1 are composed of the semantic features of the N2 supporting image blocks 1, the overall semantic features of the reference image are composed of the semantic features of the N2 reference image blocks, and the overall semantic features of the supporting image 2 are composed of the semantic features of the N2 supporting image blocks 2.
[0194] Then, the block search module can divide the overall semantic features of the support image 1 into N2 semantic features of the support image blocks 1, and the size of the semantic features of each support image block 1 is c×(H / N)×(W / N). Similarly, the block search module can also divide the overall semantic features of the reference image into N2 semantic features of the reference image blocks, and the size of the semantic features of each reference image block is c×(H / N)×(W / N). Similarly, the block search module can also divide the overall semantic features of the support image 2 into N2 semantic features of the support image blocks 2, and the size of the semantic features of each support image block 2 is c×(H / N)×(W / N).
[0195] (1.2) After obtaining the first features of the multiple first image blocks and the second features of the multiple second image blocks, the block search module can also calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks, thereby obtaining the similarity between the multiple first image blocks and the multiple second image blocks (which can also be called the cosine similarity between the multiple first image blocks and the multiple second image blocks, etc.).
[0196] Continuing with the above example, the block search module can also calculate cosine similarity for the semantic features of the N2 supporting image blocks 1 and the semantic features of the N2 reference image blocks, thereby obtaining a similarity matrix 1 having N2 rows and N2 columns. Similarity matrix 1 includes the similarities between the N2 supporting image blocks 1 and the N2 reference image blocks. Similarly, the block search module can also calculate cosine similarity for the semantic features of the N2 supporting image blocks 2 and the semantic features of the N2 reference image blocks, thereby obtaining a similarity matrix 2 having N2 rows and N2 columns. Similarity matrix 2 includes the similarities between the N2 supporting image blocks 2 and the N2 reference image blocks.
[0197] More specifically, the block search network can obtain a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks in the following manner:
[0198] (2.1) For ease of explanation, hereinafter, any one of the plurality of first image blocks (i.e., the aforementioned third image block) is referred to. The block search module may select, based on the similarities between the first image block and the plurality of second image blocks, a second image block having the greatest similarity among the plurality of second image blocks as the second image block most similar to the first image block (i.e., the aforementioned fourth image block).
[0199] (2.2) The block search module then constructs a correspondence between the first image block and the second image block that is most similar to the first image block. Furthermore, the block search module performs the same operation on the remaining first image blocks, excluding the first image block, as it did on the first image block. Ultimately, a one-to-one correspondence between the first image blocks and the second image blocks is obtained, and the correspondence is sent to the fusion transformer network.
[0200] As in the above example, in similarity matrix 1, row 1 represents the similarity between the first reference image block and N2 supporting images 1. The block search module can extract the maximum similarity in row 1 as the correspondence between the first reference image block and the supporting image 1 most similar to the first reference image block. Similarly, the block search module can also extract the correspondence between the second reference image block and the supporting image 1 most similar to the second reference image block in row 2, ..., until, in row N2, the correspondence between the N2-th reference image block and the supporting image 1 most similar to the N2-th reference image block is extracted.
[0201] Similarly, in the similarity matrix 2, the first row represents the similarity between the first reference image block and the N2 supporting images 2. The block search module can extract the maximum similarity in the first row as the correspondence between the first reference image block and the supporting image 2 most similar to the first reference image block. Similarly, the block search module can also extract the correspondence between the second reference image block and the supporting image 2 most similar to the second reference image block in the second row, ..., until the correspondence between the N2-th reference image block and the supporting image 2 most similar to the N2-th reference image block is extracted in the N2-th row.
[0202] In this way, the block search module can obtain a one-to-one correspondence between the N2 reference image blocks and the N2 support images 1, as well as a one-to-one correspondence between the N2 reference image blocks and the N2 support images 2. Furthermore, the block search module can also perform a reshaping operation to represent the one-to-one correspondence between the N2 reference image blocks and the N2 support images 1 as a similarity matrix 3 with N rows and N columns, and the one-to-one correspondence between the N2 reference image blocks and the N2 support images 2 as a similarity matrix 4 with N rows and N columns, and send these to the fusion transformer network.
[0203] 503. Based on the correspondence, fuse the first LDR image and the second LDR image to obtain an HDR image of the target object.
[0204] After obtaining a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks, the target model can use the one-to-one correspondence between the multiple first image blocks and the multiple second image blocks to fuse the first LDR image and the second LDR image, thereby obtaining and outputting an HDR image of the target object.
[0205] Specifically, as shown in Figure 8 (Figure 8 is a structural diagram of the fused transformer network provided in an embodiment of the present application), the fused transformer network of the target model includes a feature extraction module, a block alignment module, a self-attention mechanism module, an interactive attention mechanism module, and a splicing module. Then, the target model can obtain an HDR image of the target object in the following way:
[0206] (1) After receiving the first LDR image and the second LDR image, a feature extraction module (e.g., a convolutional network, etc.) fused with a transformer network may perform feature extraction on the first LDR image and the second LDR image, thereby obtaining third features of the plurality of first image blocks of the first LDR image (also referred to as depth features of the plurality of first image blocks, etc.), and fourth features of the plurality of second image blocks of the second LDR image (also referred to as depth features of the plurality of second image blocks, etc.).
[0207] Still as in the above example, as shown in Figure 9 (Figure 9 is another structural diagram of the fusion transformer network provided in an embodiment of the present application), after the support image 1, the reference image and the support image 2 are input into the fusion transformer network, the feature extraction module can first extract the overall depth features of the support image 1, the size of the overall depth features of the support image 1 is c×H×W, and the overall depth features of the support image 1 are sent to the block alignment module. Similarly, the feature extraction module can also first extract the overall depth features of the reference image, the size of the overall depth features of the reference image is c×H×W, and the overall depth features of the reference image are sent to the block alignment module. Similarly, the feature extraction module can also first extract the overall depth features of the support image 2, the size of the overall depth features of the support image 2 is c×H×W, and the overall depth features of the support image 2 are sent to the block alignment module.
[0208] It can be understood that the overall depth feature of the support image 1 is composed of the depth features of N2 support image blocks 1, the overall depth feature of the reference image is composed of the depth features of N2 reference image blocks, and the overall depth feature of the support image 2 is composed of the depth features of N2 support image blocks 2.
[0209] (2) After obtaining the fourth features of the plurality of second image blocks and the one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks, since the correspondence indicates a new ordering of the fourth features of the plurality of second image blocks, the block alignment module may adjust the ordering of the fourth features of the plurality of second image blocks based on the correspondence, thereby obtaining the fourth features of the plurality of second image blocks after the ordering is adjusted. Then, the block alignment module may send the third features of the plurality of first image blocks, the fourth features of the plurality of second image blocks, and the fourth features of the plurality of second image blocks after the ordering is adjusted to the self-attention mechanism module and the interactive attention mechanism module.
[0210] Still as in the above example, after the block alignment module obtains the overall depth features of the support image 1, the overall depth features of the support image 2, the similarity matrix 3, and the similarity matrix 4, since in the overall depth features of the support image 1, the depth features of the N2 support image blocks 1 are arranged according to the original order (that is, in the support image 1, the original order of the N2 support image blocks 1), and the similarity matrix 3 indicates the new order of the depth features of the N2 support image blocks 1, the block alignment module can adjust the order of the depth features of the N2 support image blocks 1 according to the indication of the similarity matrix 3, thereby obtaining the overall depth features of the adjusted order of the support image 1. Then, the block alignment module can divide the overall depth features of the adjusted order of the support image 1 into the semantic features of the N2 support image blocks 1 after the adjustment, and the size of each semantic feature of the adjusted order of the support image block 1 is c×(H / N)×(W / N).
[0211] Similarly, since the depth features of the N2 supporting image blocks 2 are arranged according to the original order in the overall depth features of the supporting image 2, and the similarity matrix 4 indicates the new order of the depth features of the N2 supporting image blocks 2, the block alignment module can adjust the order of the depth features of the N2 supporting image blocks 2 according to the indication of the similarity matrix 4, thereby obtaining the overall depth features of the supporting image 2 after the adjusted order. Then, the block alignment module can divide the overall depth features of the supporting image 2 after the adjusted order into the semantic features of the N2 supporting image blocks 2 after the adjusted order, and the size of each semantic feature of the supporting image block 2 after the adjusted order is c×(H / N)×(W / N).
[0212] In addition, the block alignment module can also divide the overall depth features of the support image 1 into N2 depth features of the support image blocks 1, and the size of the depth features of each support image block 1 is c×(H / N)×(W / N). Similarly, the block search module can also divide the overall depth features of the reference image into N2 depth features of the reference image blocks, and the size of the depth features of each reference image block is c×(H / N)×(W / N). Similarly, the block search module can also divide the overall depth features of the support image 2 into N2 depth features of the support image blocks 2, and the size of the depth features of each support image block 2 is c×(H / N)×(W / N).
[0213] Then, the block alignment module can send the depth features of the N2 supporting image blocks 1, the depth features of the N2 reference image blocks, the depth features of the N2 supporting image blocks 2, the adjusted and sorted semantic features of the N2 supporting image blocks 1, and the adjusted and sorted semantic features of the N2 supporting image blocks 2 to the self-attention mechanism module and the interactive attention mechanism module.
[0214] (3) After obtaining the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the fourth features of the multiple second image blocks after adjustment and sorting, the self-attention mechanism module and the interactive attention mechanism module can cooperate with the local reconstruction transformer network to perform a series of processing on the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the fourth features of the multiple second image blocks after adjustment and sorting, thereby obtaining and outputting an HDR image of the target object.
[0215] More specifically, as shown in Figure 10 (Figure 10 is a structural diagram of the local reconstruction transformer network provided in an embodiment of the present application), the local reconstruction transformer network of the target model includes a convolution module, a transformer module, an addition module, and an activation module. Then, the target model can obtain an HDR image of the target object in the following way:
[0216] (3.1) After obtaining the third features of multiple first image blocks, the fourth features of multiple second image blocks, and the fourth features of multiple second image blocks after adjustment and sorting, the self-attention mechanism module can perform a series of processing on the third features of multiple first image blocks and send the obtained processing results to the splicing module. The interactive attention mechanism module can perform a series of processing on the third features of multiple first image blocks and the fourth features of multiple second image blocks, and send the obtained processing results to the splicing module. At the same time, the interactive attention mechanism module can also perform a series of processing on the third features of multiple first image blocks and the fourth features of multiple second image blocks after adjustment and sorting, and send the obtained processing results to the splicing module. Then, the splicing module can splice all the received processing results and send the obtained splicing results to the local reconstruction transformer network.
[0217] Still as in the above example, the self-attention module can process the depth features of the N2 reference image blocks to obtain processing result 1. The interactive attention module 1 can process the depth features of the N2 reference image blocks and the depth features of the N2 supporting image blocks 1 to obtain processing result 2. The interactive attention module 1 can process the depth features of the N2 reference image blocks and the depth features of the N2 supporting image blocks 2 to obtain processing result 2. The interactive attention module 3 can process the depth features of the N2 reference image blocks and the depth features of the adjusted and sorted N2 supporting image blocks 1 to obtain processing result 4. The interactive attention module 4 can process the depth features of the N2 reference image blocks and the depth features of the adjusted and sorted N2 supporting image blocks 2 to obtain processing result 5. Then, the stitching module can stitch processing results 1 to 5 to obtain the corresponding stitching result.
[0218] (3.2) In the local reconstruction transformer network, the splicing result is processed by the convolution module, transformer module, addition module and activation module in the local reconstruction transformer network, and the HDR image of the target object can be finally obtained and output externally.
[0219] More specifically, as shown in Figure 11 (Figure 11 is a structural diagram of the self-attention mechanism module or the interactive attention mechanism module provided in an embodiment of the present application), in the fused transformer network, the structure of the self-attention mechanism module and the interactive attention module can be the same, and either module may include: a normalization unit, a multi-head attention mechanism unit, an addition unit, and a multi-layer perceptron unit, etc. As can be seen, both modules can implement normalization processing, processing based on the multi-head attention mechanism, addition processing, processing based on the multi-layer perceptron, etc.
[0220] More specifically, as shown in Figure 12 (Figure 12 is a schematic diagram of the structure of the transformer module provided in an embodiment of the present application), in the local reconstruction transformer network, the transformer module may include: a multi-head self-attention mechanism unit and a multi-layer perceptron unit. Thus, the transformer unit can implement processing based on the multi-head self-attention mechanism and processing based on the multi-layer perceptron, etc.
[0221] It should be understood that in this embodiment, only the example of the target model being able to fuse multiple LDR images into an HDR image is used for schematic introduction. In actual applications, the target model can also fuse multiple low-resolution images into a high-resolution image (for example, fusing the first low-resolution image and the second low-resolution image into a high-resolution image), or fuse multiple noisy images into a denoised image, etc. (for example, fusing the first noisy image and the second noisy image into a denoised image). These fusion processes can refer to steps 501 to 503. It is only necessary to replace the LDR image with a low-resolution image (for example, the first low-resolution image and the second low-resolution image) or a noisy image (for example, the first noisy image and the second noisy image), and replace the HDR image with a high-resolution image or a denoised image. No further details will be given here.
[0222] In addition, the target model provided in the embodiment of the present application (i.e., IFT in Table 1) can be compared with the models provided by the related art (i.e., the remaining models in Table 1 except IFT, such as Sen, Hu, etc.) on a certain data set. The comparison results are shown in Table 1:
[0223] Table 1
[0224] As shown in Table 1, when tested on this dataset, the embodiment of the present application has better PSNR-μ / PSNR-L / HDR-VDP-2 (the larger the better) than the related art. As shown in Figures 13a and 13b (Figure 13a is a schematic diagram of the comparison results provided by the embodiment of the present application, and Figure 13b is another schematic diagram of the comparison results provided by the embodiment of the present application), the embodiment of the present application can more accurately restore details and does not produce artifacts compared to the related art. In areas with relatively large foreground motion, other methods will produce certain artifacts and cannot restore color details well, while the embodiment of the present application is visually most similar to GT.
[0225] Furthermore, the target model provided in the embodiment of the present application (i.e., IFT in Table 1) can be compared with the models provided by the related art (i.e., the remaining models in Table 1 except IFT, such as Sen, Hu, etc.) on another data set. The comparison results are shown in Table 2:
[0226] Table 2
[0227] Based on Table 2, it can be seen that, in the test on this data set, the embodiment of the present application has better PSNR-μ / PSNR-L / HDR-VDP-2 (the larger the better) than the related art, and in terms of visual effects, as shown in Figures 14 and 15 (Figure 14 is another schematic diagram of the comparison results provided by the embodiment of the present application, and Figure 15 is another schematic diagram of the comparison results provided by the embodiment of the present application), the embodiment of the present application can restore details more accurately and without generating artifacts compared to the related art.
[0228] In an embodiment of the present application, when an HDR image of a target object is required, a first LDR image and a second LDR image of the target object can be first acquired, and the first and second LDR images can be input into a target model. The target model can then perform image block matching on the first and second LDR images, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first and second LDR images, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image in terms of content. Using this correspondence as a guide to fuse the first and second LDR images can achieve higher-quality fusion, resulting in an artifact-free HDR image of the target object.
[0229] Furthermore, in an embodiment of the present application, the target model includes a fusion transformer network based on a self-attention mechanism and an interactive attention mechanism. When fusing the first LDR image and the second LDR image, the network can effectively take into account the detail information of the first LDR image and the second LDR image itself, so that the final HDR image maintains good details and is free of artifacts.
[0230] The above is a detailed description of the image processing method provided by the embodiment of the present application. The following is an introduction to the model training method provided by the embodiment of the present application. Figure 16 is a flow chart of the model training method provided by the embodiment of the present application. As shown in Figure 16, the method includes:
[0231] 1601. Acquire a first LDR image and a second LDR image of a target object. The first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels.
[0232] In this embodiment, when it is necessary to train the to-be-trained model, a batch of training data may be first obtained. The batch of training data includes a first LDR image of a target object and a second LDR image of the target object. The first LDR image and the second LDR image are images obtained by photographing the target object at different exposures. It should be noted that, for the first LDR image and the second LDR image, a true HDR image of the target object is known.
[0233] 1602. Process the first LDR image and the second LDR image using the model to be trained to obtain a high dynamic range (HDR) image of the target object, wherein the model to be trained is used to: obtain, based on the first LDR image and the second LDR image, a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; and fuse the first LDR image and the second LDR image based on the correspondence to obtain the HDR image of the target object.
[0234] After obtaining the first LDR image and the second LDR image, the first LDR image and the second LDR image can be input into the to-be-trained model. The to-be-trained model can then perform a series of processing on the first LDR image and the second LDR image to obtain a one-to-one correspondence between the plurality of first image blocks of the first LDR image and the plurality of second image blocks of the second LDR image. The to-be-trained model can then fuse the first LDR image and the second LDR image using the one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks to obtain a (predicted) HDR image of the target object.
[0235] In one possible implementation, the model to be trained is used to: obtain, based on the first LDR image and the second LDR image, a similarity between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and obtain, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0236] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain first features of multiple first image blocks of the first LDR image and second features of multiple second image blocks of the second LDR image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0237] In one possible implementation, multiple first image blocks include a third image block, and the model to be trained is used to: based on the similarity between the third image block and multiple second image blocks, determine the second image block with the greatest similarity among the multiple second image blocks as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0238] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjust the sorting of the fourth features of the multiple second image blocks based on the correspondence to obtain fourth features of the multiple second image blocks after the sorting is adjusted; and process the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the fourth features of the multiple second image blocks after the sorting is adjusted to obtain an HDR image of the target object.
[0239] In one possible implementation, the aforementioned processing includes at least one of the following: processing based on a self-attention mechanism, processing based on an interactive attention mechanism, splicing processing, convolution processing, processing based on a transformer network, addition processing, and activation processing.
[0240] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0241] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0242] It should be noted that, for the introduction of step 1602, reference may be made to the relevant description of steps 502 to 503 in the embodiment shown in FIG5, which will not be repeated here.
[0243] 1603. Based on the HDR image, the to-be-trained model is trained to obtain a target model.
[0244] After obtaining the HDR image of the target object, since the true HDR image of the target object is known, the HDR image and the true HDR image can be calculated using a preset loss function to obtain a target loss, which is used to indicate the difference between the HDR image and the true HDR image. Next, the target loss can be used to update the parameters of the to-be-trained model, thereby obtaining a to-be-trained model with updated parameters. Then, the next batch of training data can be used to continue training the to-be-trained model with updated parameters until the model training conditions are met (for example, the target loss converges, etc.), thereby obtaining the target model in the embodiment shown in FIG5 .
[0245] It should be understood that in this embodiment, only the example of the model to be trained being able to fuse multiple LDR images into an HDR image is used for schematic introduction. In actual applications, the model to be trained can also fuse multiple low-resolution images into a high-resolution image (for example, fusing the first low-resolution image and the second low-resolution image into a high-resolution image), or fuse multiple noisy images into a denoised image, etc. (for example, fusing the first noisy image and the second noisy image into a denoised image). These fusion processes and corresponding model training processes can refer to steps 1601 to 1603. It is only necessary to replace the LDR image with a low-resolution image (for example, the first low-resolution image and the second low-resolution image) or a noisy image (for example, the first noisy image and the second noisy image), and replace the HDR image with a high-resolution image or a denoised image. No further details will be given here.
[0246] The target model obtained by training in the embodiment of the present application has an image processing function (for example, a function of fusing multiple LDR images into an HDR image, etc.). Specifically, when it is necessary to obtain an HDR image of the target object, a first LDR image of the target object and a second LDR image of the target object can be first collected, and the first LDR image and the second LDR image can be input into the target model. Then, the target model can perform image block matching on the first LDR image and the second LDR image, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. Then, the target model can use this correspondence to fuse the first LDR image and the second LDR image, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, in the process of obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image, it is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image one by one in terms of content. Then, by using this correspondence as a guide to realize the fusion between the first LDR image and the second LDR image, a better fusion can be achieved, so that the HDR image of the target object finally obtained does not have artifacts.
[0247] The above is a detailed description of the model training method provided in the embodiment of the present application. The following will introduce the image processing device and model training device provided in the embodiment of the present application. Figure 17 is a structural diagram of the image processing device provided in the embodiment of the present application. As shown in Figure 17, the device includes:
[0248] A first acquisition module 1701 is configured to acquire a first LDR image and a second LDR image of a target object, where the first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels;
[0249] A second acquisition module 1702 is configured to acquire, based on the first LDR image and the second LDR image, a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image;
[0250] The fusion module 1703 is configured to fuse the first LDR image and the second LDR image based on the correspondence relationship to obtain an HDR image of the target object.
[0251] In an embodiment of the present application, when an HDR image of a target object is required, a first LDR image and a second LDR image of the target object can be first acquired, and the first and second LDR images can be input into a target model. The target model can then perform image block matching on the first and second LDR images, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. The target model can then use this correspondence to fuse the first and second LDR images, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image in terms of content. Using this correspondence as a guide to fuse the first and second LDR images can achieve higher-quality fusion, resulting in an artifact-free HDR image of the target object.
[0252] In one possible implementation, the second acquisition module 1702 is configured to: acquire, based on the first LDR image and the second LDR image, a similarity between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and acquire, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0253] In one possible implementation, the second acquisition module 1702 is configured to: perform feature extraction on the first LDR image and the second LDR image to obtain first features of multiple first image blocks of the first LDR image and second features of multiple second image blocks of the second LDR image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0254] In one possible implementation, the multiple first image blocks include a third image block, and the second acquisition module 1702 is configured to: based on similarities between the third image block and the multiple second image blocks, determine, among the multiple second image blocks, a second image block with the greatest similarity as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0255] In one possible implementation, the fusion module 1703 is configured to perform feature extraction on the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjust the order of the fourth features of the multiple second image blocks based on the correspondence to obtain fourth features of the multiple second image blocks after the order is adjusted; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the order is adjusted to obtain an HDR image of the target object.
[0256] In one possible implementation, the fusion module 1703 is configured to process the third features of the multiple first image blocks, the fourth features of the multiple second image blocks, and the adjusted and sorted fourth features of the multiple second image blocks to obtain an HDR image of the target object.
[0257] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0258] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0259] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0260] It should be understood that in this embodiment, only the example of the target model being able to fuse multiple LDR images into an HDR image is used for schematic introduction. In actual applications, the target model can also fuse multiple low-resolution images into a high-resolution image (for example, fusing the first low-resolution image and the second low-resolution image into a high-resolution image), or fuse multiple noisy images into a denoised image, etc. (for example, fusing the first noisy image and the second noisy image into a denoised image). It is only necessary to replace the LDR image with a low-resolution image (for example, the first low-resolution image and the second low-resolution image) or a noisy image (for example, the first noisy image and the second noisy image), and replace the HDR image with a high-resolution image or a denoised image. No further details will be given here.
[0261] FIG18 is a schematic diagram of the structure of a model training device provided in an embodiment of the present application. As shown in FIG18 , the device includes:
[0262] An acquisition module 1801 is configured to acquire a first LDR image and a second LDR image of a target object, where the first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels.
[0263] The processing module 1802 is configured to process the first LDR image and the second LDR image using a to-be-trained model to obtain a high dynamic range (HDR) image of the target object, wherein the to-be-trained model is configured to: obtain, based on the first LDR image and the second LDR image, a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; and fuse the first LDR image and the second LDR image based on the correspondence to obtain an HDR image of the target object;
[0264] The training module 1803 is used to train the to-be-trained model based on the HDR image to obtain a target model.
[0265] The target model obtained by training in the embodiment of the present application has an image processing function (for example, a function of fusing multiple LDR images into an HDR image, etc.). Specifically, when it is necessary to obtain an HDR image of the target object, a first LDR image of the target object and a second LDR image of the target object can be first collected, and the first LDR image and the second LDR image can be input into the target model. Then, the target model can perform image block matching on the first LDR image and the second LDR image, thereby obtaining a one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image. Then, the target model can use this correspondence to fuse the first LDR image and the second LDR image, thereby obtaining and outputting an HDR image of the target object. In the aforementioned process, in the process of obtaining the one-to-one correspondence between the multiple first image blocks of the first LDR image and the multiple second image blocks of the second LDR image, it is equivalent to aligning the multiple first image blocks of the first LDR image with the multiple second image blocks of the second LDR image one by one in terms of content. Then, by using this correspondence as a guide to realize the fusion between the first LDR image and the second LDR image, a better fusion can be achieved, so that the HDR image of the target object finally obtained does not have artifacts.
[0266] In one possible implementation, the model to be trained is used to: obtain, based on the first LDR image and the second LDR image, a similarity between multiple first image blocks of the first LDR image and multiple second image blocks of the second LDR image; and obtain, based on the similarity, a one-to-one correspondence between the multiple first image blocks and the multiple second image blocks.
[0267] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain first features of multiple first image blocks of the first LDR image and second features of multiple second image blocks of the second LDR image; and calculate the first features of the multiple first image blocks and the second features of the multiple second image blocks to obtain similarities between the multiple first image blocks and the multiple second image blocks.
[0268] In one possible implementation, multiple first image blocks include a third image block, and the model to be trained is used to: based on the similarity between the third image block and multiple second image blocks, determine the second image block with the greatest similarity among the multiple second image blocks as the fourth image block; and establish a correspondence between the third image block and the fourth image block.
[0269] In one possible implementation, the model to be trained is used to: perform feature extraction on the first LDR image and the second LDR image to obtain third features of multiple first image blocks of the first LDR image and fourth features of multiple second image blocks of the second LDR image; adjust the order of the fourth features of the multiple second image blocks based on the correspondence to obtain fourth features of the multiple second image blocks after the order is adjusted; and process the third features of the multiple first image blocks and the fourth features of the multiple second image blocks after the order is adjusted to obtain an HDR image of the target object.
[0270] In one possible implementation, the model to be trained is used to process the third features of multiple first image blocks, the fourth features of multiple second image blocks, and the fourth features of the multiple second image blocks after adjustment and sorting to obtain an HDR image of the target object.
[0271] In one possible implementation, the processing includes at least one of the following: self-attention mechanism-based processing, interactive attention mechanism-based processing, splicing processing, convolution processing, transformer network-based processing, addition processing, and activation processing.
[0272] In one possible implementation, the processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on the multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
[0273] In one possible implementation, the transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
[0274] It should be understood that in this embodiment, only the example of the model to be trained being able to fuse multiple LDR images into an HDR image is used for schematic introduction. In actual applications, the model to be trained can also fuse multiple low-resolution images into a high-resolution image (for example, fusing the first low-resolution image and the second low-resolution image into a high-resolution image), or fuse multiple noisy images into a denoised image, etc. (for example, fusing the first noisy image and the second noisy image into a denoised image). It only requires replacing the LDR image with a low-resolution image (for example, the first low-resolution image and the second low-resolution image) or a noisy image (for example, the first noisy image and the second noisy image), and replacing the HDR image with a high-resolution image or a denoised image. No further details will be given here.
[0275] It should be noted that the information interaction, execution process, etc. between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the embodiment of the present application, and no further details will be given here.
[0276] The embodiment of the present application also relates to an execution device, and Figure 19 is a structural diagram of the execution device provided by the embodiment of the present application. As shown in Figure 19, the execution device 1900 can be specifically manifested as a mobile phone, a tablet, a laptop computer, an intelligent wearable device, a server, etc., which are not limited here. Among them, the image processing device described in the embodiment corresponding to Figure 17 can be deployed on the execution device 1900 to implement the image processing function in the embodiment corresponding to Figure 5. Specifically, the execution device 1900 includes: a receiver 1901, a transmitter 1902, a processor 1903 and a memory 1904 (wherein the number of processors 1903 in the execution device 1900 can be one or more, and Figure 19 takes one processor as an example), wherein the processor 1903 may include an application processor 19031 and a communication processor 19032. In some embodiments of the present application, the receiver 1901, the transmitter 1902, the processor 1903 and the memory 1904 may be connected via a bus or other means.
[0277] Memory 1904 may include read-only memory and random access memory, and provides instructions and data to processor 1903. A portion of memory 1904 may also include non-volatile random access memory (NVRAM). Memory 1904 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0278] Processor 1903 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.
[0279] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 1903. Processor 1903 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in processor 1903. The above processor 1903 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1903 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 1904, and processor 1903 reads information from memory 1904 and, in conjunction with its hardware, completes the steps of the above method.
[0280] Receiver 1901 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 1902 can be used to output digital or character information through the first interface. Transmitter 1902 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 1902 can also include a display device such as a display screen.
[0281] In an embodiment of the present application, in one case, the processor 1903 is configured to obtain an HDR image of the target object using the target model in the embodiment corresponding to FIG. 5 .
[0282] The present application also relates to a training device. FIG20 is a schematic diagram of the structure of the training device provided by the present application. As shown in FIG20 , the training device 2000 is implemented by one or more servers. The training device 2000 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 2020 (e.g., one or more processors) and memory 2032, and one or more storage media 2030 (e.g., one or more mass storage devices) storing application programs 2042 or data 2044. The memory 2032 and storage medium 2030 may be temporary storage or permanent storage. The program stored in the storage medium 2030 may include one or more modules (not shown), each of which may include a series of instruction operations in the training device. Furthermore, the CPU 2020 may be configured to communicate with the storage medium 2030 to execute the series of instruction operations in the storage medium 2030 on the training device 2000.
[0283] The training device 2000 may also include one or more power supplies 2026, one or more wired or wireless network interfaces 2050, one or more input and output interfaces 2058; or, one or more operating systems 2041, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0284] Specifically, the training device can execute the model training method in the embodiment corresponding to Figure 16.
[0285] An embodiment of the present application also relates to a computer storage medium, which stores a program for signal processing. When the computer storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0286] An embodiment of the present application also relates to a computer program product, which stores instructions that, when executed by a computer, enable the computer to execute the steps executed by the aforementioned execution device, or enable the computer to execute the steps executed by the aforementioned training device.
[0287] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0288] Specifically, see Figure 21, which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be represented as a neural network processor NPU 2100. NPU 2100 is mounted on the host CPU (host CPU) as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is the arithmetic circuit 2103, which is controlled by the controller 2104 to extract matrix data from the memory and perform multiplication operations.
[0289] In some implementations, the arithmetic circuit 2103 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 2103 is a two-dimensional systolic array. The arithmetic circuit 2103 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 2103 is a general-purpose matrix processor.
[0290] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 2102 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 2101 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 2108.
[0291] Unified memory 2106 is used to store input and output data. Weight data is directly transferred to weight memory 2102 through the Direct Memory Access Controller (DMAC) 2105. Input data is also transferred to unified memory 2106 through the DMAC.
[0292] BIU stands for Bus Interface Unit 2113 , which is used for interaction between the AXI bus, DMAC, and Instruction Fetch Buffer (IFB) 2109 .
[0293] The bus interface unit 2113 (BIU) is used for the instruction fetch memory 2109 to obtain instructions from the external memory, and is also used for the storage unit access controller 2105 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
[0294] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 2106 or to transfer weight data to the weight memory 2102 or to transfer input data to the input memory 2101.
[0295] The vector calculation unit 2107 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 2103, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of the predicted label plane.
[0296] In some implementations, the vector calculation unit 2107 can store the processed output vector to the unified memory 2106. For example, the vector calculation unit 2107 can apply a linear function or a nonlinear function to the output of the operation circuit 2103, such as linear interpolation of the predicted label plane extracted by the convolution layer, or another example of a vector of accumulated values to generate an activation value. In some implementations, the vector calculation unit 2107 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 2103, for example, for use in subsequent layers in a neural network.
[0297] An instruction fetch buffer 2109 connected to the controller 2104 is used to store instructions used by the controller 2104;
[0298] Unified memory 2106, input memory 2101, weight memory 2102, and instruction fetch memory 2109 are all on-chip memories. External memories are private to the NPU hardware architecture.
[0299] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0300] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0301] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits, or dedicated circuits. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0302] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0303] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
Claims
1. An image processing method, characterized in that: The method is implemented by a target model, and the method comprises: Acquire a first low dynamic range (LDR) image of a target object and a second LDR image of the target object, wherein the first LDR image and the second LDR image are images obtained by photographing the target object at different exposures; Based on the first LDR image and the second LDR image, acquiring a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; Based on the corresponding relationship, the first LDR image and the second LDR image are fused to obtain a high dynamic range HDR image of the target object.
2. The method according to claim 1, characterized in that The acquiring, based on the first LDR image and the second LDR image, a correspondence relationship between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image comprises: Based on the first LDR image and the second LDR image, obtaining similarities between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; Based on the similarity, a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks is obtained.
3. The method according to claim 2, characterized in that The acquiring, based on the first LDR image and the second LDR image, similarities between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image comprises: Performing feature extraction on the first LDR image and the second LDR image to obtain first features of a plurality of first image blocks of the first LDR image and second features of a plurality of second image blocks of the second LDR image; The first features of the plurality of first image blocks and the second features of the plurality of second image blocks are calculated to obtain similarities between the plurality of first image blocks and the plurality of second image blocks.
4. The method according to claim 2 or 3, characterized in that: The plurality of first image blocks include a third image block, and acquiring a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks based on the similarity comprises: Based on the similarity between the third image block and the plurality of second image blocks, determining a second image block with the greatest similarity among the plurality of second image blocks as a fourth image block; A corresponding relationship between the third image block and the fourth image block is established.
5. The method according to any one of claims 1 to 4, characterized in that: The fusing the first LDR image and the second LDR image based on the corresponding relationship to obtain a high dynamic range HDR image of the target object comprises: Performing feature extraction on the first LDR image and the second LDR image to obtain third features of a plurality of first image blocks of the first LDR image and fourth features of a plurality of second image blocks of the second LDR image; Based on the corresponding relationship, adjusting the order of the fourth features of the plurality of second image blocks to obtain the fourth features of the plurality of second image blocks after the order is adjusted; The third feature of the plurality of first image blocks and the fourth feature of the plurality of second image blocks after adjustment and sorting are processed to obtain an HDR image of the target object.
6. The method according to claim 5, characterized in that The step of processing the third feature of the plurality of first image blocks and the fourth feature of the plurality of second image blocks after adjustment and sorting to obtain the HDR image of the target object comprises: The third feature of the plurality of first image blocks, the fourth feature of the plurality of second image blocks, and the fourth feature of the plurality of second image blocks after adjustment and sorting are processed to obtain an HDR image of the target object.
7. The method according to claim 6, characterized in that The processing includes at least one of the following: processing based on a self-attention mechanism, processing based on an interactive attention mechanism, splicing processing, convolution processing, processing based on a transformer network, addition processing, and activation processing.
8. The method according to claim 7, characterized in that The processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on a multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
9. The method according to claim 7 or 8, characterized in that: The transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
10. A model training method, characterized in that: The method comprises: Acquire a first LDR image of a target object and a second LDR image of the target object, wherein the first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels; The first LDR image and the second LDR image are processed by a to-be-trained model to obtain a high dynamic range HDR image of the target object, wherein the to-be-trained model is used to: based on the first LDR image and the second LDR image, obtain a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; based on the correspondence, fuse the first LDR image and the second LDR image to obtain the HDR image of the target object; Based on the HDR image, the model to be trained is trained to obtain a target model.
11. The method according to claim 10, characterized in that The model to be trained is used for: Based on the first LDR image and the second LDR image, obtaining similarities between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; Based on the similarity, a one-to-one correspondence between the plurality of first image blocks and the plurality of second image blocks is obtained.
12. The method according to claim 11, characterized in that The model to be trained is used for: Performing feature extraction on the first LDR image and the second LDR image to obtain first features of a plurality of first image blocks of the first LDR image and second features of a plurality of second image blocks of the second LDR image; The first features of the plurality of first image blocks and the second features of the plurality of second image blocks are calculated to obtain similarities between the plurality of first image blocks and the plurality of second image blocks.
13. The method according to claim 11 or 12, characterized in that: The plurality of first image blocks include a third image block, and the model to be trained is used for: Based on the similarity between the third image block and the plurality of second image blocks, determining a second image block with the greatest similarity among the plurality of second image blocks as a fourth image block; A corresponding relationship between the third image block and the fourth image block is established.
14. The method according to any one of claims 10 to 13, characterized in that: The model to be trained is used for: Performing feature extraction on the first LDR image and the second LDR image to obtain third features of a plurality of first image blocks of the first LDR image and fourth features of a plurality of second image blocks of the second LDR image; Based on the corresponding relationship, adjusting the order of the fourth features of the plurality of second image blocks to obtain the fourth features of the plurality of second image blocks after the order is adjusted; The third feature of the plurality of first image blocks and the fourth feature of the plurality of second image blocks after adjustment and sorting are processed to obtain an HDR image of the target object.
15. The method according to claim 14, characterized in that The model to be trained is used for: The third feature of the plurality of first image blocks, the fourth feature of the plurality of second image blocks, and the fourth feature of the plurality of second image blocks after adjustment and sorting are processed to obtain an HDR image of the target object.
16. The method according to claim 15, characterized in that The processing includes at least one of the following: processing based on a self-attention mechanism, processing based on an interactive attention mechanism, splicing processing, convolution processing, processing based on a transformer network, addition processing, and activation processing.
17. The method according to claim 16, characterized in that The processing based on the self-attention mechanism or the processing based on the interactive attention mechanism includes at least one of the following: normalization processing, processing based on a multi-head attention mechanism, addition processing, and processing based on a multi-layer perceptron.
18. The method according to claim 16 or 17, characterized in that The transformer network-based processing includes at least one of the following: processing based on a multi-head self-attention mechanism and processing based on a multi-layer perceptron.
19. An image processing device, characterized in that: The device comprises a target model, and the device comprises: A first acquisition module is used to acquire a first LDR image of a target object and a second LDR image of the target object, wherein the first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels; a second acquisition module, configured to acquire, based on the first LDR image and the second LDR image, a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; A fusion module is used to fuse the first LDR image and the second LDR image based on the corresponding relationship to obtain an HDR image of the target object.
20. A model training device, characterized in that: The device comprises: An acquisition module, configured to acquire a first LDR image of a target object and a second LDR image of the target object, wherein the first LDR image and the second LDR image are images obtained by photographing the target object at different exposure levels; a processing module, configured to process the first LDR image and the second LDR image through a model to be trained to obtain a high dynamic range HDR image of the target object, wherein the model to be trained is configured to: based on the first LDR image and the second LDR image, obtain a one-to-one correspondence between a plurality of first image blocks of the first LDR image and a plurality of second image blocks of the second LDR image; based on the correspondence, fuse the first LDR image and the second LDR image to obtain the HDR image of the target object; The training module is used to train the model to be trained based on the HDR image to obtain a target model.
21. An image processing device, characterized in that: The device includes a memory and a processor; the memory stores codes, and the processor is configured to execute the codes. When the codes are executed, the image processing device performs the method according to any one of claims 1 to 18.
22. A computer storage medium, characterized in that The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method of any one of claims 1 to 18.
23. A computer program product, characterized in that The computer program product stores instructions, which, when executed by a computer, cause the computer to implement the method according to any one of claims 1 to 18.
Citation Information
Patent Citations
Method, system and device for synthesizing image
CN108259774A
Method for eliminating ghosting of high-dynamic-range image
CN112233032A
High dynamic range imaging method and device, electronic equipment and storage medium
CN113592726A
Image processing method and device, electronic equipment and computer readable storage medium
CN114862734A
Image fusion method and device, computer readable medium and electronic equipment
CN115471435A
