Image background matching method and device based on depth uncertainty, equipment and medium
By generating a depth prediction set and modulating the feature map with a spatial attention weight map, and calculating a weighted cosine similarity score, the interference of unreliable regions in depth prediction on image background similarity calculation is resolved, and a more stable and accurate indoor background similarity analysis is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies cannot effectively identify and suppress the interference of unreliable regions in depth prediction on image background similarity calculation, resulting in erroneous depth information affecting the accuracy of scene consistency determination.
By acquiring feature maps of the images to be compared and generating a depth prediction set, the feature maps are modulated using a depth uncertainty map and a spatial attention weight map, and a weighted cosine similarity is calculated to determine the background similarity score.
It effectively reduces the interference of occlusion and noise areas on background comparison, achieving more stable and accurate indoor background similarity analysis.
Smart Images

Figure CN121962673A_ABST
Abstract
Description
Image background matching method, apparatus, equipment, and medium based on depth uncertainty Technical Field
[0001] This invention relates to the field of image detection technology, and in particular to an image background matching method, apparatus, device, and medium based on depth uncertainty. Background Technology
[0002] In the fintech sector, background similarity analysis of indoor scene images has become a crucial step in risk assessment, scene verification, and compliance confirmation of business processes. For example, in scenarios such as remote account opening, remote face-to-face verification, and online business review, it's necessary to determine whether multiple indoor images uploaded by a user were taken at the same location to identify fake backgrounds, abnormal scene transitions, or suspected fraudulent activities. However, existing technologies generally rely on deterministic single-shot depth estimation results and lack the ability to identify unreliable areas in depth prediction (such as areas misjudged due to human occlusion, specular reflection, or changes in lighting). This results in erroneous depth information often being directly incorporated into the background analysis process, thus affecting the accuracy of scene consistency determination.
[0003] In the healthcare field, scenarios such as remote follow-up, environmental safety monitoring, and patient home rehabilitation records require determining whether indoor images collected at multiple time points point to the same shooting environment. This is to confirm whether the patient's activity area is real, whether there have been any abnormal changes in equipment placement, or whether there is a risk of tampering with the monitoring environment. Existing technologies typically use feature comparison or Siamese network structures to measure the similarity of image backgrounds. However, without being able to distinguish between the real background structure and depth estimation errors, factors such as human movement, occlusion by assistive devices, and depth artifacts caused by reflections from medical equipment can severely interfere with the similarity calculation results, reducing the reliability of background consistency analysis.
[0004] In existing methods for calculating image background similarity, there is often a lack of synergy between depth estimation and attention mechanisms. Current spatial attention models primarily rely on deterministic metrics such as saliency, texture gradient, and semantic region as the basis for attention, without incorporating prediction uncertainty as weighting information. This results in regions with high depth errors still receiving high attention responses. This disconnect leads to the repeated amplification of unreliable regions during the comparison process, further contaminating the representation of background features. Summary of the Invention
[0005] The main objective of this invention is to provide an image background matching method, apparatus, device, and storage medium based on depth uncertainty, aiming to solve the technical problem that existing technologies cannot suppress the interference of unreliable regions on the feature comparison process based on depth prediction uncertainty, thereby causing indoor background similarity calculation to be easily obscured, and contaminated by depth artifacts and prediction errors.
[0006] To achieve the above objectives, the present invention provides an image background matching method based on depth uncertainty, comprising: acquiring a first image and a second image to be compared; inputting the first image and the second image into a feature extraction network to generate a first feature map and a second feature map, respectively; inputting the first feature map and the second feature map into a depth estimation network to obtain a first depth prediction set and a second depth prediction set, respectively; determining a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set, respectively; inputting the first depth uncertainty map and the second depth uncertainty map into a spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively; multiplying the first spatial attention weight map element-wise with the first feature map to obtain a first modulation feature map, and multiplying the second spatial attention weight map element-wise with the second feature map to obtain a second modulation feature map; determining a weighted cosine similarity based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score; and processing a target task based on the background similarity score to obtain a target task result.
[0007] Furthermore, to achieve the above objectives, the present invention provides an image background matching device based on depth uncertainty, comprising: an image feature extraction module, configured to acquire a first image and a second image to be compared, and input the first image and the second image into a feature extraction network respectively to generate a first feature map and a second feature map respectively; a depth prediction generation module, configured to input the first feature map and the second feature map into a depth estimation network respectively to obtain a first depth prediction set and a second depth prediction set respectively; an uncertainty calculation module, configured to determine a first depth uncertainty map and a second depth uncertainty map respectively based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set; and a spatial attention weight generation module, configured to... The depth uncertainty map and the second depth uncertainty map are respectively input into the spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively; the feature modulation module is used to multiply the first spatial attention weight map and the first feature map element-wise to obtain a first modulation feature map, and to multiply the second spatial attention weight map and the second feature map element-wise to obtain a second modulation feature map; the similarity calculation module is used to determine a weighted cosine similarity based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score; the task processing module is used to process the target task based on the background similarity score to obtain the target task result.
[0008] Furthermore, to achieve the above objectives, the present invention also provides a computer device, the computer device including a memory, a processor, and a depth-deterministic image background matching program stored in the memory and executable on the processor, wherein the depth-deterministic image background matching program, when executed by the processor, implements the steps of the depth-deterministic image background matching method as described above.
[0009] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a depth-deterministic image background matching program, wherein the depth-deterministic image background matching program, when executed by a processor, implements the steps of the depth-deterministic image background matching method as described above.
[0010] Beneficial Effects: This invention relates to the field of image detection technology and can be applied to business scenarios such as fintech and healthcare. It discloses an image background matching method, apparatus, device, and medium based on depth uncertainty, comprising: acquiring two images to be compared; inputting them into a feature extraction network to generate a first feature map and a second feature map; inputting the two feature maps into a depth estimation network to obtain a first depth prediction set and a second depth prediction set containing random perturbation results; generating a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of the two depth prediction sets, and generating corresponding spatial attention weight maps; modulating the two feature maps using the spatial attention weight maps to obtain a first modulated feature map and a second modulated feature map; calculating a weighted cosine similarity based on the modulated feature map and the corresponding spatial attention weight map to obtain a background similarity score, and completing the target task processing based on this score. This invention effectively reduces the interference of occlusion and noise regions on background comparison through uncertainty modeling, attention modulation, and weighted similarity calculation, achieving more stable and accurate indoor background similarity analysis. Attached Figure Description
[0011] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the drawings: Figure 1 is a schematic diagram of an application environment of the image background matching method based on depth uncertainty in an embodiment of the present invention; Figure 2 is a schematic flowchart of an embodiment of the image background matching method based on depth uncertainty in the present invention; Figure 3 is a schematic diagram of the functional modules of a preferred embodiment of the image background matching device based on depth uncertainty in the present invention; Figure 4 is a schematic diagram of the structure of a computer device in an embodiment of the present invention; Figure 5 is another schematic diagram of the structure of a computer device in an embodiment of the present invention. Detailed Implementation
[0012] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0013] The image background matching method based on depth uncertainty provided in this invention can be applied in the application environment shown in Figure 1, where the client communicates with the server via a network. The server can acquire two images to be compared through the client, input them into a feature extraction network to generate a first feature map and a second feature map; input the two feature maps into a depth estimation network to obtain a first depth prediction set and a second depth prediction set containing random perturbation results; generate a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of the two depth prediction sets, and generate corresponding spatial attention weight maps; modulate the two feature maps using the spatial attention weight maps to obtain a first modulated feature map and a second modulated feature map; calculate a weighted cosine similarity based on the modulated feature map and the corresponding spatial attention weight map to obtain a background similarity score, and complete the target task processing based on this score. This invention effectively reduces the interference of occlusion and noise regions on background comparison through uncertainty modeling, attention modulation, and weighted similarity calculation, achieving more stable and accurate indoor background similarity analysis. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The present invention will now be described in detail through specific embodiments.
[0014] Please refer to Figure 2, which is a flowchart illustrating an embodiment of the image background matching method based on depth uncertainty provided by the present invention. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0015] As shown in Figure 2, the image background matching method based on depth uncertainty proposed in this invention includes the following steps: S10, acquiring a first image and a second image to be compared, and inputting the first image and the second image into a feature extraction network to generate a first feature map and a second feature map respectively; In this embodiment, the process of acquiring the first image and the second image is applicable to any readable digital image source, including image frames generated by the acquisition device, file data transmitted remotely, or pixel matrices cached internally by the system. The acquisition action not only involves image reading, but also requires format parsing, color space decoding, size alignment, and pixel normalization of the image matrix to give the input a tensor structure that can be accepted by the network. The image input is usually represented as a three-dimensional or four-dimensional array. In the process of forming the tensor, normalization, batch dimension construction, and data type conversion are used to ensure the stability of the network's forward propagation.
[0016] The process of inputting the first and second images into the feature extraction network includes execution mechanisms such as feeding tensors into the computation graph, parameter loading, convolutional kernel activation, and attention path preparation. The feature extraction network structure can include multi-layer convolutional units, downsampling modules, feature fusion modules, or multi-head attention modules, used to map raw pixel information into semantically relevant high-dimensional feature representations. During forward propagation, the network utilizes convolution operations, non-linear activation, normalization operations, and spatial context modeling to perform layer-by-layer feature compression, encoding elements such as lighting, texture, edges, and layout into multiple channel vectors.
[0017] Generating the first and second feature maps means that the input image undergoes multi-level mapping to form a feature representation with reduced spatial dimension and increased semantic dimension. The spatial size and number of channels of the feature map are determined by the network structure, and the channel vectors are used to represent the visual patterns of local regions. The generation process consists of continuous convolution accumulation, attention weighting, feature fusion, and downsampling operations. The output feature map provides a stable and distinguishable original image representation for subsequent processing links.
[0018] This embodiment processes two input images in a consistent format and feeds them into a unified feature extraction network to obtain stable, structured, and semantically discriminative high-dimensional feature maps. This allows the texture, geometry, and lighting information of the images to be expressed in a more compact vector form, thereby enhancing the ability to identify image differences in subsequent calculations and reducing interference from noise and local occlusion.
[0019] S20, the first feature map and the second feature map are respectively input into the depth estimation network to obtain the first depth prediction set and the second depth prediction set. In this embodiment, the process of inputting the first feature map and the second feature map into the depth estimation network involves mapping the previously generated high-dimensional feature tensor into a spatial depth distribution. The input action needs to complete the dimensionality verification, normalization adaptation, and boundary padding between the feature tensor and the depth estimation network structure, so that the feature map can enter the network's encoding and decoding paths. The depth estimation network typically contains multiple layers of convolutional stacks, cross-layer jumpers, dilated convolutions, or attention aggregation units to enhance the global correlation representation of features, enabling the network to form an effective distance field inference capability in the spatial domain of the feature map.
[0020] Depth prediction relies on a multi-level representation mechanism within the network. The encoding path progressively compresses spatial dimensions to enhance the semantic representation of features; the decoding path restores the spatial scale through upsampling and feature fusion, ensuring that the prediction results maintain a distribution range consistent with the input feature regions. When the feature maps undergo forward propagation through the network, the network performs convolutional activation, batch normalization, and spatial context fusion at each layer, ultimately outputting depth prediction values that correspond one-to-one with the feature map locations.
[0021] Obtaining the first and second depth prediction sets means that the depth estimation network performs multiple prediction processes on the same feature map. In each prediction process, the presence of random components produces slightly different depth results. The depth prediction set consists of multiple depth maps, each containing continuous depth values generated at the corresponding spatial location, used for subsequent calculations of local depth fluctuations or structural stability. The set is formed through multiple forward propagations, with the depth map output from each propagation added to the set structure, ultimately forming a sequence of depth values that can be used for statistical analysis.
[0022] This embodiment performs multiple depth predictions on the same feature map and constructs a depth prediction set, which can obtain a numerical distribution that reflects the stability of spatial structure and the fluctuation of prediction. This allows subsequent processing to use these depth variation patterns to identify unreliable regions and reduce the impact of erroneous depth estimates, thereby improving the quality of background representation in the image comparison process.
[0023] S30, based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set, a first depth uncertainty map and a second depth uncertainty map are determined respectively. In this embodiment, using the first depth prediction set and the second depth prediction set as input, the first depth uncertainty map and the second depth uncertainty map are constructed by analyzing the value fluctuation of corresponding pixels in multiple depth predictions and utilizing statistical variance. The first depth prediction set and the second depth prediction set are respectively composed of multiple depth inference results. Each pixel position corresponds to a set of depth values in the set, which is used to reflect the stability of the same spatial position under different prediction conditions. Corresponding pixels represent pixel positions with consistent spatial coordinates in the two sets, and are corresponded one-to-one through array indexing or coordinate mapping. In actual calculation, the mean depth value is first calculated for each pixel position, and then the variance is obtained based on the square of the deviation. The variance value is placed in a two-dimensional matrix with the same size as the image to form a depth uncertainty map. The process of generating the variance value may include operations such as depth value reading, invalid value filtering, mean calculation and variance accumulation, forming a continuous distribution map characterizing the intensity of depth prediction fluctuations. This method allows the hidden confidence differences in the deep prediction set to be presented in a visual form, which is convenient for subsequent processing.
[0024] In one implementation, the first and second depth prediction sets are traversed pixel-by-pixel, and the mean and variance are calculated using double-precision floating-point format to avoid unstable values caused by accumulated errors. In another implementation, to reduce computational load, the depth prediction results can be downsampled first, then the variance calculated, and finally, a high-resolution first and second depth uncertainty maps are generated through interpolation. In yet another implementation, variance can be calculated using an online update method, reducing storage space consumption and making it more suitable for operation in resource-constrained environments.
[0025] This embodiment transforms the depth prediction set into a first depth uncertainty map and a second depth uncertainty map, which allows the pixel-level depth confidence to be displayed in a spatial distribution form, making it easier to identify unstable prediction areas and reducing the interference of depth fluctuations on subsequent background correlation calculations.
[0026] S40, the first depth uncertainty map and the second depth uncertainty map are respectively input into the spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map. In this embodiment, the first depth uncertainty map and the second depth uncertainty map are used as input, and the spatial confidence attention module generates the first spatial attention weight map and the second spatial attention weight map. The first depth uncertainty map and the second depth uncertainty map provide the depth fluctuation intensity at each pixel location, which is used to reflect the difference in the spatial distribution of prediction confidence. The spatial confidence attention module is used to construct a spatial weight distribution based on these uncertainty values. It typically includes a convolution calculation unit, a normalization unit, and a nonlinear transformation unit to map the variance values in the input map to attention weights between zero and one. In specific implementation, the input depth uncertainty map first undergoes a local region feature reading operation to encode the statistical relationship of neighboring pixels, then generates a confidence score through a function mapping mechanism, and subsequently undergoes a normalization process to form a continuous weight distribution. In the process of generating the first spatial attention weight map and the second spatial attention weight map, the weight corresponds to the difference in confidence in the depth uncertainty map, so that the more stable depth regions get higher spatial weights, while the weights of the unstable depth regions are suppressed, thus forming a spatial confidence mapping oriented towards the background structure.
[0027] In one implementation, the spatial confidence attention module uses a convolutional structure to extract features from the depth uncertainty map and uses a sigmoid function to map the output to weight values. In another implementation, multi-scale convolutional structures can be used to process depth uncertainty maps at different scales separately, and then fused to generate the final first or second spatial attention weight map, thereby improving robustness to local noise. Furthermore, an adaptive normalization mechanism can be used to adjust the weight range, making the weight distribution more closely match the depth fluctuation patterns of a specific scene.
[0028] This embodiment utilizes a spatial confidence attention module to transform depth uncertainty features into spatial attention weights, which can effectively highlight stable depth prediction regions and suppress high-fluctuation regions, thereby providing more reliable spatial confidence information for subsequent image feature modulation.
[0029] S50, the first spatial attention weight map and the first feature map are multiplied element-wise to obtain the first modulation feature map, and the second spatial attention weight map and the second feature map are multiplied element-wise to obtain the second modulation feature map. In this embodiment, the first spatial attention weight map and the first feature map are used as inputs, and the first modulation feature map is generated by element-wise multiplication. At the same time, the second spatial attention weight map and the second feature map are used to perform the same calculation to obtain the second modulation feature map. Both the first spatial attention weight map and the second spatial attention weight map are generated in the previous stage based on depth uncertainty. Their values reflect the confidence strength of different spatial locations and are used to indicate the credibility of each pixel region in the overall scene structure judgment. The first feature map and the second feature map come from the previous feature extraction stage and contain spatial semantic information such as color, texture, and local shape. Element-wise multiplication refers to performing position-aligned multiplication operations on two tensors with the same corresponding dimensions at each spatial coordinate. This operation can directly adjust the response value of each position in the feature map. In the specific implementation, the calculation process first ensures that the weight map and the feature map match in the resolution dimension. Then, a pointwise multiplication is performed on the feature vector and the weight scalar at the same coordinate, so that regions with high weights exhibit stronger feature responses after modulation, while regions with low weights are significantly weakened. The output of this operation is the first and second modulated feature maps, whose spatial structure distribution is reshaped, allowing stable background regions to contribute more in subsequent calculations, while the influence of depth fluctuation regions is compressed, thus forming a feature representation that is more suitable for subsequent similarity inference.
[0030] This embodiment utilizes spatial attention weights to modulate the feature map element by element, enabling the feature representation to automatically focus on deep stable regions and weaken unreliable regions, thereby improving the discriminative ability of subsequent similarity calculations and the accuracy of background consistency assessment.
[0031] S60, a weighted cosine similarity is determined based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score. In this embodiment, the determination of the weighted cosine similarity uses the first and second modulation feature maps as the main inputs, and combines the first and second spatial attention weight maps for spatial weighting processing to form a numerical expression that reflects background consistency. The first and second modulation feature maps are derived from the feature modulation process in the previous step, and contain a semantic structure distribution adjusted by spatial weights. The first and second spatial attention weight maps provide the confidence level of each spatial location, used to strengthen the reliable region and weaken the interference region when calculating similarity. The calculation logic of the weighted cosine similarity is based on the geometric meaning of vector similarity, treating the feature vector of each pixel location as a point in a high-dimensional space, and measuring the local directional consistency through the dot product between feature vectors. To ensure the overall similarity score better aligns with background stability evaluation requirements, the spatial attention weight maps of the two modulation feature maps are multiplied point-by-point before the dot product calculation to generate a joint weight term. This joint weight term reflects the shared confidence level of the two images at the same location. Subsequently, the dot product of the feature vectors is multiplied by the joint weight term, making the contribution of different pixel locations proportional to the confidence level. To obtain a normalized similarity value, the square of the feature vector magnitude of each modulation feature map is calculated and multiplied point-by-point with the square of the corresponding weight, then summed to form a normalization factor for the denominator. Finally, the background similarity score is obtained by dividing the numerator by the square root of the denominator. This calculation process finely expresses the spatial consistency between the image and background in a pixel-by-pixel, multi-vector, and weighted manner. By combining weights with modulation features, the similarity results better reflect the visual structural associations in complex indoor environments.
[0032] This embodiment utilizes the modulation feature map and spatial attention weight map to jointly determine the weighted cosine similarity, enabling the background similarity score to more accurately characterize the consistency of the spatial structure of the two images, effectively reducing the interference of deep noise regions, and improving the stability and reliability of background similarity calculation.
[0033] S70, Process the target task based on the background similarity score to obtain the target task result.
[0034] In this embodiment, the target task processing takes the background similarity score as input and converts it into an executable judgment result to achieve quantitative inference of scene consistency. The background similarity score is a numerical quantity derived from the feature space, used to express the degree of consistency between two images in terms of structure, layout, and background texture. Its numerical range can be set as a continuous range according to the model training boundary. The target task is used to perform scene identity inference, environmental state confirmation, or spatial consistency verification. Essentially, it maps continuous similarity values to discretized judgment results. To achieve this mapping, judgment rules need to be configured within the execution module. These rules use a threshold as a numerical boundary to define the division relationship between different results. The threshold, as a statically or dynamically calculated delimitation parameter, can be derived from error statistics of the pre-evaluation set or from empirical distributions generated over long-term operation, indicating what level of similarity can be considered scene consistency. After receiving the background similarity score, the target task processing unit performs a numerical comparison process, determining whether the similarity score is greater than or equal to the threshold. The comparison result forms a scene consistency category or a scene inconsistency category. Based on this category information, the processing unit further organizes the judgment result into a structured result representation, which includes the background similarity score and the corresponding category label, so that the output content can be directly used by downstream execution modules. The entire conversion process is a mapping process from continuous measure to discrete judgment, which is achieved through three operations: numerical comparison, result labeling, and result encapsulation.
[0035] In one implementation, the threshold remains fixed and is set based on statistical results from the model validation set, suitable for environments with stable scene variations. Alternatively, a dynamic threshold mechanism can be used, continuously updating the threshold during operation to adapt to changes in the distribution of image acquisition devices. Another approach is to employ an interval threshold structure, expanding a single threshold into a set of intervals to distinguish between high consistency, intermediate uncertainty, and low consistency results, improving fine-grained judgment capabilities in complex business scenarios. For result encapsulation, key-value structures or compact matrix representations can be used to adapt to different task management modules.
[0036] Example Explanation: In the healthcare field, home monitoring devices need to determine whether environments recorded in different time segments belong to the same living space to analyze behavioral continuity. Background similarity scores reflect the stability of spatial structure, and threshold judgments ensure that the system can still achieve consistency verification under changes in lighting or posture.
[0037] In the financial services sector, offline processing areas may require consistency verification of environmental screenshots collected at different times to support the detection of abnormal behavior. By mapping similarity scores to scenario consistency labels, direct and usable environmental verification results can be provided to the risk control module, reducing the burden of manual review and improving the accuracy of anomaly screening.
[0038] This embodiment transforms background similarity scores into discrete task judgment results, enabling complex image similarity measurements to directly serve business decision-making processes, obtaining clear and definite scene consistency results, and improving the reliability and availability of scene judgment.
[0039] In one embodiment, step S10 includes: S101, acquiring a first image and a second image to be compared, performing block processing on the first image and the second image respectively to divide the first image and the second image into multiple non-overlapping image patches, and projecting the image patches into high-dimensional feature embedding vectors as input sequences; S102, processing the input sequence through the depth perception module of the feature extraction network to generate an initial depth estimation map, and determining the scale coefficient of the image content based on the initial depth estimation map; S103, dynamically configuring the window size parameter of the window self-attention mechanism in the feature extraction network according to the scale coefficient; S104, using the feature extraction network configured with the window size parameter, performing multi-level window self-attention processing and feature downsampling and merging operations on the input sequence, and outputting a first feature map and a second feature map containing multi-scale semantic information respectively.
[0040] In this embodiment, when acquiring the first and second images to be compared, the input can come from static camera capture, frame capture from a monitoring system, or mobile terminal photography. The image resolution can be a fixed size, or it can be scaled to a uniform size during preprocessing so that the subsequent network structure can use a uniform tensor shape for processing. When the first and second images are processed in blocks, the entire image is divided into multiple non-overlapping image patches, each patch covering a fixed-size pixel region, such as a square region. The non-overlapping constraint ensures that each pixel belongs to only one patch, facilitating consistent feature encoding and position indexing at the patch level. The operation of projecting the image patches into high-dimensional feature embedding vectors can be implemented through linear mapping layers, convolutional mapping units, or hybrid structures, converting the pixel values that originally existed in a two-dimensional arrangement into a one-dimensional vector representation, while extending the vector channels to a high-dimensional space, enabling the subsequent self-attention module to express richer structural patterns in the feature dimension. The high-dimensional feature embedding vectors of all patches form an input sequence in a fixed order. This sequence plays a role similar to a time series or label sequence in the subsequent network, used to drive attention operations and multi-level feature fusion.
[0041] After receiving the input sequence, the depth perception module in the feature extraction network first establishes relationships between patches within the embedding space. Through attention units, convolutional units, or a combination of both, it estimates the response intensity at each location related to the scene geometry and reconstructs it into the initial depth estimation map. The initial depth estimation map maintains spatial resolution alignment with the original image, and the value at each location reflects its relative distance within the 3D scene. When determining the scale coefficients of image content based on the initial depth estimation map, statistical analysis can be performed on the entire depth map, such as calculating the mean, variance, quantiles, or segment proportions of the depth value distribution, thereby obtaining scale coefficients characterizing the overall scale properties of the scene. Scale coefficients can be not only single scalars but also interval parameters or hierarchical parameters, used to distinguish the proportions of near, mid, and far-field regions in the image, providing a basis for subsequent window configuration.
[0042] When dynamically configuring the window size parameters of the self-attention mechanism in the feature extraction network based on the scale coefficient, the window partitioning method within the network is controlled by the scale coefficient. A smaller scale coefficient allows for a smaller window, focusing attention more on local structures and adapting to scenes with a high proportion of close-up details. A larger scale coefficient allows for a larger window, covering a wider field of view and capturing large-scale layout changes. The window size parameter can employ different transformation rules at different levels. For example, a smaller window is maintained in shallow layers to capture fine-grained textures, while the window is gradually increased in deeper layers to aggregate wide-area layout information. Dynamic configuration means that the window size is not fixed to a single preset value but is calculated based on the scale coefficient of the current input image, enabling the same network to adaptively handle scenes with different viewpoints, focal lengths, and indoor layout densities.
[0043] By utilizing a feature extraction network with pre-configured window size parameters, multi-level window self-attention processing and feature downsampling merging operations are performed on the input sequence. The network is organized into several cascaded structures. Within each level, self-attention computation is first performed within a pre-defined window, and then the local window outputs are merged into a more compact feature representation through downsampling and channel aggregation operations. At each level, the self-attention unit redistributes feature weights based on inter-patch similarity, enhancing responses to structural contours, wall areas, ground areas, and large static backgrounds, while weakening responses to low-frequency noise regions. The downsampling merging operation, by merging feature vectors from adjacent locations and compressing channel dimensions, allows features to have a larger receptive field at deeper levels, while preserving the influence of the scaling coefficient introduced from the initial depth estimation map on the window shape and attention coverage. After multi-level processing, the first image and the second image are respectively obtained as the first feature map and the second feature map. The two feature maps correspond to the downsampled image grid in the spatial coordinate dimension and encode multi-scale semantic information, implicit depth information and response patterns that are more sensitive to indoor static background structures in the channel dimension, providing a stable representation basis for subsequent depth prediction set construction and background similarity calculation.
[0044] This embodiment introduces image patch embedding, high-dimensional sequence encoding, a depth perception module to generate an initial depth estimation map, scale coefficient-driven window size adaptive configuration, and multi-level window self-attention and downsampling merging operations. The first feature map and the second feature map are simultaneously fused with spatial local details, scene scale information, and hierarchical semantic structure during the generation process. Compared with the processing method of directly extracting fixed window features from the original image, it is easier to distinguish stable background structures from foreground changing areas such as people and furniture in subsequent processing stages, thereby providing a more stable feature foundation with scale-adaptive capabilities for subsequent depth prediction and similarity measurement.
[0045] In one embodiment, step S20 includes: S201, constructing a Bayesian depth estimation network comprising a residual block encoder, a dilated convolutional bottleneck layer, and a transposed convolutional decoder, and embedding a random dropout layer in the dilated convolutional bottleneck layer or the transposed convolutional decoder of the Bayesian depth estimation network; S202, inputting the first feature map into the Bayesian depth estimation network, and configuring the Bayesian depth estimation network in a random inference mode, such that the random dropout layer maintains an activation state of randomly masking neuron connections with a preset probability during inference; S203, in the random inference mode, utilizing the... The Bayesian depth estimation network performs multiple repeated forward propagation processes on the first feature map, generating a temporary depth prediction result with random perturbation characteristics in each forward propagation process; S204, all temporary depth prediction results output by the multiple repeated forward propagation processes are summarized to construct a first depth prediction set; S205, the second feature map is input into the Bayesian depth estimation network in the random inference mode, and the same number of repeated forward propagation processes as the first feature map are performed to generate multiple temporary depth prediction results with random perturbation characteristics, which are then summarized to construct a second depth prediction set.
[0046] In this embodiment, the first and second feature maps are no longer directly mapped to a single depth result as single inputs. Instead, a Bayesian depth estimation network with uncertainty representation capabilities is constructed to generate a first depth prediction set and a second depth prediction set. The Bayesian depth estimation network comprises a residual block encoder, a dilated convolutional bottleneck layer, and a transposed convolutional decoder. These three parts work together to map from feature maps to multiple depth prediction results. The residual block encoder receives either the first or second feature map and performs hierarchical convolution and nonlinear transformation on the spatial features. Shortened connections are introduced to preserve shallow features in the deep network, mitigating gradient vanishing and enhancing the transmission of fine-grained information such as texture and edges during the encoding stage. The encoded output is fed into the dilated convolutional bottleneck layer. The dilated convolution expands the receptive field by inserting intervals within the convolutional kernel, covering a larger spatial area without significantly increasing the number of parameters. This allows the network to perceive long-distance dependencies of background structures such as walls, floors, and large furniture areas during depth prediction. The transposed convolutional decoder receives the bottleneck layer output and performs upsampling and deconvolution operations step by step to restore the low-resolution semantic representation to a depth prediction map with the same spatial resolution as the input feature map. It outputs a continuous depth value at each spatial location to represent the relative distance from that location to the camera.
[0047] When embedding a random dropout layer within the aforementioned structure, the random dropout layer can be placed within a dilated convolutional bottleneck layer or a transposed convolutional decoder. The random dropout layer achieves random subset sampling of the network's internal connections by masking neuron or channel outputs with a preset probability. The preset probability is typically set between zero and one, such as 30% or 50%, to control the strength of the random masking. The masked object can be a single neuron, an entire channel, or the output unit of a convolutional kernel. By introducing random dropout layers at multiple locations, several different effective subnetwork structures can be formed. To allow the random dropout layer to function as a Bayesian approximation during the inference phase, the network is configured in a random inference mode. In this mode, the random masking behavior used during training remains active during inference, rather than being disabled. The random inference mode makes each forward propagation equivalent to using a subnetwork sampled from the hidden weight distribution, thereby simulating the parameter sampling process in Bayesian inference.
[0048] After the first feature map is input into a Bayesian depth estimation network configured in stochastic inference mode, the network performs a forward propagation on the first feature map. A random dropout layer masks certain connections according to a preset probability, resulting in a temporary depth prediction. This temporary depth prediction is spatially aligned with the first feature map and numerically includes the current stochastic subnetwork's estimate of the scene's geometric relationships. Because the random dropout layer generates different masking patterns during each forward propagation, repeating the forward propagation process multiple times for the same first feature map, under different random masking combinations, yields multiple temporary depth predictions with random perturbation characteristics. The number of repetitions can be set according to the robustness requirements of the target scene and computational resources, such as ten or twenty times. More repetitions result in a more stable depth distribution estimate for subsequent statistical analysis.
[0049] All temporary depth predictions obtained from repeated forward propagation are aggregated to construct the first depth prediction set. The aggregation operation stores each temporary depth prediction result sequentially into a four-dimensional array or list structure, maintaining alignment in the spatial and channel dimensions, and stacking the outputs of different forward propagations in the sample dimension, so that each pixel location corresponds to a set of depth prediction values. Therefore, the first depth prediction set is no longer a single depth map, but a collection containing multiple candidate depth maps, carrying multiple judgments of the network on the depth at the same location under random parameter perturbations. The processing of the second feature map is consistent with that of the first feature map. The second feature map is input into the same Bayesian depth estimation network in random inference mode, and the same number of repeated forward propagations are performed as for the first feature map, each time obtaining a temporary depth prediction result for the second feature map. The second depth prediction set is then constructed using the same aggregation method. This ensures that the first and second depth prediction sets are completely identical in terms of network structure, random dropout strategy, and number of repetitions, focusing the differences on the input feature map itself, thus providing a symmetrical and comparable depth prediction data foundation for subsequent uncertainty calculations based on statistical variance.
[0050] This embodiment constructs a Bayesian depth estimation network comprising a residual block encoder, a dilated convolutional bottleneck layer, and a transposed convolutional decoder. In stochastic inference mode, a random dropout layer is used to perform multiple repeated forward propagations on the first and second feature maps. The first and second depth prediction sets spatially cover the indoor background structure, forming a set representation of multiple depth estimates for the same pixel in the sample dimension. Compared to the output of a single deterministic depth map, this is more convenient for using statistical variance to characterize depth-unstable regions in subsequent stages, distinguishing high-error regions such as human projections, occlusion edges, and reflective surfaces from stable background regions. This provides a high-quality, quantifiable source of uncertainty information for subsequent uncertainty map construction and background similarity calculation.
[0051] In one embodiment, step S30 includes: S301, for each pixel in the first depth prediction set, extracting multiple depth prediction values corresponding to the pixel in all depth prediction results; S302, determining the arithmetic mean of the multiple depth prediction values to obtain a baseline depth value, and determining the square of the difference between each depth prediction value and the baseline depth value; S303, determining the average of the squares of all differences to obtain the statistical variance of the pixel; S304, determining the square root of the statistical variance to obtain the depth uncertainty value of the pixel; S305, collecting the depth uncertainty values of all pixels to form a first depth uncertainty map; S306, for each pixel in the second depth prediction set, repeating the steps of extraction, determining the average value, determining the square of the difference, determining the average value, and determining the square root to form a second depth uncertainty map.
[0052] In this embodiment, the first and second depth prediction sets are no longer considered as single depth maps, but rather as a set representation of multiple independent depth estimates performed on the same pixel grid for the same scene. The first depth prediction set can be understood as a set of depth prediction results obtained by multiple inferences on the corresponding features of the first image at a uniform resolution. Each element of the set is a two-dimensional depth prediction map, and each pixel location stores a continuous depth value. The second depth prediction set maintains the same data structure as the first depth prediction set, except that its input source corresponds to the features of the second image. Through this set structure, any pixel location not only has a single depth value, but also a sample sequence composed of multiple predictions.
[0053] For each pixel in the first depth prediction set, we first need to extract multiple depth prediction values for that pixel location across all depth prediction results along the sample dimension. Pixels can be uniquely identified using row and column indices; for example, the i-th row in the height direction and the j-th column in the width direction correspond to the depth value at that location in each temporary depth prediction result in the set. By traversing each depth prediction map in the set along the sample dimension, a one-dimensional numerical sequence can be constructed. This sequence contains all the depth prediction values obtained from multiple forward propagations at that location. To ensure the statistical operations are meaningful, the set size is preferably configured to be no less than two, allowing variance correlation calculations to be performed on this sequence.
[0054] After obtaining multiple depth prediction values for a specific pixel location, it is necessary to calculate the arithmetic mean of these values. The arithmetic mean is a fundamental quantity in probability and statistics used to characterize the central tendency of a set of values. By summing all the depth prediction values for that pixel location and then dividing by the number of predictions, a baseline depth value representing the overall level of this sample is obtained. This baseline depth value is numerically equivalent to a single depth prediction output in terms of distance, and is used as a central reference for subsequent bias calculations. Combining the multiple prediction results generated in the previous step, the arithmetic mean can eliminate some random disturbances, statistically smoothing out random noise.
[0055] After obtaining the baseline depth value, the difference between each predicted depth value in the set and the baseline depth value needs to be calculated, and this difference needs to be squared. The difference operation converts the deviation of each sample from the average level into a possible positive or negative offset. The squaring operation performs two tasks simultaneously: firstly, it eliminates the influence of the positive or negative sign, making all offsets non-negative; secondly, it amplifies the contribution of samples with larger offsets to subsequent statistics, giving predictions far from the average depth a higher weight in the characterization of instability. By performing this difference-squaring operation on each predicted depth value, a set of squared deviation sequences with the same number of samples can be obtained, providing the basic data for subsequent variance calculations.
[0056] To transform the discrete sequence of squared deviations at a single pixel location into a scalar that can be used to measure stability, the average of all squared differences needs to be calculated. Specifically, this can be achieved by summing the squared differences for that pixel location and then dividing by the number of depth prediction samples, resulting in a non-negative real number, which statistically corresponds to the statistical variance. The statistical variance reflects the dispersion of the depth prediction results at that pixel location across the sample dimension. If multiple predictions are close in value, the variance is small; if there are significant differences between different predictions, the variance is large. In the implementation, the above summation and division operations can be performed independently for each pixel location, constructing a variance distribution map over the entire depth map space.
[0057] To ensure that the uncertainty metric maintains the same dimensions as the depth prediction value and facilitates combination with subsequent spatial weights or other scale-related quantities, a square root operation needs to be performed on the statistical variance. The square root operation transforms the statistical variance into standard deviation, and the resulting value can be considered the depth uncertainty value of the depth prediction result for that pixel location. A larger depth uncertainty value indicates more significant differences between multiple depth predictions, and a more unstable geometric structure at that location within the current estimation framework; a smaller depth uncertainty value indicates high consistency among multiple predictions, and a location closer to a stable background or geometric contour. In practical calculations, the square root of the statistical variance can be taken for each pixel location to obtain an uncertainty distribution map with the same spatial resolution as the depth prediction map.
[0058] After calculating the depth uncertainty value for each pixel location, the depth uncertainty values for all pixel locations need to be spatially aggregated to form a first depth uncertainty map. The aggregation process can be performed by writing the depth uncertainty value of each location to its corresponding coordinate position according to the row and column indices of the original depth map, forming a two-dimensional raster image where each raster cell stores a non-negative real number. The first depth uncertainty map maintains the same spatial dimensions structurally as any depth prediction result in the first depth prediction set, but its numerical semantics change from "depth" to "uncertainty intensity." For the second depth prediction set, the above operations of extracting sample sequences, calculating the arithmetic mean, calculating the square of the difference, calculating the average of the squares of the difference, and calculating the square root can be repeated to generate a second depth uncertainty map on the pixel grid corresponding to the second image. This results in two uncertainty maps that correspond one-to-one with the first and second images, providing basic data for subsequent background similarity assessment using only depth-stable regions.
[0059] For example, the formula for calculating the reference depth value is:
[0060] in, Let represent the depth prediction map obtained from the t-th forward propagation, which comes from the output of the previously constructed Bayesian depth estimation network. T represents the number of times the forward propagation is performed on the same input feature map, corresponding to the number of samples in the depth prediction set. This represents a pixel-level baseline depth map, where each location represents the arithmetic mean depth of that pixel across all depth predictions, and is used as the center value for subsequent statistical variance calculations.
[0061] The formula for calculating pixel-level depth uncertainty is:
[0062] in, , As mentioned above. This represents a pixel-level depth uncertainty map, reflecting the fluctuation range of the same pixel in multiple depth predictions; the larger the value, the more unstable the depth prediction of that pixel is.
[0063] This embodiment transforms the sample sequence formed by multiple depth predictions into a first depth uncertainty map and a second depth uncertainty map with the same spatial resolution as the original depth map by performing continuous operations of arithmetic mean, squared deviation, variance, and square root on each pixel position in the first and second depth prediction sets. This allows each pixel position to not only carry a depth value but also have a scalar measure that statistically characterizes the stability of the prediction. This distinguishes regions with highly consistent predictions from regions with scattered predictions at the numerical level, providing explicit depth confidence information for subsequent processing steps and providing the prerequisite for weakening or masking highly unstable regions in subsequent similarity calculations.
[0064] In one embodiment, step S40 includes: S401, using a spatial confidence attention module to determine the first global maximum and first global minimum in the first depth uncertainty map, and the second global maximum and second global minimum in the second depth uncertainty map; S402, performing max-min normalization on the first depth uncertainty map based on the first global maximum and first global minimum to obtain a first normalized uncertainty map, and performing max-min normalization on the second depth uncertainty map based on the second global maximum and second global minimum to obtain a second normalized uncertainty map; S403, determining the difference between the unit value and the first normalized uncertainty map to obtain a first intermediate mapping value, and determining the difference between the unit value and the second normalized uncertainty map to obtain a second intermediate mapping value; S404, using a trainable scaling factor in the spatial confidence attention module to perform linear scaling on the first intermediate mapping value and the second intermediate mapping value to obtain a first scaled mapping value and a second scaled mapping value; S405, inputting the first scaled mapping value and the second scaled mapping value into a logistic activation function for mapping processing to generate a first spatial attention weight map and a second spatial attention weight map.
[0065] In this embodiment, the first and second depth uncertainty maps are provided as input to the spatial confidence attention module. Each depth uncertainty map can be viewed as a scalar field defined on a regular pixel grid, with each position in the grid recording the depth uncertainty value obtained in the previous statistical step. The spatial confidence attention module first traverses all pixel positions on the entire first depth uncertainty map, compares each uncertainty value, and selects the upper and lower bounds of the value range. The upper bound is recorded as the first global maximum value, and the lower bound as the first global minimum value. Similarly, the traversal and comparison process is performed on the second depth uncertainty map to obtain the second global maximum value and the second global minimum value. The global maximum and global minimum values reflect the upper and lower limits of the uncertainty map in the current scene, providing boundary parameters for subsequent scaling according to the dynamic range of the image itself.
[0066] After obtaining the first global maximum and minimum values, the spatial confidence attention module performs max-min normalization processing pixel-by-pixel on the first depth uncertainty map. Specifically, for the uncertainty value at each pixel location, the difference between that value and the first global minimum is used as the numerator, and the difference between the first global maximum and the first global minimum is used as the denominator. A scaling operation is then performed to map the original uncertainty value to the interval between zero and one. To avoid numerical instability caused by the denominator being close to zero, a very small stabilizing term can be superimposed on the denominator. After this normalization process, a first normalized uncertainty map is obtained while maintaining the spatial structure. The value at each location in the map falls between zero and one, and has a uniform dimensional scale within the image. The second depth uncertainty map is generated using the same normalization strategy, constructing a scaling relationship using the second global maximum and the second global minimum. This ensures that both uncertainty maps achieve dynamic range compression within their respective regions.
[0067] After obtaining the normalization result, the uncertainty needs to be converted into a confidence metric. The spatial confidence attention module introduces a unit value as a constant reference, where the unit value is a scalar of one, representing the maximum possible level of confidence in the normalized space. For each pixel position in the first normalized uncertainty map, the first intermediate mapping value is obtained by subtracting the normalized uncertainty value at that position from the unit value; similarly, the second intermediate mapping value is obtained by subtracting the unit value from the second normalized uncertainty map. Through this operation, the higher the uncertainty value, the lower the corresponding intermediate mapping value, and the lower the uncertainty value, the closer the corresponding intermediate mapping value is to the unit value, achieving a numerical inversion from "uncertainty intensity" to "confidence benchmark". The first and second intermediate mapping values are completely consistent with the first and second normalized uncertainty maps in terms of spatial resolution, respectively, and can be directly used as intermediate expressions for subsequent weight generation.
[0068] To adjust the sensitivity of the confidence mapping during training, a trainable scaling factor is set internally within the spatial confidence attention module. This trainable scaling factor can be designed as a single scalar or as a channel-independent parameter shared across different scenarios, updated during the specific network implementation via parameter structure and backpropagation. During linear scaling, the trainable scaling factor is multiplied by the first intermediate mapping value, performing one multiplication operation at each pixel location to obtain the first scaled mapping value. Similarly, the same trainable scaling factor or a set of corresponding parameters is multiplied by the second intermediate mapping value to generate the second scaled mapping value. This linear scaling allows numerical control over the compression or amplification of the confidence distribution, enabling subsequent nonlinear mappings to automatically adapt to the distribution differences of uncertain data at different training stages.
[0069] After linear scaling, to constrain the confidence mapping to the interval between zero and one and maintain differentiability, the spatial confidence attention module feeds the first and second scaled mapping values into a logistic activation function for mapping processing. The logistic activation function can be a monotonically increasing function based on exponential operations, providing an output between zero and one for any real input. For each pixel location, the logistic activation function receives the corresponding first scaled mapping value and outputs a weight value constrained to the range of zero and one. The outputs of all pixel locations together constitute the first spatial attention weight map. Similarly, the same logistic activation calculation is performed pixel-by-pixel on the second scaled mapping value to generate the second spatial attention weight map. The first and second spatial attention weight maps maintain the same spatial dimensions as the original depth uncertainty map. The elements at each pixel location can be directly used as spatial weights in subsequent feature modulation stages to highlight high-confidence regions and suppress high-uncertainty regions in depth features.
[0070] For example, the formula for normalized uncertainty mapping is:
[0071] in, This represents a depth uncertainty graph, which can be either a first depth uncertainty graph or a second depth uncertainty graph. This represents the global minimum of the uncertainty graph in the current image or batch. This represents the global maximum value in the uncertainty graph, corresponding to "global maximum". This represents a normalized uncertainty map, where each pixel value is linearly scaled to the range of zero to one, providing a uniform scale for subsequent confidence mapping.
[0072] The formula for calculating spatial confidence attention weights is:
[0073] in, As mentioned above. This represents the trainable scaling factor, used to control the scaling intensity and affect the distribution of attention weights. () represents a logistic activation function, such as the sigmoid function, which maps the input to the range of zero to one. The spatial attention weight map is represented by the first spatial attention weight map obtained when the input is the first normalized uncertainty map, and the second spatial attention weight map obtained when the input is the second normalized uncertainty map.
[0074] This embodiment introduces a continuous processing chain on the deep uncertainty distribution, including global maximum-minimum statistics, maximum-minimum normalization, unit numerical difference mapping, trainable scaling factor linear scaling, and logistic activation function. This chain stably transforms the first and second deep uncertainty maps into a first spatial attention weight map and a second spatial attention weight map. The weight value at each spatial location simultaneously reflects the magnitude of local uncertainty and the range of global numerical distribution. Furthermore, the steepness of the confidence curve is adaptively adjusted through a trainable scaling factor, thereby forming a smooth, differentiable spatial confidence weight distribution with well-defined upper and lower bounds. This provides structurally consistent and easily optimized weight inputs for subsequent feature modulation and similarity calculation based on deep reliability.
[0075] In one embodiment, step S50 includes: S501, determining the number of channels in the channel dimension of the first feature map and the second feature map; S502, performing a copy expansion operation on the first spatial attention weight map in the channel dimension with the number of channels as the target, generating an expanded first spatial attention weight map with the same channel dimension as the first feature map; S503, multiplying the expanded first spatial attention weight map element-wise with the first feature map to obtain a first modulation feature map; S504, performing the same copy expansion operation on the second spatial attention weight map with the number of channels as the target, as the first spatial attention weight map, to generate an expanded second spatial attention weight map; S505, multiplying the expanded second spatial attention weight map element-wise with the second feature map to obtain a second modulation feature map.
[0076] In this embodiment, the first spatial attention weight map and the first feature map need to be multiplied element-wise under a unified data structure to obtain the first modulation feature map. The first feature map and the second feature map are generally output as three-dimensional arrays by the previous network. Each array organizes data in terms of height, width, and channel dimensions, where the number of channels in the channel dimension represents the semantic or texture responses existing in parallel at the same spatial location. In order to ensure that the feature values at each spatial location and in each channel can obtain the corresponding spatial weights in subsequent operations, it is necessary to first determine the number of channels in the first and second feature maps in the channel dimension. This number can be obtained by reading the shape information of the feature tensor, or it can be obtained directly through the pre-configured parameters of the network structure, such as the number of output channels of the convolutional layer or the self-attention layer.
[0077] The first spatial attention weight map typically stores weight values at spatial locations in a two-dimensional layout, structurally containing only height and width dimensions. To ensure this spatial weight applies to all channels in the first feature map simultaneously, a copying and expansion operation is needed along the channel dimension. Specifically, a two-dimensional matrix identical to the spatial attention weight map can be allocated in memory for each channel. By repeating this matrix along the channel dimension, the expanded first spatial attention weight map maintains the same spatial weight distribution in height and width as the original, while matching the number of channels in the first feature map. This expansion can be implemented by explicitly copying to generate a new three-dimensional array, or by using a broadcast mechanism for implicit expansion during computation by the underlying computing library, logically equivalent to copying the same spatial weight for each channel.
[0078] After channel dimension expansion, the expanded first spatial attention weight map corresponds one-to-one with the first feature map in three dimensions. At this point, at each spatial and channel location, there exists a feature value and a spatial weight value, which can be multiplied element-wise. Element-wise multiplication refers to performing a one-to-one multiplication at exactly the same index position, calculating the product of the feature value and the weight value for each combination of pixel coordinates and channel index. After the calculation, the resulting first modulated feature map maintains the same size as the first feature map, but the values have been modulated by spatial weights. Through this process, lower weights in the first spatial attention weight map will correspondingly reduce the feature response at the corresponding spatial location and channel, while higher weights will retain or amplify these responses, thus reflecting spatial confidence information at the numerical level.
[0079] The processing of the second spatial attention weight map and the second feature map is consistent with the above process. First, using the same channel number parameter as the first feature map, the second spatial attention weight map is copied and expanded in the channel dimension, so that the expanded second spatial attention weight map matches the second feature map in height, width, and channel dimension. Using a uniform number of channels ensures that the two feature maps have the same channel organization in structure, which facilitates subsequent comparison and similarity calculation. After expansion, element-wise multiplication is performed on the expanded second spatial attention weight map and the second feature map, multiplying the feature value at each spatial and channel position by the corresponding spatial weight to obtain the second modulation feature map. By performing such spatial weighting processing on the two feature maps separately, the depth uncertainty can be mapped into specific spatial modulation factors and applied to each channel of the multi-channel semantic representation while keeping the overall network structure unchanged.
[0080] For example, the feature modulation formula guided by spatial attention is:
[0081] in, Let represent the feature map of the k-th image. When k=1, it corresponds to the first feature map, and when k=2, it corresponds to the second feature map. The spatial resolution is H×W, and the number of channels is C. This represents the spatial attention weight graph of the k-th path. Corresponding to the first spatial attention weight map, This corresponds to the second-space attention weight map. Indicates to The copy-and-expand result along the channel dimension allows each channel to share the same spatial weights, corresponding to the "channel-dimensional copy-and-expand operation". ⊙ represents the element-wise multiplication operator. This represents the modulation feature map of the k-th path. Corresponding to the first modulation feature map, Corresponding to the second modulation feature map, the feature vector of each spatial location is rescaled by the spatial attention weights.
[0082] This embodiment defines the number of channels in the first and second feature maps in the channel dimension, and performs a copying and expansion operation on the first and second spatial attention weight maps in the channel dimension to make the spatial weights and multi-channel features completely aligned in the three-dimensional structure. Based on this, the first and second modulation feature maps are generated by element-wise multiplication. Without introducing additional spatial displacement or channel mixing, the spatial confidence information obtained based on depth uncertainty can be accurately applied to the feature response of each channel. This simultaneously achieves consistent weighted suppression or enhancement of the features of the two images, providing lower noise and structurally aligned feature inputs for subsequent background similarity calculation.
[0083] In one embodiment, step S60 includes: S601, performing element-wise multiplication of the first spatial attention weight map and the second spatial attention weight map at the corresponding pixel positions in the spatial dimension to generate a joint spatial weight term; S602, determining the feature vector dot product of the first modulation feature map and the second modulation feature map at the corresponding pixel positions, performing a weighted multiplication of the feature vector dot product with the joint spatial weight term, and summing the result of the weighted multiplication across the entire image space to obtain a similarity numerator value; S603, determining the square of the feature vector magnitude of the first modulation feature map and the second modulation feature map at each pixel position, performing element-wise multiplication of the squared feature vector magnitude with the squared first spatial attention weight map and the squared second spatial attention weight map, and summing the result of the element-wise multiplication across the entire image space to obtain a first denominator term and a second denominator term; S604, determining the square root of the product of the first denominator term and the second denominator term as the similarity denominator value, and dividing the similarity numerator value by the similarity denominator value to obtain a background similarity score.
[0084] In this embodiment, the first modulation feature map and the second modulation feature map can be understood as three-dimensional feature arrays organized in the height, width, and channel dimensions. Each spatial location contains a feature vector in the channel direction, used to characterize the local background semantic information at that location. The first spatial attention weight map and the second spatial attention weight map can be understood as weight distributions on a spatial plane, providing a weight value between zero and one at each pixel coordinate, reflecting the reliability of the corresponding location under different viewpoints.
[0085] To highlight only the shared, trustworthy spatial regions between two images during similarity calculation, a joint spatial weight term needs to be constructed first. In implementation, the first and second spatial attention weight maps are multiplied element-wise at identical spatial coordinates, and the product of the two weight values is calculated for each pixel coordinate. The resulting joint spatial weight term remains a two-dimensional weight distribution, where each element corresponds to a spatial location. A larger value indicates that both images have a high attention response at that location, while a smaller value indicates that at least one image has a lower confidence level at that location. This joint spatial weight term acts as a global weight mask in subsequent calculations, controlling the contribution ratio of different spatial locations to the overall similarity.
[0086] After obtaining the joint spatial weight term, a similarity numerator needs to be constructed by combining the first and second modulation feature maps. For each spatial location, the feature vector at that location can be considered a mathematical vector along the channel dimension. The elements of the corresponding channels in the feature vectors of the first and second modulation feature maps are taken, and their dot products are calculated. The sum of these products across all channels yields the dot product value of the feature vector at that location. This dot product value is then multiplied by the weight value corresponding to that location in the joint spatial weight term, thus numerically binding the similarity contribution at that location to its spatial confidence level. The weighted results at all spatial locations are summed across the entire image space, and the weighted points of each pixel are accumulated and added to a scalar, resulting in the similarity numerator value. Therefore, the similarity numerator value can be understood as the result of a weighted accumulation of local feature vector similarities across the entire image plane under the guidance of the joint spatial weight term.
[0087] To construct the denominator for the weighted cosine similarity, the weighted norm information of the first and second modulation feature maps needs to be calculated separately. At each spatial location, the square of the magnitude of the feature vector at that location in the first modulation feature map is first calculated along the channel dimension. The values in each channel are squared and summed to obtain a scalar representing the energy magnitude of the first modulation feature map at that location. Correspondingly, the square of the magnitude of the feature vector at that location is calculated in the second modulation feature map to obtain the energy metric for the second path. Subsequently, the first spatial attention weight map is squared, taking the square of the weight value at each spatial location to emphasize the weighting effect of high-confidence regions; similarly, the second spatial attention weight map is squared to obtain another set of spatial weights.
[0088] After obtaining the squares of the feature vector magnitudes and the spatial weights after squared processing, for the branch related to the first modulation feature map, element-wise multiplication is performed at each spatial location. The square of the feature vector magnitude at that location is multiplied by the corresponding weight value after squared processing of the first spatial attention weight map. The products of all spatial locations are then summed across the entire graph space to obtain the first denominator. For the branch related to the second modulation feature map, the same method is used to multiply the square of the feature vector magnitude at that location by the corresponding weight value after squared processing of the second spatial attention weight map, and the products are summed across the entire graph space to obtain the second denominator. The first and second denominators thus reflect the energy scale of the two features across the entire graph under spatial weight modulation.
[0089] After determining the similarity numerator, the first denominator, and the second denominator, the similarity denominator can be further constructed. Specifically, the first denominator is multiplied by the second denominator to obtain a non-negative scalar. The square root of this product is then calculated to obtain the similarity denominator. This value corresponds to the product of the two weighted norms in the weighted cosine similarity form, and is used to normalize the weighted dot product in the numerator. Finally, scalar division is performed using the similarity numerator as the dividend and the similarity denominator as the divisor to obtain the background similarity score. The background similarity score numerically reflects the degree of consistency in the overall feature orientation of the two images under spatial confidence information constraints, fully integrating spatial attention information into the measurement process while maintaining the geometric meaning of cosine similarity.
[0090] For example, the formula for spatial attention-weighted cosine background similarity is:
[0091] in, , This represents the weight values of the first spatial attention weight map and the second spatial attention weight map at pixel position (i,j), used to construct the joint spatial weight term, corresponding to the "joint spatial weight term" and the squared weights in the denominator. This represents the channel vector of the first modulation feature map and the second modulation feature map at pixel position (i,j), corresponding to the "feature vector". , This represents the inner product operation between eigenvectors, used to characterize the consistency of local feature directions, corresponding to the "eigenvector dot product". The L2 norm of a vector is used to calculate the magnitude of an eigenvector, corresponding to "eigenvector magnitude". This represents the summation operation over the entire set of spatial locations, corresponding to "full-map spatial summation". Numerator term The numerator represents the similarity score. The summation terms within the two square roots of the denominator correspond to the "first denominator term" and the "second denominator term," respectively. Each term contains the product of the squared attention weight and the squared feature vector magnitude. S represents the final background similarity score, which is used for subsequent target task processing.
[0092] This embodiment constructs a joint spatial weight term to uniformly weight the common high-confidence regions of two images. In the numerator, it uses the dot product of feature vectors for weighted summation, and in the denominator, it uses the spatial weight squared norm to construct the first and second denominator terms. The square root of the product of the two terms forms the similarity denominator value. The entire weighted cosine similarity calculation process can fully inject the spatial attention information corresponding to the depth uncertainty into the background similarity score while maintaining the geometric properties of the cosine metric. This makes the similarity numerator and denominator values simultaneously constrained by the joint spatial weight, thereby reducing the impact of low-confidence regions on global similarity and improving the background similarity score's ability to identify the consistency of the real background structure.
[0093] In one embodiment, a depth-uncertainty-based image background matching device is provided, which corresponds one-to-one with the depth-uncertainty-based image background matching method in the above embodiments. Referring to Figure 3, Figure 3 is a functional module diagram of a preferred embodiment of the depth-uncertainty-based image background matching device of the present invention. The device includes an image feature extraction module 10, a depth prediction generation module 20, an uncertainty calculation module 30, a spatial attention weight generation module 40, a feature modulation module 50, a similarity calculation module 60, and a task processing module 70. Each functional module is described in detail below: The image feature extraction module 10 is used to acquire a first image and a second image to be compared, and input the first image and the second image into a feature extraction network to generate a first feature map and a second feature map respectively; the depth prediction generation module 20 is used to input the first feature map and the second feature map into a depth estimation network to obtain a first depth prediction set and a second depth prediction set respectively; the uncertainty calculation module 30 is used to determine a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set respectively; the spatial attention weight generation module 40 is used to convert the first depth uncertainty map and the second depth uncertainty map into a similarity calculation set. The uncertainty maps are input into the spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively. The feature modulation module 50 is used to multiply the first spatial attention weight map and the first feature map element-wise to obtain a first modulation feature map, and to multiply the second spatial attention weight map and the second feature map element-wise to obtain a second modulation feature map. The similarity calculation module 60 is used to determine a weighted cosine similarity based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score. The task processing module 70 is used to process the target task based on the background similarity score to obtain the target task result.
[0094] Specific limitations regarding the depth-deterministic image background matching device can be found in the aforementioned limitations of the depth-deterministic image background matching method, and will not be repeated here. Each module in the aforementioned depth-deterministic image background matching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0095] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram is shown in Figure 4. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The processor of the computer device provides determination and control capabilities. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a depth-uncertainty-based image background matching method on the server side.
[0096] In one embodiment, a computer device is provided, which can be a client, and its internal structure diagram is shown in Figure 5. The computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor of the computer device provides determination and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a depth-uncertainty-based image background matching method on the client side.
[0097] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: acquiring a first image and a second image to be compared; inputting the first image and the second image into a feature extraction network to generate a first feature map and a second feature map, respectively; inputting the first feature map and the second feature map into a depth estimation network to obtain a first depth prediction set and a second depth prediction set, respectively; determining a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set, respectively; inputting the first depth uncertainty map and the second depth uncertainty map into a spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively; multiplying the first spatial attention weight map element-wise with the first feature map to obtain a first modulation feature map; multiplying the second spatial attention weight map element-wise with the second feature map to obtain a second modulation feature map; determining a weighted cosine similarity based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score; and processing a target task based on the background similarity score to obtain a target task result.
[0098] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, it performs the following steps: acquiring a first image and a second image to be compared; inputting the first image and the second image into a feature extraction network respectively to generate a first feature map and a second feature map respectively; inputting the first feature map and the second feature map into a depth estimation network respectively to obtain a first depth prediction set and a second depth prediction set respectively; and determining a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set respectively. A deterministic map is generated; the first depth uncertainty map and the second depth uncertainty map are input into the spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively; the first spatial attention weight map is multiplied element-wise with the first feature map to obtain a first modulation feature map, and the second spatial attention weight map is multiplied element-wise with the second feature map to obtain a second modulation feature map; a weighted cosine similarity is determined based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score; the target task is processed based on the background similarity score to obtain the target task result.
[0099] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0100] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0101] It should be noted that if any software tools or components not belonging to this company appear in the embodiments of this application, they are merely illustrative examples and do not represent actual use. The embodiments described above are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
[0102] The user personal information involved in this application embodiment is all authorized (knowing and consenting) by the relevant parties or fully authorized by all parties, and the executing entity can obtain it through various open, legal and compliant means. The collection, storage, use, processing, transmission, provision and disclosure of the information, data and signals involved all comply with the relevant laws and regulations of the relevant countries and regions, and do not violate public order and good morals.
Claims
1. A method for image background matching based on depth uncertainty, characterized in that, Includes the following steps: A first image and a second image to be compared are acquired. The first image and the second image are respectively input into a feature extraction network to generate a first feature map and a second feature map. The first feature map and the second feature map are respectively input into a depth estimation network to obtain a first depth prediction set and a second depth prediction set. Based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set, a first depth uncertainty map and a second depth uncertainty map are determined respectively; the first depth uncertainty map and the second depth uncertainty map are respectively input into the spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map respectively; the first spatial attention weight map is multiplied element-wise with the first feature map to obtain a first modulation feature map, and the second spatial attention weight map is multiplied element-wise with the second feature map to obtain a second modulation feature map; Based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map, a weighted cosine similarity is determined to obtain a background similarity score; the target task is processed based on the background similarity score to obtain the target task result.
2. The image background matching method based on depth uncertainty as described in claim 1, characterized in that, The process involves acquiring a first image and a second image to be compared, inputting the first image and the second image into a feature extraction network to generate a first feature map and a second feature map, respectively. This includes: acquiring the first image and the second image to be compared; performing block processing on the first image and the second image to divide them into multiple non-overlapping image patches; projecting the image patches into high-dimensional feature embedding vectors as input sequences; processing the input sequences through the depth perception module of the feature extraction network to generate an initial depth estimation map; determining the scale coefficient of the image content based on the initial depth estimation map; dynamically configuring the window size parameter of the window self-attention mechanism in the feature extraction network according to the scale coefficient; and using the feature extraction network configured with the window size parameter to perform multi-level window self-attention processing and feature downsampling and merging operations on the input sequence to output a first feature map and a second feature map containing multi-scale semantic information, respectively.
3. The image background matching method based on depth uncertainty as described in claim 1, characterized in that, The first feature map and the second feature map are respectively input into a depth estimation network to obtain a first depth prediction set and a second depth prediction set, including: constructing a Bayesian depth estimation network containing a residual block encoder, a dilated convolutional bottleneck layer, and a transposed convolutional decoder, and embedding a random dropout layer in the dilated convolutional bottleneck layer or the transposed convolutional decoder of the Bayesian depth estimation network; inputting the first feature map into the Bayesian depth estimation network, and configuring the Bayesian depth estimation network in a random inference mode, so that the random dropout layer maintains the activation state of the neuron connection with a preset probability during the inference process; In the stochastic inference mode, the Bayesian depth estimation network is used to perform multiple repeated forward propagation processes on the first feature map, generating a temporary depth prediction result with random perturbation characteristics in each forward propagation process; all temporary depth prediction results output from the multiple repeated forward propagation processes are summarized to construct a first depth prediction set; the second feature map is input into the Bayesian depth estimation network in the stochastic inference mode, and the same number of repeated forward propagation processes as the first feature map are performed to generate multiple temporary depth prediction results with random perturbation characteristics, which are then summarized to construct a second depth prediction set.
4. The image background matching method based on depth uncertainty as described in claim 1, characterized in that, Based on the statistical variances of corresponding pixels in the first depth prediction set and the second depth prediction set, a first depth uncertainty map and a second depth uncertainty map are determined, including: for each pixel in the first depth prediction set, extracting multiple depth prediction values corresponding to the pixel in all depth prediction results; determining the arithmetic mean of the multiple depth prediction values to obtain a baseline depth value, and determining the square of the difference between each depth prediction value and the baseline depth value; determining the average of the squares of all differences to obtain the statistical variance of the pixel; determining the square root of the statistical variance to obtain the depth uncertainty value of the pixel; collecting the depth uncertainty values of all pixels to form a first depth uncertainty map; and repeating the steps of extraction, determining the average value, determining the square of the difference, determining the average value, and determining the square root for each pixel in the second depth prediction set to form a second depth uncertainty map.
5. The image background matching method based on depth uncertainty as described in claim 1, characterized in that, The process involves inputting the first depth uncertainty map and the second depth uncertainty map into a spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively. This includes: using the spatial confidence attention module to determine the first global maximum and first global minimum value in the first depth uncertainty map, and the second global maximum and second global minimum value in the second depth uncertainty map; performing max-min normalization on the first depth uncertainty map based on the first global maximum and first global minimum value to obtain a first normalized uncertainty map, and performing max-min normalization on the second depth uncertainty map based on the second global maximum and second global minimum value to obtain a second normalized uncertainty map; determining the difference between the unit value and the first normalized uncertainty map to obtain a first intermediate mapping value, and determining the difference between the unit value and the second normalized uncertainty map to obtain a second intermediate mapping value; using a trainable scaling factor in the spatial confidence attention module to perform linear scaling on the first intermediate mapping value and the second intermediate mapping value to obtain a first scaled mapping value and a second scaled mapping value; and inputting the first scaled mapping value and the second scaled mapping value into a logistic activation function for mapping processing to generate the first spatial attention weight map and the second spatial attention weight map.
6. The image background matching method based on depth uncertainty as described in claim 1, characterized in that, The process of multiplying the first spatial attention weight map element-wise with the first feature map to obtain a first modulation feature map, and multiplying the second spatial attention weight map element-wise with the second feature map to obtain a second modulation feature map, includes: determining the number of channels in the channel dimension of the first feature map and the second feature map; performing a copy-expansion operation on the first spatial attention weight map in the channel dimension with the number of channels as the target, generating an expanded first spatial attention weight map with the same channel dimension as the first feature map; performing an element-wise multiplication of the expanded first spatial attention weight map with the first feature map to obtain a first modulation feature map; performing the same copy-expansion operation on the second spatial attention weight map with the number of channels as the target, generating an expanded second spatial attention weight map; and performing an element-wise multiplication of the expanded second spatial attention weight map with the second feature map to obtain a second modulation feature map.
7. The image background matching method based on depth uncertainty as described in claim 1, characterized in that, Determining a weighted cosine similarity based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score includes: performing element-wise multiplication of the first spatial attention weight map and the second spatial attention weight map at corresponding pixel positions in the spatial dimension to generate a joint spatial weight term; determining the feature vector dot product of the first modulation feature map and the second modulation feature map at corresponding pixel positions, performing a weighted multiplication of the feature vector dot product with the joint spatial weight term, and summing the result of the weighted multiplication across the entire image space. Obtain the similarity numerator value; determine the square of the feature vector magnitude of the first modulation feature map and the second modulation feature map at each pixel position, and perform element-wise multiplication of the square of the feature vector magnitude with the squared first spatial attention weight map and the squared second spatial attention weight map, respectively, and sum the results of the element-wise multiplication across the entire image space to obtain the first denominator and the second denominator; determine the square root of the product of the first denominator and the second denominator as the similarity denominator value, and divide the similarity numerator value by the similarity denominator value to obtain the background similarity score.
8. An image background matching device based on depth uncertainty, characterized in that, The image background matching device based on depth uncertainty includes: an image feature extraction module, used to acquire a first image and a second image to be compared, and input the first image and the second image into a feature extraction network to generate a first feature map and a second feature map respectively; a depth prediction generation module, used to input the first feature map and the second feature map into a depth estimation network to obtain a first depth prediction set and a second depth prediction set respectively; an uncertainty calculation module, used to determine a first depth uncertainty map and a second depth uncertainty map based on the statistical variance of corresponding pixels in the first depth prediction set and the second depth prediction set respectively; and a spatial attention weight generation module, used to combine the first depth uncertainty map and the second depth prediction set into a spatial attention weight generation network. The second depth uncertainty map is input into the spatial confidence attention module to generate a first spatial attention weight map and a second spatial attention weight map, respectively. The feature modulation module is used to multiply the first spatial attention weight map and the first feature map element-wise to obtain a first modulation feature map, and to multiply the second spatial attention weight map and the second feature map element-wise to obtain a second modulation feature map. The similarity calculation module is used to determine a weighted cosine similarity based on the first modulation feature map, the second modulation feature map, the first spatial attention weight map, and the second spatial attention weight map to obtain a background similarity score. The task processing module is used to process the target task based on the background similarity score to obtain the target task result.
9. A computer device, characterized in that, The computer device includes a memory, a processor, and a depth-deterministic image background matching program stored in the memory and executable on the processor, wherein the depth-deterministic image background matching program, when executed by the processor, implements the steps of the depth-deterministic image background matching method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a depth-deterministic image background matching program, which, when executed by a processor, implements the steps of the depth-deterministic image background matching method as described in any one of claims 1-7.