A method for building a lightweight monocular endoscope depth estimation model
By using a lightweight monocular endoscope depth estimation model with Lite-HRNet and parallel vision Mamba modules, the problem of excessive size and cost of monocular endoscope devices is solved, and real-time depth estimation is achieved on edge computing devices, which is suitable for lightweight endoscopic surgery.
Patent Information
- Application Number
- CN202410589148.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2044-05-13
AI Technical Summary
Existing monocular endoscope devices are too bulky and expensive due to the large number of parameters in their depth estimation models, making them difficult to widely apply in real-world scenarios, especially in real-time depth estimation on edge computing devices.
We employ a lightweight high-resolution network Lite-HRNet and a parallel visual Mamba module. By fusing low-resolution branches through parallel connections and a spatial attention module, we build a lightweight monocular endoscope depth estimation model, reducing network complexity and parameter count. We also utilize CNN, ShuffleNet, and Mamba architectures to extract image features.
While maintaining the accuracy of depth estimation, the model size and computational cost were significantly reduced, making it suitable for edge computing devices and enabling real-time depth estimation for portable monocular endoscopic surgery.
Smart Images

Figure CN118470081B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and deep learning technology, specifically relating to a method for building a lightweight monocular endoscope depth estimation model. Background Technology
[0002] Before the advent of deep learning, depth estimation was primarily accomplished using stereo cameras, which obtained depth maps by acquiring disparity maps of the left and right cameras and baseline distances. However, stereo cameras require tuning more parameters than monocular cameras, are larger in size, and are more expensive. Furthermore, obtaining depth maps from monocular cameras is far more complex than using stereo cameras.
[0003] Most modern endoscopic surgeries, such as gastroscopy and colonoscopy, utilize monocular endoscopes, meaning the camera has only one lens. Monocular endoscopes are smaller, thus reducing patient discomfort compared to binocular endoscopes. However, most modern endoscopic surgical equipment can only display a real-time endoscopic view and cannot display a real-time depth map. Monocular endoscope images lack depth information; points on a straight line during surgery converge into a single point on the camera's imaging plane, requiring surgeons to rely on their experience to determine the depth of the surgical image.
[0004] Before the advent of deep learning, it was difficult to directly obtain depth maps from monocular cameras. With continuous technological advancements, some deep learning methods have used self-supervised SfM methods, diffusion models, or large models to improve the accuracy of monocular depth estimation. However, these methods, which improve depth estimation performance by continuously increasing model complexity, are not suitable for edge computing devices, as these devices struggle to meet the computational power requirements of these methods. Monocular endoscopes based on these methods are too bulky and difficult to move, making them unsuitable for remote areas and mobile surgical scenarios.
[0005] Currently, monocular depth estimation models have a relatively large number of parameters, and monocular endoscopes using these models are too bulky and expensive, hindering their application in many practical scenarios. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of current monocular depth estimation models, which have a relatively large number of parameters, and the monocular endoscope devices using these models are too large and too expensive, seriously hindering their application in many practical scenarios. This invention provides a lightweight method for building a monocular endoscope depth estimation model.
[0007] The present invention provides a method for constructing a lightweight monocular endoscope depth estimation model, comprising the following steps:
[0008] 1) A device for constructing a lightweight monocular endoscope depth estimation model, the device consisting of at least one processor and at least one memory, and the processor and memory are interconnected via a bus; the memory stores computer-executable programs;
[0009] 2) Obtain the raw data of the endoscopic images. The raw data can be real endoscopic surgical data or synthetic data.
[0010] 3) Preprocess the raw data from step 2) and divide it into training set, validation set and test set;
[0011] The preprocessing of the raw data includes: scaling the training set, validation set, and test set to a resolution of 256×320 pixels; data augmentation; random horizontal flipping; random brightness variation of the image within a ratio of 0.85 to 1.25; random contrast variation of the image within a ratio of 0.85 to 1.25; random saturation variation of the image within a ratio of 0.85 to 1.25; and random hue variation of the image within a ratio of -0.15 to 0.15; the ratio of the training set, validation set, and test set is 6:1:3.
[0012] 4) A lightweight monocular endoscope depth estimation network model is built based on the lightweight high-resolution network Lite-HRNet and the parallel vision Mamba module.
[0013] The model includes an encoder and a decoder.
[0014] The encoder part first goes through the backbone layer, and then through a combination of three transition layers and lightweight modules;
[0015] The following backbone layer is referred to as the Stem layer. The Stem layer consists of a 3×3 convolutional module, two 32×32 convolutional modules, a 32×32 extended convolutional module, and a 64×64 depthwise separable convolutional module.
[0016] The following transition layers are referred to as Transition layers. The Transition layers include: Transition1, Transition2, and Transition3.
[0017] The Transition1 consists of a parallel visual Mamba module with an input dimension of 64 and an output dimension of 18, and a parallel visual Mamba module with an input dimension of 64 and an output dimension of 36.
[0018] The Transition2 consists of a parallel visual Mamba module with an input dimension of 36 and an output dimension of 72.
[0019] The Transition3 consists of a parallel visual Mamba module with an input dimension of 72 and an output dimension of 144.
[0020] The following lightweight modules are referred to as LiteModule modules. LiteModule modules include: LiteModule1, LiteModule2 and LiteModule3;
[0021] The LiteModule1 consists of a combination of two parallel basic layers Layers1 and a fusion layer FuseLayers1. Each basic layer Layers1 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers1 consists of a spatial attention module, and the fusion layer FuseLayers1 is followed by a ReLU activation function.
[0022] The LiteModule2 consists of a combination of three parallel basic layers Layers2 and a fusion layer FuseLayers2. Each basic layer Layers2 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers2 consists of a spatial attention module, and the fusion layer FuseLayers2 is followed by a ReLU activation function.
[0023] The LiteModule3 consists of a combination of four parallel basic layers Layers3 and a fusion layer FuseLayers3. Each basic layer Layers3 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers3 consists of a spatial attention module, and the fusion layer FuseLayers3 is followed by a ReLU activation function.
[0024] The ShuffleUnit module consists of three 3×3 convolutional modules;
[0025] The decoder consists of five decoding nodes, each consisting of a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolution module.
[0026] The lightweight monocular endoscope depth estimation network model has the following structure: The encoder part starts with a Stem layer, then passes through the first transition layer (Transition 1), changing from one branch to two branches and obtaining output feature maps at two scales. These two scale output feature maps pass through the first lightweight module (LiteModule 1), where upsampling and downsampling are performed in the fusion layer (FuseLayers 1) of LiteModule 1, followed by a ReLU activation function. Then, after passing through the second transition layer (Transition 2), the two branches become three branches, resulting in output feature maps at three scales. These three scale output feature maps then pass through the second lightweight module (LiteModule 2), where upsampling and downsampling are performed in the fusion layer (FuseLayers 2) of LiteModule 2, followed by a ReLU activation function. Finally, after passing through the third transition layer (Transition 3), the three branches become four branches, resulting in output feature maps at four scales. The output feature map is passed through the third lightweight module LiteModule3, and after upsampling and downsampling in the fusion layer FuseLayers3 of LiteModule3, it is activated by ReLU. The output feature map of the Stem layer and the four output feature maps of the third lightweight module LiteModule3 are passed through the decoder. The decoder consists of five decoding nodes. Each decoding node consists of a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolution module. The output feature map of the current layer and the output feature map of the previous layer are fused through the combination of the spatial attention bridging module and the channel attention bridging module in the decoding node. Then, the output depth map of the current layer is obtained through the 3×3 convolution module in the decoding node. Finally, the depth map Disp1 with a resolution of 256×320, the depth map Disp2 with a resolution of 128×160, the depth map Disp3 with a resolution of 64×80, and the depth map Disp4 with a resolution of 32×40 are output from the decoder.
[0027] The encoder module maintains a constant overall number of channels while processing deep features;
[0028] The parallel visual Mamba module consists of four parallel visual state space modules (VSS modules). Each VSS module consists of a linear embedding layer, a 3×3 deep convolutional layer, a SiLU activation function, and an SS2D module.
[0029] Each transition layer adds a branch, which are then fused in the LiteModule after upsampling and downsampling operations. Each upsampling operation increases the tensor shape and decreases the tensor dimension in multiples of 2; each downsampling operation decreases the tensor shape and increases the tensor dimension in multiples of 2. Then, in each LiteModule, tensor information of the same shape is fused through a spatial attention module and then activated by the ReLU function.
[0030] The decoder consists of five decoding nodes, which respectively receive the four output feature maps of the Stem layer and the third lightweight module LiteModule3. The first decoding node Decoder1 receives the input of the Stem layer and the output feature map of the second decoding node Decoder2, and outputs a depth map Disp1 with a resolution of 256×320. The second decoding node Decoder2 receives the first output feature map of LiteModule3 and the output feature map of the third decoding node Decoder3, and outputs a depth map Disp2 with a resolution of 128×160. The third decoding node Decoder3 receives the second output feature map of LiteModule3 and the output feature map of the fourth decoding node Decoder4, and outputs a depth map Disp3 with a resolution of 64×80. The fourth decoding node Decoder4 receives the third output feature map of LiteModule3 and the output feature map of the fifth decoding node Decoder5, and outputs a depth map Disp4 with a resolution of 32×40. The fifth decoding node Decoder5 receives the fourth output feature map of LiteModule3 and outputs a feature map.
[0031] 5) Use the training set described in step 3) to train the network model built in step 4);
[0032] 6) Use the test set described in step 3) to test the trained network model and obtain the final model;
[0033] 7) The memory of the device described in step 1) stores a computer-executable program, which is a lightweight monocular endoscope depth estimation network model constructed using the method described in step 4). When the processor executes the computer-executable program stored in the memory, the method for constructing the lightweight monocular endoscope depth estimation model can be implemented.
[0034] This invention constructs a lightweight monocular endoscopic depth estimation network model based on the lightweight high-resolution network Lite-HRNet and a parallel visual Mamba module. Through parallel connections, low-resolution and high-resolution branches are continuously fused using a spatial attention module. It fully utilizes the characteristics of CNN, ShuffleNet, and Mamba structures to extract shallow and deeper features from images, reducing network complexity and parameter count. By fusing feature maps from different layers through spatial and channel attention bridging modules, the output depth map becomes richer in detail. This invention achieves a balance between depth estimation accuracy and model size, outperforming current lightweight depth estimation models and enabling real-time monocular depth estimation for edge computing devices. The monocular endoscopic depth estimation device based on this invention is small and portable, suitable for lightweight endoscopic surgery, and has significant scientific and medical value. Attached Figure Description
[0035] Figure 1 A flowchart illustrating the depth estimation method model for monocular endoscopes;
[0036] Figure 2 The model network flowchart;
[0037] Figure 3 This is a schematic diagram of the parallel vision Mamba module structure;
[0038] Figure 4 This is a schematic diagram of the decoding node structure;
[0039] Figure 5 This is a simplified block diagram of the monocular endoscope depth estimation device in Example 2. Detailed Implementation
[0040] The present invention will be further described below with reference to specific embodiments.
[0041] Example 1:
[0042] This invention proposes a lightweight monocular endoscope depth estimation method. It constructs a lightweight monocular endoscope depth estimation network model based on the lightweight high-resolution network Lite-HRNet and a parallel visual Mamba module. Through parallel connections, low-resolution and high-resolution branches are continuously fused using a spatial attention module. It fully utilizes the characteristics of CNN, ShuffleNet, and Mamba structures to extract shallow and deeper features of the image, reducing network complexity and parameter count. By fusing feature maps from different layers through spatial and channel attention bridging modules, the output depth map becomes richer in detail. This invention achieves a balance between depth estimation accuracy and model size, outperforming current lightweight depth estimation models, and can be used for real-time monocular depth estimation on edge computing devices, such as… Figure 1 As shown, the main steps include:
[0043] Step 1: Obtain raw data of the endoscopic images; the raw data is obtained through real endoscopic surgical data or synthetic data;
[0044] Step 2: Preprocess the raw data from Step 1 by dividing it into training set, validation set and test set;
[0045] Step 3: Construct a lightweight monocular depth estimation model. The encoder first extracts image features through the Stem layer and performs downsampling. Then, after passing through the first transition layer (Transition1), it changes from one branch to two branches, resulting in two scales of output feature maps. These two scales of output feature maps pass through the first lightweight module (LiteModule1), where upsampling and downsampling are fused in the FuseLayers1 layer and then activated by ReLU. Next, after passing through the second transition layer (Transition2), it changes from two branches to three branches, resulting in three scales of output feature maps. These three scales of output feature maps pass through the second lightweight module (LiteModule2), where upsampling and downsampling are fused in the FuseLayers2 layer and then activated by ReLU. Finally, after passing through the third transition layer (Transition3), it changes from three branches to four branches, resulting in four scales of output feature maps. The output feature maps at four scales are passed through the third lightweight module LiteModule3. After upsampling and downsampling in the fusion layer FuseLayers3 of LiteModule3, they are then activated by the ReLU function. The output feature maps of the Stem layer and the four output feature maps of the third lightweight module LiteModule3 are passed through the decoder. The decoder consists of five decoding nodes. Each decoding node consists of a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolutional module. The output feature maps of the current layer and the previous layer are fused through the combination of the spatial attention bridging module and the channel attention bridging module in the decoding node. Then, the output depth map of the current layer is obtained through the 3×3 convolutional module in the decoding node. Finally, the depth maps Disp1 (resolution 256×320), Disp2 (resolution 128×160), Disp3 (resolution 64×80), and Disp4 (resolution 32×40) output by the decoder are used as outputs.
[0046] Step 4: Train the network model built in Step 3 using the training set described in Step 2.
[0047] Step 5: Test the trained network model using the test set described in Step 2, and select the model that performs best on the validation set as the final model.
[0048] This embodiment was tested on the publicly available endoscopy dataset SCARED. The experimental results of the network model proposed in this invention on the SCARED dataset are better than other related methods.
[0049] 1. Obtain raw data
[0050] The SCARED dataset is a publicly available dataset in this field and can be obtained from the official website. The SCARED dataset was collected from abdominal dissections of fresh pig carcasses using the da Vinci Xi endoscope and contains 22,950 frames of binocular endoscopic images and ground truth depth maps. We split the SCARED dataset into 15,351, 1705, and 551 frames according to the dataset splitting method endovis, which are used as the training set, validation set, and test set, respectively.
[0051] 2. Data Preprocessing
[0052] The acquired raw data is preprocessed. First, for the SCARED dataset, the original endoscopic images are binocular endoscopic images with a resolution of 2048×1280. We only use the upper left endoscopic image, that is, a monocular endoscopic image with a resolution of 1024×1280 and its corresponding depth map ground truth. The image size is scaled to a resolution of 256×320 while maintaining the original aspect ratio. At the same time, data augmentation is performed, including random horizontal flipping, random brightness changes, random contrast changes, random saturation changes, and random hue changes.
[0053] 3. Model Building
[0054] In this embodiment, the network is built based on the high-resolution network Lite-HRNet and a parallel visual Mamba module. The HRNet series of networks are applicable to scenarios including semantic segmentation, human pose estimation, and keypoint detection. This invention, based on this network, aims to explore a lightweight monocular endoscope depth estimation method. The network consists of an encoder and a decoder. The encoder first passes through the backbone layer, then through a combination of three transition layers and a lightweight module, and finally through the decoder. The specific structure is shown in the attached figure. Figure 2 As shown;
[0055] The encoder part is first a backbone layer Stem layer, which consists of a 3×3 convolutional module, two 32×32 convolutional modules, a 32×32 extended convolutional module and a 64×64 depth separable convolutional module.
[0056] The transition layer includes: Transition1, Transition2, and Transition3;
[0057] The Transition1 consists of a parallel visual Mamba module with an input dimension of 64 and an output dimension of 18, and a parallel visual Mamba module with an input dimension of 64 and an output dimension of 36.
[0058] The Transition2 consists of a parallel visual Mamba module with an input dimension of 36 and an output dimension of 72.
[0059] The Transition3 consists of a parallel visual Mamba module with an input dimension of 72 and an output dimension of 144.
[0060] The LiteModule module includes: LiteModule1, LiteModule2, and LiteModule3;
[0061] The LiteModule1 consists of a combination of two parallel basic layers Layers1 and a fusion layer FuseLayers1. Each basic layer Layers1 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers1 consists of a spatial attention module, and the fusion layer FuseLayers1 is followed by a ReLU activation function.
[0062] The LiteModule2 consists of a combination of three parallel basic layers Layers2 and a fusion layer FuseLayers2. Each basic layer Layers2 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers2 consists of a spatial attention module, and the fusion layer FuseLayers2 is followed by a ReLU activation function.
[0063] The LiteModule3 consists of a combination of four parallel basic layers Layers3 and a fusion layer FuseLayers3. Each basic layer Layers3 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers3 consists of a spatial attention module, and the fusion layer FuseLayers3 is followed by a ReLU activation function.
[0064] The ShuffleUnit module consists of three 3×3 convolutional modules;
[0065] The decoder consists of five decoding nodes. Each decoding node comprises a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolutional module. See the appendix for detailed structure. Figure 4 As shown;
[0066] The lightweight monocular endoscope depth estimation network model has the following structure: The encoder part starts with a Stem layer, then passes through the first transition layer (Transition 1), changing from one branch to two branches and obtaining output feature maps at two scales. These two scale output feature maps pass through the first lightweight module (LiteModule 1), where upsampling and downsampling are performed in the fusion layer (FuseLayers 1) of LiteModule 1, followed by a ReLU activation function. Then, after passing through the second transition layer (Transition 2), the two branches become three branches, resulting in output feature maps at three scales. These three scale output feature maps then pass through the second lightweight module (LiteModule 2), where upsampling and downsampling are performed in the fusion layer (FuseLayers 2) of LiteModule 2, followed by a ReLU activation function. Finally, after passing through the third transition layer (Transition 3), the three branches become four branches, resulting in output feature maps at four scales. The output feature map is passed through the third lightweight module LiteModule3, and after upsampling and downsampling in the fusion layer FuseLayers3 of LiteModule3, it is activated by ReLU. The output feature map of the Stem layer and the four output feature maps of the third lightweight module LiteModule3 are passed through the decoder. The decoder consists of five decoding nodes. Each decoding node consists of a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolution module. The output feature map of the current layer and the output feature map of the previous layer are fused through the combination of the spatial attention bridging module and the channel attention bridging module in the decoding node. Then, the output depth map of the current layer is obtained through the 3×3 convolution module in the decoding node. Finally, the depth map Disp1 with a resolution of 256×320, the depth map Disp2 with a resolution of 128×160, the depth map Disp3 with a resolution of 64×80, and the depth map Disp4 with a resolution of 32×40 are output from the decoder.
[0067] The encoder module maintains a constant overall number of channels while processing deep features;
[0068] The parallel visual Mamba module consists of four parallel visual state space modules (VSS modules). Each VSS module comprises a linear embedding layer, a 3×3 deep convolutional layer, a SiLU activation function, and an SS2D module. Detailed structures are shown in the appendix. Figure 3 As shown;
[0069] Each transition layer adds a branch, which are then fused in the LiteModule after upsampling and downsampling operations. Each upsampling operation increases the tensor shape and decreases the tensor dimension in multiples of 2; each downsampling operation decreases the tensor shape and increases the tensor dimension in multiples of 2. Then, in each LiteModule, tensor information of the same shape is fused through a spatial attention module and then activated by the ReLU function.
[0070] The decoder consists of five decoding nodes, which respectively receive the four output feature maps of the Stem layer and the third lightweight module LiteModule3. The first decoding node, Decoder1, receives the input of the Stem layer and the output feature map of the second decoding node, Decoder2, and outputs a depth map Disp1 with a resolution of 256×320. The second decoding node, Decoder2, receives the first output feature map of LiteModule3 and the output feature map of the third decoding node, Decoder3, and outputs a depth map Disp2 with a resolution of 128×160. The third decoding node, Decoder3, receives the second output feature map of LiteModule3 and the output feature map of the fourth decoding node, Decoder4, and outputs a depth map Disp3 with a resolution of 64×80. The fourth decoding node, Decoder4, receives the third output feature map of LiteModule3 and the output feature map of the fifth decoding node, Decoder5, and outputs a depth map Disp4 with a resolution of 32×40. The fifth decoding node, Decoder5, receives the fourth output feature map of LiteModule3 and outputs a feature map.
[0071] 4. Model Training
[0072] The lightweight monocular endoscope depth estimation method in this embodiment is implemented on an Ubuntu 18.04LTS operating system, using Python 3.7 as the programming language, PyTorch 1.2.0 as the deep learning framework, CUDA version 10.0, and an NVIDIA RTX 2080Ti graphics card. Adam is used as the optimizer, with an initial learning rate of 0.0001, and a total of 20 epochs of training.
[0073] After each training epoch, the model performance was validated using a validation set, and the model for each epoch was saved. During the experiment, the dataset was first preprocessed by cropping the SCARED dataset into 256×320 images and performing data augmentation.
[0074] 5. Experimental Results
[0075] This embodiment compares the performance of the proposed method with other monocular depth estimation methods, verifying the effectiveness of the proposed scheme. The SCARED dataset is based on monocular depth estimation performance evaluation metrics. For this dataset, the lower the values of absolute relative error (Abs Rel), squared relative error (Sq Rel), root mean square error (RMSE), and root mean square logarithmic error (RMSE log), the better. The higher the values of a1, a2, and a3, which measure model stability, the better.
[0076] Table 1 shows the experimental results on the SCARED dataset.
[0077]
[0078] Table 1 shows the results of the algorithm of this invention on the SCAED dataset. This invention aims at lightweight applications of monocular depth estimation. As can be seen from Table 1, this invention achieves a balance between model size and depth estimation accuracy. In terms of model size, the number of parameters of the proposed method is reduced by 84.35% compared to Monodepth2, by 87.79% compared to Endo-SfMLearner, and by 18.38% compared to EndoDepthL. In terms of several performance metrics such as Sq Rel, RMSE, and RMSE log, this method outperforms the benchmark networks Monodepth2 and Endo-SfMLearner. Compared to the latest lightweight network model EndoDepthL, the method proposed in this invention, while slightly outperforming it in FLOPs and RMSE, achieves improvements of 39.42%, 21.04%, and 33.33% in Abs Rel, SqRel, and RMSE log, respectively. These comparisons demonstrate that the network model of this invention outperforms other networks in terms of model size and depth estimation accuracy, maintaining good performance despite having fewer parameters and lower computational cost.
[0079] By comparing the results in Table 1, it can be concluded that the network model of this invention outperforms other networks in terms of model size and depth estimation accuracy. In different applications, the lightweight monocular endoscope depth estimation method built in this invention can be used for monocular endoscope depth estimation. The specific process is as follows:
[0080] Obtain datasets of real or synthetic endoscopic images;
[0081] The dataset is preprocessed, cropped to an appropriate size, and augmented simultaneously.
[0082] A lightweight monocular endoscope depth estimation network model was constructed, and the preprocessed training set was input into the network for training.
[0083] Test the trained model and select the model with the highest depth estimation accuracy as the final model.
[0084] The model is deployed to an edge computing device, which estimates the depth map of the input image and displays the original image and its depth map in real time.
[0085] Example 2:
[0086] As attached Figure 5 As shown, the present invention also provides a lightweight monocular endoscope depth estimation device, which includes a processor, a memory and a display device, as well as a communication interface and an internal bus, wherein the processor, communication interface, memory and display device communicate with each other through the internal bus.
[0087] A memory for storing a computer-executable program, which is a computer-executable program of a monocular endoscope depth estimation model constructed by the construction method described in Example 1;
[0088] When a processor executes a computer program stored in memory, it can implement a lightweight monocular endoscope depth estimation method.
[0089] The internal bus can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or a bus with other structures; the internal bus can be divided into an address bus, a data bus, and a control bus, etc.; for ease of illustration, the buses in the accompanying drawings of this application are not limited to only one bus or one type of bus;
[0090] The communication interface is used to enable communication between the aforementioned electronic devices and other devices;
[0091] The memory may be high-speed random access memory (RAM), non-volatile memory (NVM), or other types of memory.
[0092] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), digital signal processors (DSPs), and field programmable gate arrays (FPGAs).
[0093] The device can be a terminal, server, edge computing device, or other form of device.
Claims
1. A method for constructing a lightweight monocular endoscope depth estimation model, characterized in that... It includes the following steps: 1) A device for constructing a lightweight monocular endoscope depth estimation model, the device consisting of at least one processor. It consists of at least one memory, and the processor and memory are interconnected via a bus; The memory stores the computer's executable program; 2) Obtain the raw data of the endoscopic images. The raw data can be real endoscopic surgical data or synthetic data. 3) Preprocess the raw data from step 2) and divide it into training set, validation set and test set; The preprocessing of the raw data includes: scaling the training set, validation set, and test set to a resolution of 256×320 pixels; data augmentation; random horizontal flipping; random brightness variation of the image between 0.85 and 1.25; random contrast variation of the image between 0.85 and 1.25; random saturation variation of the image between 0.85 and 1.25; and random hue variation of the image between -0.15 and 0.15; the ratio of the training set, validation set, and test set is 6:1:
3. 4) A lightweight monocular endoscope depth estimation network model is built based on the lightweight high-resolution network Lite-HRNet and the parallel vision Mamba module. The model includes an encoder and a decoder. The encoder part first goes through the backbone layer, and then through a combination of three transition layers and lightweight modules; The following backbone layer is referred to as the Stem layer. The Stem layer consists of a 3×3 convolutional module, two 32×32 convolutional modules, a 32×32 extended convolutional module, and a 64×64 depthwise separable convolutional module. The following transition layers are referred to as Transition layers. The Transition layers include: Transition1, Transition2, and Transition3. The Transition1 consists of a parallel visual Mamba module with an input dimension of 64 and an output dimension of 18, and a parallel visual Mamba module with an input dimension of 64 and an output dimension of 36. The Transition2 consists of a parallel visual Mamba module with an input dimension of 36 and an output dimension of 72. The Transition3 consists of a parallel visual Mamba module with an input dimension of 72 and an output dimension of 144. The following lightweight modules are referred to as LiteModule modules. LiteModule modules include: LiteModule1, LiteModule2 and LiteModule3; The LiteModule1 consists of a combination of two parallel basic layers Layers1 and a fusion layer FuseLayers1. Each basic layer Layers1 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers1 consists of a spatial attention module, and the fusion layer FuseLayers1 is followed by a ReLU activation function. The LiteModule2 consists of a combination of three parallel basic layers Layers2 and a fusion layer FuseLayers2. Each basic layer Layers2 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers2 consists of a spatial attention module, and the fusion layer FuseLayers2 is followed by a ReLU activation function. The LiteModule3 consists of a combination of four parallel basic layers Layers3 and a fusion layer FuseLayers3. Each basic layer Layers3 consists of a Sequential module, which is composed of a ShuffleUnit module, a parallel visual Mamba module, and a combination of a ShuffleUnit module and a parallel visual Mamba module. The fusion layer FuseLayers3 consists of a spatial attention module, and the fusion layer FuseLayers3 is followed by a ReLU activation function. The ShuffleUnit module consists of three 3×3 convolutional modules; The decoder consists of five decoding nodes, each consisting of a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolution module. The lightweight monocular endoscope depth estimation network model has the following structure: The encoder part starts with a Stem layer, then passes through the first transition layer (Transition 1), changing from one branch to two branches and obtaining output feature maps at two scales. These two scale output feature maps pass through the first lightweight module (LiteModule 1), where upsampling and downsampling are performed in the fusion layer (FuseLayers 1) of LiteModule 1, followed by a ReLU activation function. Then, after passing through the second transition layer (Transition 2), the two branches become three branches, resulting in output feature maps at three scales. These three scale output feature maps then pass through the second lightweight module (LiteModule 2), where upsampling and downsampling are performed in the fusion layer (FuseLayers 2) of LiteModule 2, followed by a ReLU activation function. Finally, after passing through the third transition layer (Transition 3), the three branches become four branches, resulting in output feature maps at four scales. The output feature map is passed through the third lightweight module LiteModule3, and after upsampling and downsampling in the fusion layer FuseLayers3 of LiteModule3, it is activated by ReLU. The output feature map of the Stem layer and the four output feature maps of the third lightweight module LiteModule3 are passed through the decoder. The decoder consists of five decoding nodes. Each decoding node consists of a combination of a spatial attention bridging module and a channel attention bridging module, as well as a 3×3 convolution module. The output feature map of the current layer and the output feature map of the previous layer are fused through the combination of the spatial attention bridging module and the channel attention bridging module in the decoding node. Then, the output depth map of the current layer is obtained through the 3×3 convolution module in the decoding node. Finally, the depth map Disp1 with a resolution of 256×320, the depth map Disp2 with a resolution of 128×160, the depth map Disp3 with a resolution of 64×80, and the depth map Disp4 with a resolution of 32×40 are output from the decoder. The encoder section maintains a constant overall number of channels while processing deep features; The parallel visual Mamba module consists of four parallel visual state space modules (VSS modules). Each VSS module consists of a linear embedding layer, a 3×3 deep convolutional layer, a SiLU activation function, and an SS2D module. Each transition layer adds a branch, which are then fused in the LiteModule after upsampling and downsampling operations. Each upsampling operation increases the tensor shape and decreases the tensor dimension in multiples of 2; each downsampling operation decreases the tensor shape and increases the tensor dimension in multiples of 2. Then, in each LiteModule, tensor information of the same shape is fused through a spatial attention module and then activated by the ReLU function. The decoder consists of five decoding nodes, which respectively receive the four output feature maps of the Stem layer and the third lightweight module LiteModule3. The first decoding node Decoder1 receives the input of the Stem layer and the output feature map of the second decoding node Decoder2, and outputs a depth map Disp1 with a resolution of 256×320. The second decoding node Decoder2 receives the first output feature map of LiteModule3 and the output feature map of the third decoding node Decoder3, and outputs a depth map Disp2 with a resolution of 128×160. The third decoding node Decoder3 receives the second output feature map of LiteModule3 and the output feature map of the fourth decoding node Decoder4, and outputs a depth map Disp3 with a resolution of 64×80. The fourth decoding node Decoder4 receives the third output feature map of LiteModule3 and the output feature map of the fifth decoding node Decoder5, and outputs a depth map Disp4 with a resolution of 32×40. The fifth decoding node Decoder5 receives the fourth output feature map of LiteModule3 and outputs a feature map. 5) Use the training set described in step 3) to train the network model built in step 4); 6) Use the test set described in step 3) to test the trained network model and obtain the final model; 7) The memory of the device described in step 1) stores a computer executable program, which is a lightweight monocular endoscope depth estimation network model constructed by the construction method described in step 4); when the processor executes the computer executable program stored in the memory, the construction method of the lightweight monocular endoscope depth estimation model can be implemented.
Citation Information
Patent Citations
Monocular depth method based on joint self-attention mechanism
CN112967327A
CNN (Convolutional Neural Network) and Transform improved lightweight monocular depth estimation method
CN117710429A
