High dynamic range imaging method based on self-supervised pre-trained large model
Through self-supervised pre-training large models and gradient vanishing weight mask technology, the problem of insufficient information and ghosting in traditional high dynamic range imaging technology is solved, high-quality high dynamic range images are generated, and the extraction and extraction of general image features are realized. Ghost removal.
Patent Information
- Application Number
- CN202410579410.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2024-09-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional high dynamic range imaging technology suffers from insufficient information and ghosting problems, and expensive hardware is difficult to widely apply. Existing networks have insufficient understanding of general image structures and meanings, resulting in poor generalization.
Using a method based on self-supervised pre-training large models, we obtain prior information through large-scale image data sets, extract common features of images, use gradient vanishing weight masks and semantic fusion correction networks to reduce ghosting and generate high-quality high dynamic range images. .
Effectively utilize massive image information, extract high-quality semantic features, reduce ghosting in significant motion areas, and generate higher-quality ghost-free high dynamic range images, getting rid of the limitations of small data sets.
Smart Images

Figure CN118714463A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision image technology, and in particular relates to a high dynamic range imaging method based on a self-supervised pre-trained large model. Background Art
[0002] Due to hardware limitations, traditional camera equipment can only capture images with a limited dynamic range. When it is necessary to process the full range of illumination in natural scenes, it often cannot provide images of reasonable quality, and information loss in underexposed and overexposed areas may occur. The current hardware specifically designed to capture images with a high exposure range is always too expensive to be widely used.
[0003] In order to avoid the high cost of high dynamic range hardware, the use of technical methods to capture high dynamic range scenes has attracted widespread attention. Currently, there are two approaches: single exposure restoration and multi-exposure synthesis. The multi-exposure synthesis approach can obtain more scene details through scene information at different exposures and then synthesize more realistic and accurate high dynamic range images.
[0004] There are generally two traditional methods: the first is motion rejection, which assumes that only a small number of pixels in a low dynamic range image move, while most pixels are static. In this case, all pixels in the image are registered, and the unaligned areas are replaced with pixels of the reference image or surrounding static pixels, and then the aligned parts are fused to produce a high dynamic range image; the second method is motion registration, which aligns the low dynamic range image and the corresponding reference image and then fuses the aligned parts. However, traditional methods usually have problems such as insufficient information, poor imaging performance, or ghosting.
[0005] The deep learning method can retain information and reduce the generation of ghosting, better deal with the problem of significant motion. At the same time, the deep learning method can use the existing prior information to guide the network to focus on the specified low dynamic range image information.
[0006] Since the amount of commonly used data for high dynamic range imaging tasks is usually small, most existing networks and methods trained on them have difficulty in achieving a good understanding of the structure and meaning of general images, and thus cannot produce image features with strong generalization. However, large models trained on large-scale image datasets can obtain such image prior information and produce high-quality general image features that can be used in a wide range of downstream scenarios. Summary of the invention
[0007] In order to overcome the problems existing in the existing high dynamic range imaging technology, the present invention designs a method based on a self-supervised pre-trained large model, which can make good use of the prior information provided by a large-scale image data set to point out the segmentation information of the area where ghosting may occur, extract the common features of the image, and provide a basis for the subsequent elimination of ghosting.
[0008] In order to achieve the above object, the technical solution of the present invention is as follows:
[0009] A high dynamic range imaging method based on a self-supervised pre-trained large model comprises the following steps:
[0010] 1) Obtain a large-scale data set from the Internet by crawling and filtering, and use a public multimodal pre-trained large model to obtain its feature representation, and then obtain a pre-trained data set after deduplication. Subsequently, a public self-supervised large model pre-training method is used to pre-train the general visual large model skeleton, and a public pre-trained projection head for image segmentation tasks is added;
[0011] 2) The HDR (high dynamic range) imaging task dataset contains several scenes, each scene contains a set of x images with different exposures, and the medium exposure value is selected as the reference image.
[0012] 3) Each group of x LDR (low dynamic range) images is passed through the large model skeleton and the public segmentation head trained in step 1 to obtain an image containing segmentation information, and then the reference image in step 2 is compared with the segmentation results of the other x-1 images, and a gradient vanishing weight mask is generated and superimposed for mask pre-alignment. After obtaining the pre-aligned image, it is converted to the HDR domain through a gamma mapping formula and spliced with the original pre-aligned image, and then it is divided into multiple groups of image sub-blocks and passed through an m×n convolution layer to obtain x initial shallow features, which are extracted again through the large model skeleton to obtain pre-aligned features;
[0013] 4) Input the weighted features obtained in step 3 into SFCNet (Semantic Fusion Correction Network), fuse the weighted features of each exposure through cross attention, and correct and enhance them based on the weighted features of the reference image to obtain the ghost removal intermediate features;
[0014] 5) The initial features of the reference image are jumped to the ghost removal intermediate features through m×n convolution to obtain the enhanced features of the reference image;
[0015] 6) Taking the enhanced features as input, through the upsampling layer and the normalization function, the de-ghosted image is reconstructed with high quality to obtain a ghost-free HDR image;
[0016] 7) Construct an HDR ghost removal dataset; input the LDR image to the HDR imaging model based on the self-supervised pre-trained large model to obtain the network output; the loss function is a weighted combination of feature space perception (LPIPS) loss and mean absolute (L1) loss to supervise the network training process and optimize the model parameters;
[0017] 8) Obtain three low dynamic range images to be synthesized, input them into the model and obtain the final ghost-free HDR image.
[0018] According to the above-mentioned high dynamic range imaging method based on self-supervised pre-trained large model, it is characterized in that the specific details of step 1 include the following:
[0019] (1) Collect a large amount of image data containing various scenes and objects by crawling and screening public data sources, and represent all of them through the VGG16 feature extraction model. Calculate the cosine similarity of the obtained features, filter out images with cosine similarity higher than a certain value, thereby achieving deduplication and obtaining a large-scale pre-training data set. Among them, VGG16 is a classic image feature extraction network. The size and distribution of feature values can reflect the similarity of images to a certain extent. The higher the cosine similarity, the more similar the images are. In order to improve the quality of large-scale pre-training data sets, this method is used for deduplication. The cosine similarity formula is as follows: Where A and B are two n-dimensional image feature vectors to be compared, A∈T and B∈T, cosθ represents the cosine similarity value between the two vectors;
[0020] (2) Using the large-scale pre-training data set in step (1) and selecting a general visual large model skeleton, the public self-supervised large model pre-training method is used to train the large model skeleton, that is, the unlabeled image is divided into different scales and input into the teacher and student networks respectively, and then trained and distilled at the same time, plus the pre-trained segmentation head, and finally the trained large model weight is obtained and frozen. In a more recommended embodiment, the selected self-supervised large model training method is the DINO method (self-distillation with no labels, unsupervised self-distillation), and the selected general visual large model is ViT-S / 8. Because the self-supervised pre-training method enables the large model to have the ability to learn general visual features after pre-training on a large number of high-quality data sets containing rich content scenes and their semantic information without supervision information, the features extracted by the pre-trained visual large model have the characteristics of paying more attention to objects or individuals that may have significant movement, thereby facilitating the SFCNet module to analyze and fuse.
[0021] According to the above-mentioned high dynamic range imaging method based on self-supervised pre-trained large model, it is characterized in that the specific details of step 3 include the following contents:
[0022] (1) Input the x LDR images obtained in step 2 into the pre-trained large model and output the corresponding x segmentation results. Compare the segmentation results of the reference image with the segmentation results of the other x-1 images. The area in the same position in the non-reference image after segmentation but belonging to different categories represents the area where the different exposure images are taken at different times and move compared to the reference image and may produce ghost images. This area is often a person, animal or object that is prone to movement and can be easily recognized and segmented by the pre-trained large model. Therefore, for this part of the area, a gradient vanishing weight mask is generated, and the erroneous non-reference content is eliminated and weakened, and the correct reference content is superimposed and strengthened, thereby obtaining a pre-aligned image. The gradient vanishing weight mask is calculated by the shortest distance between each pixel and the pixel of the correctly classified instance of the reference image, and is used to reduce the original weight of the area where the non-reference image has significant movement according to the degree of movement, and then the content of the same area of the reference image is superimposed according to this weight. The specific calculation formula of the gradient vanishing weight mask is: Mask Δx,Δy It is the mask value generated by any misaligned pixel according to the distance from its nearest correct attribute instance point. In a possible embodiment, σ=0.5.
[0023] (2) Convert a group of x pre-aligned images to the HDR domain using the Gamma mapping formula and splice them with their original images. Divide the spliced pre-aligned images into multiple s×t sub-blocks, where the sub-blocks at the same position in the images with different exposures are grouped together. In order to reduce the amount of computation during training, the subsequent feature extraction operations, fusion reconstruction, and loss calculation are all performed on the basis of a group. Make a group of x sub-blocks with different exposures pass through an m×n convolutional layer to obtain shallow features, and then input them into the pre-trained large model again. After passing through the large model skeleton, the pre-aligned features are extracted as output, and then the pre-aligned features are spliced. The pre-aligned images greatly reduce the possibility of ghosting. After passing through the pre-trained large model again, high-quality features can be extracted and generated, which are used for information fusion between different exposures based on the reference image.
[0024] According to the above-mentioned high dynamic range imaging method based on self-supervised pre-trained large model, it is characterized in that the specific details of the above-mentioned step (1) include the following contents:
[0025] ① For the shallow features obtained in step 2, first input them into the pre-trained large model, and output the segmented object attributes and corresponding pixel positions through the model skeleton and segmentation head. The parts of these segmented object instances are the areas that are most likely to cause ghosting in multi-exposure fusion due to movement, so they are the objects for subsequent pre-alignment processing.
[0026] ② Consider the object attributes of the annotated pixel positions of the reference image and the non-reference image. For any non-reference image, first check whether all attribute instances given by the image segmentation appear in the reference image. All instances that do not appear are superimposed with a (100-M)% elimination mask. Then take the content at the same position from the reference image and superimpose it with a (100-N)% enhancement mask and then add it to the non-reference image. Then check whether there are segmented attribute instances in the reference image that do not appear in the image. Superimpose the positions and contents of these instances corresponding to the non-reference image with a (100-M)% elimination mask. Then take the instance content, superimpose it with a (100-N)% enhancement mask and add it to the non-reference image.
[0027] ③ Consider the object attributes of the annotated pixel positions of the reference image and the non-reference image. For any non-reference image, instances with the same attributes that appear in the reference image need to be compared to obtain their non-aligned position information. The non-aligned pixels of the non-reference image instances are marked as type 1 pixels, and the non-aligned pixels of the reference image instances are marked as type 2 pixels. Then, the gradient vanishing weight mask is superimposed on the pixels of type 1. The formula is as follows: B = l B *(Mask1-Mask Δx,Δy ((x bk ,y bk )||(x ak ,y ak ))),in Because the farther away the pixel is from the correct alignment area, the clearer the intention of elimination is; the gradient vanishing weight mask with enhanced superposition for the second type of pixels is as follows: B = l B +l A *Mask Δx,Δy ((x bk ,y bk )||(x ak ,y ak )),in This is because the further away the pixels are from the alignment area, the more they should be retained for correction of the non-reference image.
[0028] ④ Consider the object attributes of the annotated pixel positions of the reference image and the non-reference image. For the reference image, since it is the alignment target, the mask is always all 1, and the original image information and details remain unchanged.
[0029] According to the above-mentioned high dynamic range imaging method based on self-supervised pre-trained large model, it is characterized in that the specific details of step 4 include the following:
[0030] The SFCNet module takes the features of a completed spliced image as input, takes the middle exposure as the reference image, continuously compares the semantic differences between x different exposures, strengthens the semantics of the reference image, and prevents the generation of artifacts; at the same time, the information in the other two exposure images is used as a supplement to the reference image, thereby retaining the amount of information within the HDR exposure range. The SFCNet module includes MLP layers (Multi-Layer Perceptron, multi-layer perceptron), Layer1 layer, Layer2 layer, Layer3 layer, Layer4 layer, Layer5 layer, Layer6 layer, Layer7 layer, Layer8 layer and Output layer.
[0031] The Layers 1 to 8 are all SAB blocks (Semantic Attention Block).
[0032] According to the above-mentioned high dynamic range imaging method based on self-supervised pre-trained large model, it is characterized in that the SAB module includes: a division layer, which is used to divide the input features into x features corresponding to different exposures of the input image according to the inverse operation of the stitching process described in step 3 (2); followed by a shallow feature enhancement layer, which is used to constrain the information in the features extracted after pre-alignment; then, with the reference image features as queries, a cross-attention layer is constructed to enable the information between different exposures to begin to merge, and correction is performed based on the reference image; followed by a stitching operation, and an MLP layer for feature transformation.
[0033] According to the above-mentioned high dynamic range imaging method based on self-supervised pre-trained large model, it is characterized in that the specific details of step 6 include the following:
[0034] The high-quality reconstruction includes a convolution layer and an activation function, wherein the convolution layer converts the image features from the embedding dimension back to the number of input channels, and then the normalization function constrains the color value range to the (0,1) range common to HDR images. In a more recommended embodiment, the activation function is selected as a sigmoid function because the value range of the function conforms to the (0,1) range.
[0035] Features of the present invention:
[0036] Compared with the prior art, the present invention has the following characteristics and beneficial effects: the present invention can make good use of the prior knowledge of massive image information, extract general image features with high-quality semantics, get rid of the limitation of the volume of small data sets dedicated to downstream tasks on the learnable information, and can use the image segmentation prior provided by the large model to reduce the weight of non-reference images in the significant motion area, thereby reducing the generation of ghosts, and then after semantic analysis and fusion correction, it is easier to better discover and remove the ghost components. Using the self-supervised pre-trained large model, the present invention can generate higher-quality and ghost-free HDR images from LDR images. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of the method of the present invention.
[0038] Figure 2 This is the overall network structure diagram of the high dynamic range imaging method based on the self-supervised pre-trained large model of the present invention.
[0039] Figure 3 It is a flowchart of generating a gradient vanishing weight mask based on a reference image and a non-reference image.
[0040] Figure 4 This is the semantic fusion correction network structure diagram of the present invention.
[0041] Figure 5 It is the flow chart of the semantic attention module of the present invention.
[0042] Figure 6 It is a flow chart of the shallow feature enhancement module of the present invention. DETAILED DESCRIPTION
[0043] The present invention is described in detail below with reference to the accompanying drawings.
[0044] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0045] The present invention discloses a high dynamic range imaging method based on a self-supervised pre-trained large model, which is used to extract excellent features from multiple LDR images with high quality and fuse them to reconstruct an HDR image. The method flow is as follows: Figure 1 shown.
[0046] See also Figures 1 to 5 As shown, the present invention specifically comprises the following steps:
[0047] Step S1, obtain a large-scale data set from the Internet by crawling, screening, etc., and use a public multimodal pre-trained large model to obtain its feature representation and then obtain a pre-trained data set after deduplication processing, and then use a public self-supervised large model pre-training method to pre-train the general visual large model skeleton, and add a public pre-trained projection head for image segmentation tasks;
[0048] The specific implementation method of step S1 is as follows:
[0049] Step S1.1, collect a large amount of image data containing various scenes and objects by crawling and screening public data sources, and represent all of them through the pre-trained VGG16 feature extraction model for image features, calculate the cosine similarity of the obtained features, filter out the images with cosine similarity higher than a certain value, so as to achieve deduplication and obtain a large-scale pre-training data set. Among them, VGG16 is a classic image feature extraction network. The size and distribution of the feature value can reflect the similarity of the image to a certain extent, and the higher the cosine similarity, the more similar the images are. In order to improve the quality of the large-scale pre-training data set, this method is used for deduplication;
[0050] Step S1.2, using the large-scale pre-training data set in step S1.1 and selecting a general visual large model skeleton, adopting the public self-supervised large model pre-training method to train the large model skeleton, that is, the unlabeled image is segmented at different scales and input into the teacher and student networks respectively, and then trained and distilled at the same time, plus the segmentation head, and finally the trained large model weights are obtained and frozen. In a more recommended embodiment, the selected self-supervised large model training method is the public unsupervised self-distillation method (self-distillation with no labels, DINO), and the selected general visual large model is ViT-S / 8.
[0051] The specific implementation method of step S1.1 is as follows:
[0052] Step S1.1.1, crawl wild unorganized image data from publicly available image data websites through Python crawler program. For each image in all specified web pages, extract the image URL from the web page tag to download the corresponding available image, so as to obtain a wild data set; select data sets that meet the characteristics of rich instance attribute types from the many currently available open source data sets, discard their supervisory information, and only retain their image content.
[0053] Step S1.1.2: Make all collected images I i (i=1,…,n, where n is the total number of images collected) The feature vector set T={VGG16(Ii ),i=1,…,n}.
[0054] Step S1.1.3, calculate the cosine similarity between image features, mainly between wild unsorted data and between wild data and open source data. Since each open source data set itself has been screened and sorted, no internal cleaning is required. The cosine similarity formula is as follows: Where A and B are two n-dimensional image feature vectors to be compared, A∈T and B∈T, and cosθ represents the cosine similarity value between the two vectors.
[0055] Step S2, the HDR imaging task dataset contains several scenes, each scene contains a set of x images with different exposures, and a medium exposure value is selected as a reference image;
[0056] The specific implementation method of step S2 is as follows:
[0057] Each scene has a set of x images with different exposures, which will be used to synthesize an HDR image later. In more common cases, these images are taken by bracketing. Since the bracketing is not taken at the same time, the scene and the object may move, resulting in misalignment of the content. Therefore, the HDR image to be synthesized needs to select a reference image, which is often a medium exposure. Because the lower exposure image can supplement the bright information, and the higher exposure image can supplement the dark information. The number of images in a set, x, that is, the number of images taken by bracketing, is usually 3.
[0058] Step S3: Pass the spliced image through the large model skeleton and segmentation head trained in step S1 to obtain an image containing segmentation information, compare the reference image selected in step S2 with the segmentation results of the other x-1 images, and generate a gradient vanishing weight mask Mask. i And superimposed for mask pre-alignment, after obtaining the pre-aligned image, it is converted to the HDR domain through the gamma mapping formula and spliced with the original pre-aligned image, and then it is cut into multiple groups of image sub-blocks and passed through an m×n convolution layer to obtain x initial shallow features, and then extracted again through the large model skeleton to obtain the pre-aligned features;
[0059] The specific implementation method of step S3 is as follows:
[0060] Step S3.1, input the x LDR images obtained in step S2 into the pre-trained large model for segmentation prediction, and output the corresponding x segmentation results, and compare the segmentation result of the reference image with the segmentation results of the other x-1 images. For the same pixel position after segmentation but segmented into different attribute instances or one of the unsegmented areas, a gradient vanishing weight mask is generated, and the erroneous non-reference content is eliminated and weakened, and the correct reference content is superimposed and strengthened, thereby obtaining a pre-aligned image. The gradient vanishing weight mask is calculated by the shortest distance between each pixel and the pixel of the correctly classified instance of the reference image, and is used to reduce the original weight of the non-reference image with significant motion according to the degree of motion, and then the content of the same area of the reference image is superimposed according to the weight. The specific calculation formula of the gradient vanishing weight mask is: Mask Δx,Δy It is the mask value generated by any misaligned pixel according to its distance from the nearest correct attribute instance point. In a more recommended embodiment, x=3, σ=0.5.
[0061] Step S3.2: a set of x pre-aligned images L i (i=1, ..., x) is converted to the HDR domain through the Gamma mapping formula, where the Gamma formula is as follows: γ=2.2,where t i is the exposure time of image i, H i is the image L i The image is obtained after Gamma mapping. The significance of Gamma correction is to solve the problem of nonlinear output of the display and to adapt to the fact that the human eye is more sensitive to changes in darker areas in terms of brightness perception. Then the image H mapped to the HDR domain is i Compared with the original LDR image L i P i =[L i ,H i ], so that it can provide HDR domain information hints for the purpose of LDR image fusion to obtain a full-detail HDR image at input.
[0062] Step S3.3: divide the x stitched pre-aligned images into multiple s×t sub-blocks q i (i=1,…,x), numbered from left to right in the order of first row and then column, the sub-blocks with the same number in the group of images with different exposures are grouped together. In order to reduce the amount of calculation during training, the subsequent feature extraction operations, fusion reconstruction and loss calculation are all performed on the basis of a group. Let a group of x sub-blocks with different exposures q i After an m×n convolutional layer, the shallow feature f is obtained i =Conv(q i)(i=1,…,x), and then input the pre-trained large model again. After passing through the large model skeleton, the pre-aligned feature Q is extracted. i As output, the pre-aligned features are then concatenated F d =[Q1,…,Q x In a possible embodiment, the length and width of the original image are greater than 128, s=t=128; and the convolution layer m=n=3.
[0063] The specific implementation method of step S3.1 is as follows:
[0064] Step S3.1.1: For a set of LDR images obtained in step 2, i First, it is input into the pre-trained large model, and the model skeleton and segmentation head output the segmented object attributes and corresponding pixel positions. Segmentation = Segment_Head (ViT-S / 8 (L i )). These segmented object instances are the areas most likely to cause ghosting in multi-exposure fusion due to motion, so they are the objects for subsequent pre-alignment processing. A The segmentation instance in is {A1,A2,…,A n}, a non-reference image l B The segmentation instance in is {B1,B2,…,B n}, each instance contains its category attribute a and the pixel coordinates covered {(x i ,y i ),i=1,…,n}.
[0065] Step S3.1.2: Consider the object attributes of the annotated pixel positions in the reference image and the non-reference image. For any non-reference image, first check whether all attribute instances given by the image segmentation appear in the reference image. All instances that do not appear at the same time, such as B s Overlay (100-M)% Elimination Mask: l B = l B *(Mask1-.M*((x bs ,y bs )&Mask1)), then take the content at the same position from the reference image and superimpose the (100-N)% enhancement mask and then add it to the non-reference image: B = l B +l A *(Mask1-.N*((x bs ,y bs )&Mask1)); then check if there are instances of segmentation attributes in the reference image that do not appear in this image, and convert these instances into A tThe position and content corresponding to the non-reference image are superimposed (100-M)% elimination mask: l B = l B *(Mask1-.M*((x at ,y at )&Mask1)), then take the instance content, superimpose the (100-N)% enhancement mask and add it to the non-reference image: B = l B +l A *(Mask1-.N*((x at ,y at )&Mask1)). Mask1 represents a mask whose values are all 1, (x bs ,y bs ) indicates that the coordinates of all pixels covered by the attribute instance Bs of the non-reference image are 1 and the rest are 0, (x at ,y at ) represents the attribute instance A of all reference images t The coordinates of all covered pixels are 1 and the rest are 0. In a possible embodiment, M=N=50.
[0066] Step S3.1.3: Consider the object attributes of the annotated pixel positions in the reference image and the non-reference image. For any non-reference image, a certain attribute instance B k Instance A with the same attributes already appears in the reference image k , we need to compare and get the position information of their non-aligned pixels, and mark the non-reference image instance non-aligned pixels (x bk ,y bk ) is a type of pixel, and the instance of the reference image is not aligned with the pixel (x ak ,y ak ) is the second-class pixel. is the gradient vanishing weight mask of the first-class pixel superimposed and eliminated, and the formula is as follows: B = l B *(Mask1-Mask Δx,Δy ((x bk ,y bk )||(x ak ,y ak ))),in Because the farther away the pixel is from the correct alignment area, the clearer the intention of elimination is; the gradient vanishing weight mask with enhanced superposition for the second type of pixels is as follows: B = l B +l A *Mask Δx,Δy ((x bk ,y bk )||(x ak ,yak )),in Because the farther away the pixels are from the alignment area, the more they should be retained for correction of the non-reference image. k and Δy k By traversing all correctly aligned instance pixels with the same attribute, we calculate (x k ,y k ) and the distance between them.
[0067] Step S3.1.4: Consider the object attributes of the annotated pixel positions of the reference image and the non-reference image. For the reference image, since it is the target of alignment, the mask is always all 1: l A = l A *Mask1, keep the original image information and details unchanged.
[0068] Step S4: feature F d Input SFCNet, after understanding and analyzing the image semantics, it finds the misaligned semantics of significant motion between images with different exposures, fuses the images and corrects them based on the medium exposure, realizes ghost removal based on the reference image, and obtains the image feature f sfc ;
[0069] The specific implementation method of step S4 is as follows:
[0070] Step S4.1, F d After an MLP layer, image features are allowed to be nonlinearly mapped and extracted for subsequent semantic attention and extraction, which includes a fully connected layer, a GeLU activation layer, and a fully connected layer in sequence, and then the feature F is obtained. d′ =MLP(F d ),MLP()=f c2 (GeLU(f c1 ())).
[0071] Step S4.2: F d′ Through n SAB modules in sequence, the semantic differences between the three images with different exposures are continuously compared, the semantics of the reference image is strengthened to prevent the generation of artifacts, and the high exposure and low exposure image information is used as a supplement to obtain the output F s .
[0072] Furthermore, assuming that the number of exposures in step S2 is x=3, then the i-th SAB module SAB i The specific implementation is as follows:
[0073] Step S4.2.1: Input F z Divided into three tensors corresponding to different exposures [F′ z1 ,F′z2 ,F′ z3 ], where F′ z1 Through the low-exposure shallow feature f1 and the previous SAB layer low-exposure feature F′ z-1,1 The enhancement of F z1 =reinforce(F ′ z1 ,F′ z-1,1 ,f1),F ′ z2 Through the medium exposure shallow feature f2 and the previous SAB layer low exposure feature F ′ z-1,2 The enhancement of F z2 =reinforce(F ′ z2 ,F ′ z-1,2 ,f2),F ′ z3 Through the high exposure shallow feature f3 the previous SAB layer low exposure feature F′ z-1,2 Strengthen to get F z3 =reinforce(F′ z3 ,F′ z-1,3 ,f3). The details of the feature enhancement process include two branches: local and global. For exposure i, the feature F′ obtained by dividing the input of the corresponding previous SAB layer is firstly used. z-1,i After passing through an MLP layer, it is summed with the feature residual of this layer to perform local feature enhancement; then the shallow feature f corresponding to the exposure is used i It is directly added to the feature residual of this layer to perform global feature enhancement; the enhancement of the two branches makes feature learning subject to appropriate constraints of the initial image.
[0074] Step S4.2.2: F z2 and F z1 、F z3 Calculate cross attention: first make the reference feature F z2 Multiply by different query weight matrices W q The query vector q2 = W is calculated q (F z2 ), and make the low-exposure image F z1 and the high-exposure image F z3 Multiply by the key matrix W k Calculate the key vector and multiply it by the value matrix W v Calculate the value vector, where k1 = W k (F z1 ), v1=W v (F z1 ) and k3=W k (F z3), v3=W v (F z3 ); then calculate the attention matrix obtained by multiplying the query vector with the two key vectors and passing it through a SoftMax layer, and then perform matrix multiplication of the two attention matrices with their value vectors, F z2 With F z1 The calculation formula is as follows The scaling factor d k =dim / / num_heads = 16, F z,12 That is, after the feature F z1 and feature F z2 Calculate the cross attention value obtained by cross attention, and similarly get F z,32 .
[0075] Step S4.2.3: F z,12 、F z2 、F z,32 Spliced together to get the attention feature F c =[F z,12 ,F z2 ,F z,32 ] and pass through an MLP layer (same as step S4.1) to obtain SAB i Output F z+1 .
[0076] Step S4.3: Extract feature F d With output F s Perform jump connection to obtain f sfc =F d +F s .
[0077] Step S5: Pass the shallow feature f2 in step S3 through a 3×3 convolutional layer and jump to f sfc , and obtain the enhanced feature f ′ =Conv(f2)+f sfc ;
[0078] Step S6: The enhanced feature f′ is passed through an upsampling layer, that is, a convolutional layer is used to convert the enhanced feature from the embedding dimension back to the number of input channels, and then a sigmoid function is used to constrain the image value range back to the (0,1) interval, and the ghost-free image is reconstructed to obtain a ghost-free high dynamic range image F hdr =Sigmoid(Upsampler(f′)).
[0079] Step S7, construct an HDR ghost removal dataset; input the LDR image to the HDR imaging model based on the self-supervised pre-trained large model to obtain the network output; the loss function is Lpips loss and perceptual loss, so as to supervise the training process of the network and optimize the model parameters.
[0080] Step S8, obtain three synthesized LDR images, input them into the model and obtain the final ghost-free HDR image.
[0081] The above process is a high dynamic range imaging method based on a self-supervised pre-trained large model proposed by the present invention. In order to train the image enhancement model used by the method of the present invention, a significant motion HDR dataset is first constructed, including 144 groups of images (3 high, medium, and low exposure images and one GT in each group), and a large-scale Internet dataset is constructed; the large-scale Internet dataset is first used to pre-train using a public self-supervised large model method, and after completion, its backbone ViT-S / 8 is obtained and its weights are frozen; the HDR training image is input to the high dynamic range imaging model based on the self-supervised pre-trained large model to obtain a ghost-free high dynamic range result; the loss value between the output and the target image is calculated and the model parameters are optimized accordingly. After multiple rounds of training, the high dynamic range imaging method based on the self-supervised pre-trained large model proposed by the present invention is obtained.
[0082] In the inference stage of the HDR image generation model based on the self-supervised pre-trained large model, the three LDR images to be processed are first obtained, and then the images to be processed are input into the HDR image generation model based on the self-supervised pre-trained large model after the above training to obtain the final ghost-free high dynamic range image.
[0083] The present invention was implemented and tested in the following environment, and obtained good HDR imaging effect and high-quality images:
[0084] Step 1: Use the DINO method to perform self-supervised pre-training of large models. When ViT-S / 8 is selected as the skeleton and the batch number is 1024, distributed training is required on 16 V100 GPUs.
[0085] Step 2: Based on the computational requirements of reasoning with the self-supervised pre-trained large model, the pre-training of the HDR imaging pipeline is performed on the NVIDIA RTX 4090 GPU.
[0086] The above description is only a preferred specific implementation scheme of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A high dynamic range imaging method based on a self-supervised pre-trained large model, characterized by The following steps are involved: 1) Obtain a large-scale data set from the Internet by crawling and filtering, and use a public multimodal pre-trained large model to obtain its feature representation, and then obtain a pre-trained data set after deduplication. Subsequently, a public self-supervised large model pre-training method is used to pre-train the general visual large model skeleton, and a public pre-trained projection head for image segmentation tasks is added; 2) The high dynamic range imaging task dataset contains several scenes, each scene contains a set of x images with different exposures, and the medium exposure value is selected as the reference image; 3) Each group of x low dynamic range images is passed through the large model skeleton and the public segmentation head trained in step 1 to obtain an image containing segmentation information, and then the reference image in step 2 is compared with the segmentation results of the other x-1 images, and a gradient vanishing weight mask is generated and superimposed for mask pre-alignment. After obtaining the pre-aligned image, it is converted to a high dynamic range domain through a gamma mapping formula and spliced with the original pre-aligned image, and then it is divided into multiple groups of image sub-blocks and passed through an m×n convolution layer to obtain x initial shallow features, which are extracted again through the large model skeleton to obtain pre-aligned features; 4) Inputting the pre-aligned features obtained in step 3 into the semantic fusion correction network, fusing the pre-aligned masks of each exposure through cross attention, and performing correction and hierarchical enhancement based on the pre-aligned features and shallow features of the reference image to obtain the ghost removal intermediate features; 5) The initial features of the reference image are jumped to the ghost removal intermediate features through m×n convolution to obtain the enhanced features of the reference image; 6) Taking the enhanced features as input, through the upsampling layer and the normalization function, the de-ghosted image is reconstructed with high quality to obtain a high dynamic range image without ghosts; 7) Construct a high dynamic range deghosting dataset; input low dynamic range images to the high dynamic range imaging model based on the self-supervised pre-trained large model to obtain the network output; the loss function is a weighted combination of feature space perception loss and mean absolute loss to supervise the network training process and optimize the model parameters; 8) Obtain three low dynamic range images to be synthesized, input them into the model and obtain the final ghost-free high dynamic range image.
2. The high dynamic range imaging method based on self-supervised pre-trained large model according to claim 1, characterized in that: The specific details of step 1 include: 11) Collect massive image data by crawling and screening public data sources, and represent all of them through the language-image comparison pre-training model, calculate the cosine similarity of the obtained features, and filter out images with cosine similarity higher than a certain value, so as to achieve deduplication and obtain a large-scale pre-training data set; 12) Using the large-scale pre-trained dataset in step 11 and selecting a general visual large model skeleton, a public self-supervised large model pre-training method is used to train the large model skeleton, and then a public pre-trained segmentation head is added to finally obtain and freeze the large model weights that can produce high-quality segmentation results and extract high-quality features.
3. The high dynamic range imaging method based on self-supervised pre-trained large model according to claim 1, characterized in that: The specific details of step 3 include: 31) Input the x LDR images obtained in step 2 of claim 1 into the pre-trained large model and output the corresponding x segmentation results, compare the segmentation result of the reference image with the segmentation results of the other x-1 images, and generate a gradient vanishing weight mask for the regions in the same position but belonging to different categories in the segmented non-reference image. The mask is calculated based on the shortest distance between the current pixel and the pixel of the correctly classified instance of the reference image, subtract the erroneous non-reference content, and superimpose the correct reference content, thereby obtaining a pre-aligned image. The specific calculation formula of the gradient vanishing weight mask is: Mask Δx,Δy It is the mask value generated by any misaligned pixel according to its distance to the nearest correct attribute instance point; 32) The x pre-aligned images are converted to the high dynamic range domain through the gamma mapping function and spliced with their original images. The spliced pre-aligned images are divided into multiple sub-blocks of the same size and the sub-blocks are passed through a convolution layer to obtain shallow features. The shallow features of different exposures are input into the pre-trained large model again in groups. After passing through the large model skeleton, the pre-aligned features are extracted as output, and then the pre-aligned features are spliced.
4. The high dynamic range imaging method based on self-supervised pre-trained large model according to claim 1, characterized in that: The specific details of the semantic fusion correction network in step 4 include: 41) passing the extracted image features through a multi-layer perceptron; 42) After k semantic attention blocks, the middle exposure is used as the reference image, and the semantic differences between x different exposures are continuously compared to strengthen the semantics of the reference image and prevent artifacts. At the same time, the information of the other two exposure images is fused as a supplement to the reference image, thereby generating a high dynamic range image. 43) Perform a residual connection between the concatenated features obtained in step 32 of claim 3 and the output features obtained in step 42 to obtain a semantic enhancement feature.
5. The high dynamic range imaging method based on self-supervised pre-trained large model according to claim 4, characterized in that: The specific details of the semantic attention block in step 42 include: 421) dividing the input features into x tensors corresponding to different exposures, and using the global shallow features of the corresponding exposures in step 2 of claim 1 and the input of the previous layer semantic attention block as local shallow features to perform multi-level shallow feature enhancement; 422) Let the medium exposure be the query and the other low exposures and high exposures be the key and value respectively, to calculate the cross attention respectively to achieve the fusion of each exposure and the reference feature, concatenate all the fused attention features and then pass them through a multi-layer perceptron to obtain the output feature.
6. The high dynamic range imaging method based on self-supervised pre-trained large model according to claim 1, characterized in that: The specific details of the upsampling layer and normalization function of step 6 include: The upsampling layer converts the multi-channel high-dimensional features into a three-channel image by performing convolution operations on the features, and constrains the color value range to the (0, 1) range commonly found in high dynamic range images through a normalization function.
Citation Information
Patent Citations
Image high dynamic range reconstruction method based on deep learning
CN111292264A
Image reconstruction method, electronic equipment, storage medium and computer program product
CN115564662A
Small sample HDR ghosting removal method based on saturation perception encoder
CN116389926A
