Method and device for constructing binocular training sample, electronic equipment and computer readable storage medium
By scaling the relative and absolute disparities of monocular images, a right view is generated and the hole regions are filled in, solving the problem of insufficient training sample quality in existing binocular technologies and achieving efficient training of binocular stereo matching models.
Patent Information
- Application Number
- CN202611299471.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies struggle to construct high-quality binocular training samples in the absence of real binocular data, resulting in poor training performance of binocular stereo matching models. Furthermore, existing solutions suffer from disparity scales that are not adapted to different shooting distances and scene depth distributions.
By acquiring the relative and absolute disparity of monocular images, scale alignment is performed, forward mapping is used to generate a right view, hole regions are filled in, and fusion processing is performed to construct high-quality binocular training samples.
In the absence of real stereo data, high-quality samples that can be used for training stereo matching models are generated, reducing data acquisition costs and improving training results.
Smart Images

Figure CN123160992A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for constructing binocular training samples. Background Technology
[0002] In recent years, robots and industrial vision systems have increasingly relied on depth information for perception, localization, and interaction. Traditional RGB-D solutions can directly acquire depth, but they are constrained by limitations in working distance, equipment cost, active emission limitations, and cross-device calibration. In contrast, binocular stereo matching recovers depth by estimating the disparity between the left and right views, making it more versatile in long-distance and passive imaging scenarios. However, high-performance binocular stereo matching models heavily rely on large-scale, high-quality training data, while true binocular depth values are difficult to obtain at low cost and on a large scale. Furthermore, existing methods for generating binocular training samples from monocular images suffer from the following problems: the initial disparity only has a relative scale or depends on a preset maximum disparity range, making it difficult to adapt to different shooting distances, different fields of view, and different scene depth distributions; secondly, it may rewrite local textures and geometric alignment relationships, thus affecting subsequent model training. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, and computer-readable storage medium for constructing binocular training samples, which can construct binocular training samples with higher geometric consistency and integrity in the absence of real binocular data, thereby improving the training effect of subsequent binocular stereo matching models.
[0004] The technical solution of this application embodiment is implemented as follows: This application provides a method for constructing binocular training samples, including: Acquire a monocular image and determine the relative disparity and absolute disparity of the monocular image; The relative disparity and the absolute disparity are scale-aligned to obtain the target disparity; Based on the target disparity, the monocular image is forward-mapped to obtain the initial result of the right view; The hole areas in the initial result of the right view are filled in to obtain the filled right view, and the initial result of the right view and the filled right view are merged to obtain the composite right image; Based on the monocular image and the synthesized right image, a binocular training sample is constructed.
[0005] This application provides an apparatus for constructing binocular training samples, comprising: The acquisition module is used to acquire monocular images; The determination module is used to determine the relative disparity and absolute disparity of the monocular image; An alignment module is used to perform scale alignment on the relative disparity and the absolute disparity to obtain the target disparity; The mapping module is used to perform forward mapping on the monocular image based on the target disparity to obtain the initial result of the right view; The completion module is used to complete the image of the hole area in the initial result of the right view to obtain the completed right view; The fusion module is used to fuse the initial result of the right view and the completed right view to obtain a composite right image; A construction module is used to construct binocular training samples based on the monocular image and the synthesized right image.
[0006] This application provides an electronic device, including: Memory is used to store executable instructions for a computer; The processor, when executing computer-executable instructions stored in the memory, implements the method for constructing binocular training samples provided in the embodiments of this application.
[0007] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method for constructing binocular training samples provided in this application.
[0008] This application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements the method for constructing binocular training samples provided in this application.
[0009] The embodiments of this application have the following beneficial effects: First, the target disparity is obtained by scaling the relative and absolute disparities of the monocular image, thereby improving the scale consistency and accuracy of the disparity results. Then, the initial result of the right view is generated by forward mapping the monocular image based on the target disparity, and the hole regions are filled and fused to improve the integrity and geometric rationality of the synthesized right image. Finally, binocular training samples are constructed based on the monocular image and the synthesized right image. This can generate samples that can be used for training binocular stereo matching models when real binocular data is lacking, reducing data acquisition costs and improving the quality of training samples and model training effect. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of the architecture of the binocular training sample construction system 100 provided in this application embodiment; Figure 2 This is a schematic diagram of the structure of the electronic device 500 provided in the embodiments of this application; Figure 3This is a first flowchart illustrating the method for constructing binocular training samples provided in an embodiment of this application; Figure 4 This is a second flowchart illustrating the method for constructing binocular training samples provided in an embodiment of this application; Figure 5 This is a schematic diagram of the third process of the method for constructing binocular training samples provided in the embodiments of this application; Figure 6 This is a schematic diagram illustrating the process of constructing binocular training samples according to an embodiment of this application. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0012] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0013] It is understood that in the embodiments of this application, data such as user information are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0014] In the following description, the terms “first, second, ...” are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first, second, ...” may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0015] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0016] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0017] 1) Monocular image: refers to an image containing two-dimensional planar color and texture information of a scene, acquired using a single camera or a single-channel optical sensor. In 3D reconstruction technology, monocular images lack direct physical observations of depth or parallax, requiring deep learning or geometric prior models to deduce their 3D structure.
[0018] 2) Binocular stereo matching: This refers to the process of finding the corresponding pixels of the same physical 3D point in the two images (usually the left and right views) with a known relative positional relationship, and then calculating the horizontal projection position deviation (i.e., parallax) between the corresponding points in the two images, in order to recover the 3D geometric depth information of the scene.
[0019] 3) Parallax: refers to the horizontal pixel distance deviation between the projection points of the same physical 3D point on the left and right images of a binocular camera imaging system. Parallax is inversely proportional to the depth of the physical 3D point in the scene (i.e., the distance from the camera) and is a key geometric label for training binocular stereo matching models.
[0020] 4) Target disparity: refers to the disparity map that is output by the binocular data generation link in this embodiment of the application and is used as a reference ground truth or pseudo-label for the binocular stereo matching model to be trained. It is usually generated initially from monocular images through geometric or model inference and is used to guide the model to be trained to learn the geometric alignment relationship between the left and right images.
[0021] 5) Scale alignment: This refers to the process of converting and unifying the numerical distribution range of a disparity / depth map to the real physical scale space represented by another disparity / depth map by calculating the scaling factor and translation parameters, since different depth evaluation models may output geometric data with relative scale (without physical units) or different absolute scales.
[0022] 6) Forward mapping: This refers to an image projection technique that, based on known image geometric disparity values, horizontally shifts each pixel in a reference image (e.g., the left view) in the projection direction (e.g., the right side) according to the corresponding disparity value, thereby reconstructing the initial target view (e.g., the right view) from the target's perspective. Due to occlusion and disparity discontinuity, the forward-mapped view often produces some missing pixels (i.e., holes).
[0023] In implementing the embodiments of this application, the applicant discovered that existing schemes for generating binocular training data from monocular images typically employ the following technical approach: first, an initial geometry is predicted using a monocular depth or disparity model; then, a right-view prototype is generated through forward mapping; texture is restored for occluded hole regions using diffusion-based image completion; and training stability and image quality are improved through fusion or confidence mechanisms. However, this scheme has at least three problems. First, the initial disparity only has a relative scale or depends on a preset maximum disparity range, making it difficult to adapt to different shooting distances, different fields of view, and different scene depth distributions. Second, although the image completion module can restore holes, it may also rewrite the local texture and geometric correspondence, affecting subsequent training. Third, unreliable regions inevitably exist during the pseudo-label generation process; if these regions directly participate in training, they can easily reduce model performance.
[0024] In view of this, embodiments of this application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for constructing binocular training samples. These methods can obtain reasonable absolute scale constraints while preserving relative disparity details as much as possible, and suppress completion artifacts and pseudo-label noise in the right view generation and training supervision stages, thereby constructing high-quality binocular training data more suitable for business scenarios. The electronic device provided in the embodiments of this application is described below. The electronic device provided in the embodiments of this application can be implemented as a server or as a terminal device.
[0025] In some embodiments, see Figure 1 , Figure 1 This is a schematic diagram of the architecture of the binocular training sample construction system 100 provided in the embodiments of this application, as shown below. Figure 1 As shown, the binocular training sample construction system 100 provided in this application embodiment includes: server 200, network 300 and terminal device 400 (e.g., robot), wherein network 300 can be a local area network or a wide area network, or a combination of the two.
[0026] For example, server 200 can first acquire a monocular image and use a first monocular geometric estimation model to obtain the relative disparity of the monocular image. Then, it can use a second monocular depth estimation model to obtain the absolute disparity of the monocular image. Afterward, server 200 can perform scale alignment on the relative and absolute disparities to obtain a target disparity that combines local detail with global scale consistency. After obtaining the target disparity, server 200 can perform forward mapping on the monocular image based on the target disparity to obtain an initial right view result with hole regions. Subsequently, server 200 can perform image completion on the hole regions in the initial right view result to obtain a completed right view, and then fuse the completed right view and the initial right view result to obtain a synthesized right image. Finally, server 200 can construct binocular training samples based on the monocular image and the synthesized right image. These binocular training samples can be used to train a binocular stereo matching model. After training is completed, server 200 can send the trained stereo matching model to terminal device 400 via network 300, so that the trained stereo matching model can be deployed locally on terminal device 400.
[0027] Of course, the method for constructing binocular training samples provided in this application embodiment can also be implemented by the terminal device 400 alone. For example, the terminal device 400 can construct binocular training samples from monocular images based on its own computing power. This application embodiment does not specifically limit this.
[0028] The structure of the electronic device provided in the embodiments of this application will be further described below. Taking the electronic device as a terminal device as an example, see... Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device 500 provided in the embodiments of this application. Figure 2 The illustrated electronic device 500 includes at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to implement communication between these components. In addition to a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 540.
[0029] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0030] User interface 530 includes one or more output devices 531 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0031] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices physically located away from the processor 510.
[0032] The memory 550 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 550 described in this application embodiment is intended to include any suitable type of memory.
[0033] In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0034] Operating system 551 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 552 is used to reach other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. Presentation module 553 is used to enable the presentation of information (e.g., user interface for operating peripheral devices and displaying content and information) via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with user interface 530. The input processing module 554 is used to detect and translate one or more user inputs or interactions from one or more input devices 532.
[0035] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2A device 555 for constructing binocular training samples stored in memory 550 is shown. This device can be software in the form of programs and plug-ins, including the following software modules: acquisition module 5551, determination module 5552, alignment module 5553, mapping module 5554, completion module 5555, fusion module 5556, construction module 5557, and training module 5558. These modules are logically linked and can therefore be arbitrarily combined or further split according to their implemented functions. It should be noted that... Figure 2 For ease of explanation, all the above modules are shown at once, but this should not be considered as an exclusion of the implementation of the binocular training sample construction device 555, which may only include the acquisition module 5551, determination module 5552, alignment module 5553, mapping module 5554, completion module 5555, fusion module 5556 and construction module 5557. The functions of each module will be explained below.
[0036] The method for constructing binocular training samples provided in this application will be specifically described below with reference to exemplary applications and implementations of the electronic devices provided in the embodiments of this application.
[0037] For example, see Figure 3 , Figure 3 This is a first flowchart illustrating the method for constructing binocular training samples provided in this application embodiment, which will be combined with... Figure 3 The steps shown are explained.
[0038] In step 101, a monocular image is acquired.
[0039] In some embodiments, raw monocular images can first be read from a preset monocular data source. This data source may include images captured in real-time by industrial field cameras, scene images captured by a robot's vision perception system, images captured by an autonomous vehicle's onboard camera, or images extracted from a public dataset. The read raw monocular images can then be uniformly converted to a preset color space and resolution, and channel normalization processed to obtain a standard monocular image (i.e., a standard monocular left view) that meets the requirements of subsequent model input.
[0040] It should be noted that, to ensure the stability of subsequent geometric estimation and image completion processes and to avoid interference from low-quality or abnormal samples in pseudo-label generation, this embodiment can also perform quality detection on the acquired monocular image. For example, the sharpness gradient value of the monocular image can be calculated using the Laplacian operator or frequency domain Fourier transform. When the sharpness gradient value is determined to be lower than a preset blur threshold, the monocular image is considered to have severe motion blur or distortion, and the monocular image is automatically removed. Alternatively, a border detection algorithm or a text / watermark recognition model can be used to scan the monocular image. When text annotations, occluded watermarks, or graphic overlays with an area exceeding a preset ratio are detected in the image, the monocular image can be automatically removed. Alternatively, the presence of black borders, overexposed black holes, severely distorted or damaged areas, or camera sensor dead pixels can be detected at the edges of the monocular image. When abnormal borders are determined to exist, the monocular image can be removed.
[0041] In step 102, the relative disparity and absolute disparity of the monocular image are determined.
[0042] In some embodiments, see Figure 4 , Figure 4 This is a schematic diagram of the second process of the method for constructing binocular training samples provided in the embodiments of this application, as shown below. Figure 4 As shown, Figure 3 Step 102 shown can be achieved through Figure 4 The implementation of steps 1021 and 1022 shown will be combined with Figure 4 The steps shown are explained.
[0043] In step 1021, geometric estimation is performed on the monocular image to obtain relative geometric information characterizing the relative distance relationship of pixels, and the relative disparity of the monocular image is determined based on the relative geometric information.
[0044] In some embodiments, a monocular image, after pre-processing quality inspection and format normalization, can be input into a pre-trained first monocular geometric estimation model. This first model can employ a monocular depth / disparity estimation baseline model pre-trained on a large-scale monocular image dataset. The first monocular geometric estimation model can extract high-order semantic features and local texture features from the monocular image using a deep convolutional neural network, capturing the relative distances between different objects in the image, occlusion edges, and fine-grained geometric details. Subsequently, the first monocular geometric estimation model can output pixel-level relative geometric information based on the above, whereby the relative geometric information can accurately characterize the relative distance levels and material boundaries between individual pixels in the image. If the relative geometric information output by the first monocular geometric estimation model is a relative depth prior, its reciprocal transformation can be performed to obtain the relative disparity of the monocular image.
[0045] In step 1022, depth estimation is performed on the monocular image to obtain depth information with absolute scale, and the absolute disparity of the monocular image is determined based on the depth information.
[0046] In some embodiments, the above-mentioned determination of the absolute disparity of a monocular image based on depth information can be achieved by: obtaining the imaging parameters corresponding to the monocular image; performing disparity conversion on the depth information according to the imaging parameters to obtain the absolute disparity of the monocular image.
[0047] For example, a monocular image that has undergone pre-processing quality inspection and format normalization can be input into a pre-trained second monocular depth estimation model. This second monocular depth estimation model can be a monocular depth estimation neural network model with absolute physical scale prediction capabilities. The second monocular depth estimation model can perform global geometric structure inference on the monocular image, directly outputting a pixel-level absolute depth map containing the true physical absolute scale (e.g., in meters). Each pixel value in this absolute depth map represents the true physical distance between the corresponding object and the camera imaging plane. To convert the absolute physical depth into pixel parallax conforming to stereo imaging geometry, embodiments of this application can also obtain imaging parameters corresponding to the input monocular image (e.g., camera focal length parameters and preset binocular baseline length). For example, when the camera intrinsic parameters are known, the focal length parameters can be directly read from the calibration metadata attached to the monocular image; when there are no camera intrinsic parameters input, the estimated focal length parameters of the monocular image are predicted simultaneously while using the second monocular depth estimation model to predict the depth. Subsequently, based on the acquired focal length parameters and preset baseline length, the disparity transformation coefficients under the current imaging configuration can be calculated. Finally, using the disparity transformation coefficients, the depth values of each pixel in the absolute depth map can be transformed and scaled based on the principles of 3D projection geometry, thus obtaining the absolute disparity map of the monocular image. This provides a precise global physical scale constraint to the disparity space, avoiding the geometric distortion problem caused by relying on a fixed maximum disparity range in traditional generation schemes. It also provides an accurate global scale reference for subsequent adaptive least-squares fitting alignment with high-detail relative disparity.
[0048] In step 103, the relative disparity and absolute disparity are scale-aligned to obtain the target disparity.
[0049] In some embodiments, step 103 can be implemented as follows: establishing a mapping fitting equation between relative disparity and absolute disparity; solving the mapping fitting equation to obtain mapping parameters; and performing a linear mapping transformation on the relative disparity based on the mapping parameters to obtain a target disparity that combines local detail with global scale consistency.
[0050] For example, after obtaining a relative disparity map representing high-precision local structural details and an absolute disparity map with a global absolute physical scale, since they exist in different disparity numerical spaces, an adaptive linear mapping fitting equation can first be established between them. To ensure that the mapped disparity map best approximates the absolute disparity distribution globally while resisting noise interference from individual abnormal pixels, a least-squares fitting algorithm can be used to optimize the mapping fitting direction, obtaining mapping parameters (e.g., optimal scale scaling factor and optimal offset parameter). Subsequently, using the obtained mapping parameters, an adaptive linear mapping transformation can be performed on each pixel value in the relative disparity map to calculate the target disparity value for the corresponding pixel. Finally, multiple target disparity values can be combined to obtain the target disparity map. Thus, the generated target disparity map inherits the relative disparity map's highly expressive ability for fine-grained physical edges, rich texture structures, and relative distance relationships, while successfully being given a true physical scale constrained by the absolute disparity map. It overcomes the geometric stretching distortion problem caused by the reliance on a fixed preset maximum parallax range in traditional solutions, and can adaptively match the parallax distribution of real business scenarios under different shooting distances and different fields of view, providing a high-quality geometric foundation for subsequent forward mapping and right view synthesis.
[0051] In step 104, the monocular image is forward-mapped according to the target disparity to obtain the initial result of the right view.
[0052] In some embodiments, step 104 can be implemented as follows: Based on the target parallax, establish a projection mapping relationship between each pixel in the monocular image and the target viewing angle (referring to the observation view to be generated that is constructed by parallax projection during the three-dimensional spatial geometric reconstruction or viewing angle transformation process and has a known relative position with the source viewing angle; for example, it can refer to the visual observation angle of the right view to be synthesized and constructed when performing forward projection mapping on the monocular left view based on the target parallax); perform forward projection mapping on the monocular image based on the projection mapping relationship to obtain the initial result of the right view with the hole region.
[0053] For example, after obtaining a target disparity map that combines local geometric details with global absolute scale consistency, the input monocular image can be used as the source view image, and the synthesized right image to be constructed can be used as the target view image. Then, based on the epipolar constraint geometry principle of parallel binocular stereo imaging, a forward projection mapping relationship can be established from any pixel in the source view image to the corresponding pixel in the target view image. That is, the horizontal coordinate in the target view image is equal to the horizontal coordinate in the source view image minus the target disparity value at the corresponding position, while the vertical coordinate remains the same as the vertical coordinate in the source view image. Subsequently, each pixel in the source view image can be traversed, and according to the forward projection mapping relationship, its corresponding pixel value can be filled into the corresponding mapped coordinate position in the initial result image of the right view. When multiple different pixels in the left image are mapped to the same pixel coordinate in the initial result image of the right view (i.e., a parallax overlap conflict occurs where the foreground occludes the background), a competition can be made based on the magnitude of the parallax value. Since a larger parallax value indicates a closer distance to the lens, the foreground pixel value corresponding to the larger parallax value can be retained first, and the occluded background pixels that failed to compete can be covered, thus geometrically accurately representing the parallax occlusion relationship between the foreground and the background. After the forward projection mapping is completed, due to parallax overlap occlusion and the pop-out effect caused by the change of viewing angle (i.e., the background that was originally occluded becomes visible in the right image after the change of viewing angle), blank pixels (i.e., empty areas) will be generated in the initial result image of the right view where no pixels from the left image are mapped to.
[0054] In step 105, the hole area in the initial result of the right view is image-completed to obtain the completed right view.
[0055] In some embodiments, step 105 can be implemented by: extracting the contextual features and appearance structure of the monocular image; using the contextual features and appearance structure to fill the empty areas in the initial result of the right view to obtain a completed right view containing complete geometry and visually continuous texture.
[0056] For example, after obtaining the initial result of the right view with hole regions, the original input monocular image (e.g., the monocular left view) can be used as a reference image for high-order semantic and visual feature extraction. Specifically, a reference feature extraction network can be used to perform multi-scale convolution or self-attention feature mapping on the monocular left view to extract fine-grained edges, local texture patterns, color distribution, and high-frequency visual structure features of objects in the monocular left view. Simultaneously, the spatial relative positions of different objects in the monocular left view, scene semantic categories, and overall lighting environment information can also be extracted to form a contextual feature representation of the global scene geometry and semantic environment. Then, based on the occlusion-related mask generated during the aforementioned forward projection mapping process, the hole regions and invalid projected pixels caused by viewpoint occlusion and outcrop effects in the initial result of the right view can be accurately located. During image completion, the extracted monocular left view appearance structure features and global contextual features can be used as conditional guidance information and injected into the denoising generation network. Through a feature cross-attention mechanism, the completion process can explicitly perceive the structural and textural priors in the source view (i.e., the monocular left view). In other words, the denoising generation network targets the empty areas indicated by the occlusion-related masks as the filling regions. Under the precise constraints of the appearance structure and contextual features of the monocular left view, it progressively generates content that highly matches the surrounding known areas in terms of geometric structure, color distribution, and lighting texture. The completion process not only fills in the missing color information in the empty areas but also reasonably infers the complete 3D outline of the occluded object and the extended texture of the background based on the contextual semantics, effectively eliminating edge artifacts and structural breaks caused by forward mapping. The final output is a completed right view containing complete geometric structure and visually continuous texture.
[0057] In step 106, the initial result of the right view and the completed right view are merged to obtain the composite right view.
[0058] In some embodiments, step 106 can be implemented as follows: generate a pixel-level fusion weight map based on the initial result of the right view and the completed right view; perform pixel-level weighted fusion on the initial result of the right view and the completed right view based on the pixel-level fusion weight map to obtain a composite right image.
[0059] For example, after generating the initial and completed right view results, the aforementioned multi-source data can be concatenated and fused along the channel dimension to construct an input feature tensor, which is then input into a pixel-level weight prediction network. The pixel-level weight prediction network performs pixel-by-pixel structural consistency and illumination continuity analysis on the input initial and completed right view results. Next, the pixel-level weight prediction network outputs a pixel-level fusion weight map with the same spatial dimensions as the input image. Each pixel value in this pixel-level fusion weight map (normalized to between 0 and 1) represents the weight proportion of the initial right view result at the corresponding pixel location, while 1 minus this value represents the weight proportion of the completed right view. Furthermore, the pixel-level weight prediction network can automatically assign extremely high fusion weights to the initial right view result (e.g., values close to 1) to maximize the preservation of the original pixel and color features obtained by forward projection of the monocular left view through true geometric relationships. After generating the pixel-level fusion weight map, all pixel coordinates can be traversed. Based on the weight value of the corresponding position in the pixel-level fusion weight map, a pixel-by-pixel weighted summation calculation is performed on the pixel color values of the initial result of the right view and the pixel color values of the completed right view. After the weighted fusion calculation is completed, the final synthesized right image is output. In this way, the shortcomings of the forward projection mapping method, which is prone to producing holes, are overcome, and the problems of losing real projection details and causing geometric shifts that are easily caused by relying solely on the generative completion model are avoided. It achieves an adaptive effect of prioritizing the preservation of real geometric pixels in reliable projection areas and seamlessly filling continuous textures in hole areas, which greatly improves the geometric consistency and visual realism of the synthesized binocular image.
[0060] In step 107, a binocular training sample is constructed based on the monocular image and the synthesized right image.
[0061] In some embodiments, see Figure 5 , Figure 5 This is a schematic diagram of the third process of the method for constructing binocular training samples provided in the embodiments of this application, as shown below. Figure 5 As shown, after execution Figure 3 After step 107 shown, you can also execute... Figure 5 Steps 108 to 110 shown will combine Figure 5 The steps shown are explained.
[0062] In step 108, the binocular training samples are input into the binocular stereo matching model to be trained to obtain the predicted disparity.
[0063] In some embodiments, after obtaining the original monocular left view (i.e., monocular image), the target disparity map obtained through adaptive scale alignment, the synthesized right image generated by fusion, and the corresponding generated confidence map and the mask of the unoccluded region of the left image, the above data can be combined to construct a complete stereo matching training sample pair. Then, the monocular left view can be used as the left-view input image for stereo matching, and the synthesized right image can be used as the right-view input image for stereo matching to form a stereo image pair to be trained. In addition, the target disparity map can be bound as the ground truth pseudo-label of the disparity of the stereo image pair. At the same time, the previously calculated and constructed pixel-level confidence map and the mask of the unoccluded region of the left image can be used as the corresponding loss weighting matrix and selection constraints, and fed into the training pipeline. Subsequently, the constructed monocular left view and the synthesized right image can be sequentially input into the stereo matching model to be trained. Through feature extraction, cost volume construction, and disparity regression processing within the model, the model outputs the predicted disparity map generated by the model for the current stereo image pair.
[0064] In step 109, the disparity supervision loss is determined based on the difference between the predicted disparity and the target disparity.
[0065] In some embodiments, after obtaining the predicted disparity map, the absolute deviation or smoothed absolute deviation between the predicted disparity value at each pixel position in the predicted disparity map and the target disparity value at the corresponding position in the target disparity map used as a pseudo-label can be calculated to obtain the basic disparity loss (i.e., disparity supervision loss).
[0066] In step 110, the disparity supervision loss is weighted based on the confidence map to obtain the weighted disparity supervision loss.
[0067] In some embodiments, after obtaining the basic disparity loss, a pixel-by-pixel multiplicative weighted calculation can be performed on the basic disparity loss using a pixel-level confidence map to obtain a confidence-weighted disparity supervision loss. In unreliable regions (i.e., pixels with low confidence values) where artifacts are introduced due to monocular prior errors or image generation and completion processes, their weight in the disparity loss is explicitly reduced by using a lower weighting coefficient, thereby effectively suppressing the negative interference of pseudo-label noise and synthetic artifacts on model parameter updates.
[0068] It should be noted that the confidence map can be used to evaluate the reliability of the monocular geometric estimation prior pixel by pixel, avoiding unreliable pseudo-label noise from interfering with the training of the binocular stereo matching model. The specific generation process is as follows: The input original monocular left view is horizontally mirrored, generating a horizontally flipped image. Next, the original monocular left view is input into the geometric estimation process to obtain the relative geometric estimation result under the original viewpoint. Simultaneously, the horizontally flipped image is input into the same geometric estimation process to obtain the relative geometric estimation result under the flipped viewpoint. The relative geometric estimation result under the flipped viewpoint is then horizontally flipped in reverse, aligning its pixel coordinates back to the coordinate system of the original monocular left view. The absolute deviation between the relative geometric prediction value under the original viewpoint and the coordinate-aligned reverse-flipped geometric prediction value is calculated pixel by pixel. Subsequently, a mapping relationship between the geometric deviation and the confidence value can be established. For example, the smaller the prediction deviation at a certain pixel position, the stronger the consistency and stability of that position under geometric transformation, and it is assigned a high confidence value close to 1; conversely, the larger the deviation, the lower the confidence value close to 0. Finally, the confidence scores of all pixels in the entire image are output as a pixel-level matrix with the same spatial scale as the monocular left view, thus obtaining the pixel-level confidence map.
[0069] In step 111, a total loss is constructed based on the weighted disparity supervision loss and the true pixel consistency loss, and the parameters of the stereo matching model are updated based on the total loss.
[0070] In some embodiments, to enhance the model's supervision of geometrically true matching regions while reducing the impact of unreliable pseudo-labels, this application embodiment can further introduce true pixel correspondence constraints. For example, based on the mask of the unoccluded region in the left image, the unoccluded true pixel regions that were not completed and rewritten during the forward projection mapping process and belong to those successfully mapped directly from the left image to the right image can be accurately extracted. Only within the unoccluded true pixel regions, the reconstruction error or photometric consistency loss between the pixel color features of the monocular left view and the pixel color features at the corresponding mapping position in the synthesized right image is calculated as the true pixel consistency loss. This loss does not depend on the predicted disparity pseudo-label values, but directly applies photometric and feature reconstruction constraints to strictly matched true pixel pairs based on 3D geometric projection. Subsequently, the calculated confidence-weighted disparity supervision loss can be linearly summed with the true pixel consistency loss multiplied by a preset weight coefficient, and combined to construct the total loss function for the current training iteration. Finally, gradient backpropagation can be performed based on the calculated total loss function, and the optimizer can be used to iteratively update the network parameters of each layer in the stereo matching model. In this way, through the above training supervision mechanism, when the model faces synthetic stereo data generated by monoculars, it can not only avoid the pitfalls of pseudo-label noise and generation artifacts through confidence weighting, but also obtain strong supervised gradients in the real pixel area that strictly conforms to the geometric projection, which significantly improves the generalization ability and disparity estimation accuracy of the stereo matching model in real scenes.
[0071] It should be noted that the non-occluded area mask in the left image can be used to explicitly distinguish which pixels belong to the real, reliable pixels obtained by direct forward projection from the monocular left view, and which belong to the non-real pixels generated and completed. The specific generation process is as follows: Based on the target disparity map obtained after adaptive scale alignment, the target coordinates of each pixel in the monocular left view when reprojected into the right view space are calculated. Then, according to the principle of parallel binocular epipolar geometry, each pixel in the monocular left view is tracked pixel-by-pixel to see if it can be mapped to the right view space without conflict. If some pixel positions in the right view space do not receive any projection mapping from the monocular left view, or are determined to be occluded background in a conflict of multiple points mapping to the same point, these positions can be marked as occluded or empty areas. If a pixel in the monocular left view is successfully and uniquely mapped into the right view space, is not occluded by closer foreground objects, and does not exceed the view edge boundary, then this pixel can be considered a non-occluded real pixel. Subsequently, a binarization matrix with the same size as the input image can be constructed. For example, the positions that are determined to be non-occluded real pixels can be assigned a value of 1, and the positions that are determined to be occluded holes or artifact regions can be assigned a value of 0. Outputting this binarization matrix will yield the mask of the non-occluded region in the left image.
[0072] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0073] The method for constructing binocular training samples provided in this application can be applied to industrial scenarios, robotic scenarios, and other scenarios that require automatic construction of binocular training samples from monocular images. It can be used for offline data production as well as for pre-training, fine-tuning, and distillation training data construction of binocular stereo matching models.
[0074] The method for constructing binocular training samples provided in the embodiments of this application will be described in detail below.
[0075] In some embodiments, see Figure 6 , Figure 6 This is a schematic diagram illustrating the process of constructing binocular training samples according to an embodiment of this application, as shown below. Figure 6 As shown, the method for constructing binocular training samples provided in this application mainly includes the following three stages: monocular geometric prior construction and scale alignment; generation of the right view based on forward mapping, diffusion completion, and fusion; input image quality control and training stage supervision constraints. The above three stages are described in detail below.
[0076] (I) Monocular geometric prior construction and scale alignment In some embodiments, for an input monocular image (e.g., a left view), a first monocular geometric estimation model can be used to obtain a relative disparity or relative depth prior. This prior has good expressive power for local edges, structural details, and relative distance relationships, but lacks a unified absolute scale. Next, a second monocular depth estimation model can be used to obtain depth information with an absolute scale, and when available, focal length information and a preset baseline length can be combined to convert the depth information into an absolute disparity prior. Subsequently, least-squares alignment or equivalent scale fitting can be performed on the relative disparity prior and the absolute disparity prior to obtain mapping parameters from the relative disparity to the absolute disparity space. Mapping is then performed based on these mapping parameters to obtain a target disparity map that combines relative detail and global scale consistency. Compared to a fixed maximum disparity range, this embodiment can adaptively generate a more reasonable disparity scale based on the scene depth distribution of the current image, reducing the disparity distribution deviation between synthetic training data and real business data. Furthermore, geometric estimation can be performed on the input image and its horizontally flipped image respectively, and a pixel-level confidence map can be constructed based on the consistency difference between the two results to characterize the reliability of the monocular geometric prior. In addition, a mask for the unoccluded region in the left image can be constructed based on the forward projection relationship of the target disparity, which can be used for subsequent training constraints.
[0077] (ii) Generation of right view based on forward mapping, diffusion completion and fusion In some embodiments, a forward mapping can be performed on the input left view based on the target disparity map to generate an initial result of the target right view. Due to occlusion and projection conflicts, the generated right view typically contains hole regions and local artifacts. To address this, embodiments of this application can include an image completion module to restore hole regions. This image completion module can employ a diffusion-based image completion network (e.g., a structure with interactive reference and denoising branches). Considering that the diffusion generation result may rewrite the original texture or even weaken the true geometric correspondence in some areas, embodiments of this application further introduce a fusion module. This fusion module takes the initial result of the right view obtained from the forward mapping and the image completion result as input, outputs a pixel-level fusion weight map, and fuses the two types of results based on this weight map. This ensures that the forward mapping result is preferentially retained at locations with reliable original projected pixels, while the completion result is used in hole or unreliable areas, thereby simultaneously ensuring geometric consistency and visual integrity.
[0078] (III) Input Image Quality Control and Supervision Constraints During Training In some embodiments, to improve the quality of generated data, this application embodiment can perform quality detection on the input image before the data enters the generation process, such as blur detection, watermark or annotation detection, abnormal border detection, etc., to remove samples that are obviously unsuitable for geometric estimation and image completion. When training the binocular stereo matching model, this application embodiment does not directly include all pseudo-label regions equally in the loss, but instead constructs a weighted loss based on the confidence map and non-occluded region masks. Specifically, for unreliable regions generated by monocular priors and the completion process, their weight in the disparity supervision loss can be reduced using the confidence map. For non-occluded real pixel regions mapped from the left image, additional real pixel correspondence constraints are introduced to improve the supervision strength of strictly geometrically matchable regions. For example, the total loss can be expressed as: L = L_disp^w + α L_real^mnoc Where L_disp^w represents the disparity supervision loss weighted by the confidence map, L_real^mnoc represents the true pixel consistency loss calculated only on the unoccluded true projection region of the left image, and α is the weighting coefficient.
[0079] In summary, the technical solutions provided by the embodiments of this application have the following beneficial effects: 1) The embodiments of this application, through the joint alignment of relative geometric prior and absolute scale prior, not only retain the ability of monocular relative disparity to express details and boundaries, but also introduce more reasonable scale constraints, avoiding the distortion problem caused by relying on a unified fixed maximum disparity range, making the disparity distribution of the generated samples closer to the real business scenario.
[0080] 2) The embodiments of this application generate the right view by means of "forward mapping + image completion + pixel-level fusion". While restoring the content of the occluded holes as much as possible, it prioritizes the retention of real pixels that can be directly projected, thereby reducing the destruction of local geometric correspondence by pure generative completion.
[0081] 3) The embodiments of this application introduce weighted supervision based on confidence maps and non-occlusion region masks during the training phase, which suppresses the negative impact of unreliable pseudo-label regions and completion artifact regions on the training of the stereo matching model, thereby improving the model's adaptability in business-related difficult scenarios.
[0082] 4) This application embodiment can construct samples suitable for training a stereo matching model using only monocular images as the primary data source. This reduces the cost of large-scale data construction that relies on RGB-D equipment, specialized stereo acquisition, and complex calibration processes, and is beneficial for quickly covering the diverse business distributions in industrial scenarios. Furthermore, large-scale, high-quality training data is a crucial source of the stereo matching model's generalization ability.
[0083] The following description continues to illustrate the exemplary structure of the binocular training sample construction device 555 provided in the embodiments of this application as a software module. In some embodiments, such as... Figure 2 As shown, the software modules in the binocular training sample construction device 555 stored in the memory 550 may include: an acquisition module 5551, a determination module 5552, an alignment module 5553, a mapping module 5554, a completion module 5555, a fusion module 5556, and a construction module 5557.
[0084] The module 5551 is used to acquire a monocular image; the module 5552 is used to determine the relative disparity and absolute disparity of the monocular image; the module 5553 is used to perform scale alignment on the relative disparity and absolute disparity to obtain the target disparity; the module 5554 is used to perform forward mapping on the monocular image based on the target disparity to obtain the initial result of the right view; the module 5555 is used to complete the image of the hole region in the initial result of the right view to obtain the completed right view; the module 5556 is used to fuse the initial result of the right view and the completed right view to obtain the synthesized right image; and the module 5557 is used to construct binocular training samples based on the monocular image and the synthesized right image.
[0085] In some embodiments, the determining module 5552 is further configured to perform geometric estimation on the monocular image to obtain relative geometric information characterizing the relative distance relationship of pixels, and determine the relative disparity of the monocular image based on the relative geometric information; perform depth estimation on the monocular image to obtain depth information with absolute scale, and determine the absolute disparity of the monocular image based on the depth information.
[0086] In some embodiments, the determining module 5552 is further configured to obtain imaging parameters corresponding to the monocular image; and to perform disparity conversion on the depth information based on the imaging parameters to obtain the absolute disparity of the monocular image.
[0087] In some embodiments, the alignment module 5553 is further configured to establish a mapping fitting equation between relative disparity and absolute disparity; solve the mapping fitting equation to obtain mapping parameters; and perform a linear mapping transformation on the relative disparity based on the mapping parameters to obtain a target disparity that combines local detail with global scale consistency.
[0088] In some embodiments, the mapping module 5554 is further configured to establish a projection mapping relationship between each pixel in the monocular image and the target viewing angle based on the target parallax; and to perform forward projection mapping on the monocular image based on the projection mapping relationship to obtain an initial result of the right view with a hole region.
[0089] In some embodiments, the completion module 5555 is further used to extract the contextual features and appearance structure of the monocular image; and to fill the hole areas in the initial result of the right view using the contextual features and appearance structure to obtain a completed right view containing complete geometry and visually continuous texture.
[0090] In some embodiments, the fusion module 5556 is further configured to generate a pixel-level fusion weight map based on the initial result of the right view and the completed right view; and to perform pixel-level weighted fusion on the initial result of the right view and the completed right view based on the pixel-level fusion weight map to obtain a synthesized right image.
[0091] In some embodiments, the binocular training sample construction apparatus 555 further includes a training module 5558, which is used to input binocular training samples into the binocular stereo matching model to be trained to obtain predicted disparity; determine disparity supervision loss based on the difference between predicted disparity and target disparity, and weight the disparity supervision loss based on the confidence map to obtain weighted disparity supervision loss; construct a total loss based on the weighted disparity supervision loss and the true pixel consistency loss, and update the parameters of the binocular stereo matching model based on the total loss.
[0092] It should be noted that the description of the apparatus in this application embodiment is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, therefore it will not be repeated. For any technical details not covered in the apparatus for constructing binocular training samples provided in this application embodiment, please refer to... Figure 3 , Figure 4 ,or Figure 5 The meaning is understood in accordance with the description of any of the accompanying drawings.
[0093] This application provides a computer program product, which includes a computer program or computer-executable instructions. The processor of an electronic device reads the computer-executable instructions from a computer-readable storage medium, and executes the computer-executable instructions, causing the electronic device to perform the binocular training sample construction method described above in this application.
[0094] This application provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are executed by a processor, they cause the processor to execute the method for constructing binocular training samples provided in this application. For example, ... Figure 3 , Figure 4 ,or Figure 5 The method for constructing binocular training samples is shown.
[0095] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0096] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0097] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be part of a file of other programs or data, such as in one or more scripts stored in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files storing one or more modules, subroutines, or code sections).
[0098] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0099] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for constructing binocular training samples, characterized in that, The method includes: Acquire a monocular image and determine the relative disparity and absolute disparity of the monocular image; The relative disparity and the absolute disparity are scale-aligned to obtain the target disparity; Based on the target disparity, the monocular image is forward-mapped to obtain the initial result of the right view; The hole areas in the initial result of the right view are filled in to obtain the filled right view, and the initial result of the right view and the filled right view are merged to obtain the composite right image; Based on the monocular image and the synthesized right image, a binocular training sample is constructed.
2. The method according to claim 1, characterized in that, Determining the relative disparity and absolute disparity of the monocular image includes: Geometric estimation is performed on the monocular image to obtain relative geometric information characterizing the relative distance relationship of pixels, and the relative disparity of the monocular image is determined based on the relative geometric information; Depth estimation is performed on the monocular image to obtain depth information with absolute scale, and the absolute disparity of the monocular image is determined based on the depth information.
3. The method according to claim 2, characterized in that, Determining the absolute disparity of the monocular image based on the depth information includes: Obtain the imaging parameters corresponding to the monocular image; Based on the imaging parameters, the depth information is converted into disparity to obtain the absolute disparity of the monocular image.
4. The method according to claim 1, characterized in that, The step of scaling the relative disparity and the absolute disparity to obtain the target disparity includes: Establish a mapping fitting equation between the relative disparity and the absolute disparity; The mapping fitting equation is solved to obtain the mapping parameters; A linear mapping transformation is performed on the relative disparity based on the mapping parameters to obtain a target disparity that combines local detail with global scale consistency.
5. The method according to claim 1, characterized in that, The step of forward mapping the monocular image based on the target disparity to obtain the initial result of the right view includes: Based on the target parallax, establish the projection mapping relationship between each pixel in the monocular image and the target viewing angle; Based on the projection mapping relationship, the monocular image is forward-projected to obtain an initial result of the right view with a hole region.
6. The method according to claim 1, characterized in that, The step of completing the image of the hole region in the initial result of the right view to obtain the completed right view includes: Extract the contextual features and appearance structure of the monocular image; Using the contextual features and the appearance structure, the empty areas in the initial result of the right view are filled to obtain a complete right view containing complete geometry and visually continuous texture.
7. The method according to claim 1, characterized in that, The process of fusing the initial result of the right view and the completed right view to obtain a composite right image includes: A pixel-level fusion weight map is generated based on the initial result of the right view and the completed right view. Based on the pixel-level fusion weight map, the initial result of the right view and the completed right view are fused at the pixel level to obtain the composite right image.
8. The method according to claim 1, characterized in that, After constructing the binocular training samples based on the monocular image and the synthesized right image, the method further includes: The binocular training samples are input into the binocular stereo matching model to be trained to obtain the predicted disparity; Based on the difference between the predicted disparity and the target disparity, the disparity supervision loss is determined, and the disparity supervision loss is weighted based on the confidence map to obtain the weighted disparity supervision loss. The total loss is constructed based on the weighted disparity supervision loss and the true pixel consistency loss, and the parameters of the stereo matching model are updated based on the total loss.
9. A device for constructing binocular training samples, characterized in that, The device includes: The acquisition module is used to acquire monocular images; The determination module is used to determine the relative disparity and absolute disparity of the monocular image; An alignment module is used to perform scale alignment on the relative disparity and the absolute disparity to obtain the target disparity; The mapping module is used to perform forward mapping on the monocular image based on the target disparity to obtain the initial result of the right view; The completion module is used to complete the image of the hole area in the initial result of the right view to obtain the completed right view; The fusion module is used to fuse the initial result of the right view and the completed right view to obtain a composite right image; A construction module is used to construct binocular training samples based on the monocular image and the synthesized right image.
10. An electronic device, characterized in that, include: Memory is used to store executable instructions for a computer; A processor, when executing computer-executable instructions stored in the memory, implements the method for constructing binocular training samples as described in any one of claims 1 to 8.
11. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by the processor, they implement the method for constructing binocular training samples as described in any one of claims 1 to 8.
