Endoscopic exposure frame restoration method based on adversarial neural network RTGAN

By employing an RTGAN-based method for repairing overexposed frames in endoscopic surgery, highlight spots are repaired using inter-frame differences in black-and-white mode and a fast-moving algorithm. Combined with an RTGAN generator and discriminator, this method solves the problem of large-area overexposure in laser surgery and achieves real-time smoothness and high-quality color reconstruction of laser surgery videos.

CN114897783BActive Publication Date: 2024-10-22XIAN UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210387487.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-14
Publication Date
2024-10-22
Estimated Expiration
2042-04-14

AI Technical Summary

Technical Problem

Existing endoscopic imaging systems suffer from video stuttering and instability during laser surgery due to the complexity of exposure conditions and the difficulty in effectively addressing large-area overexposure using physical and algorithmic methods.

Method used

An endoscopic exposure frame restoration method based on RTGAN (Reactive Adversarial Neural Network) is adopted. The exposure frames are deleted by the difference of the histogram between frames in black and white mode and the highlight points are restored by the fast walking algorithm. The RTGAN generator and discriminator are combined for real-time colorization processing.

Benefits of technology

It achieves real-time, smooth, and high-quality color reconstruction of laser surgical videos, improves coloring speed and visual effects, reduces computational load and parameter count, and ensures the real-time performance and stability of surgical videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114897783B_ABST
    Figure CN114897783B_ABST
Patent Text Reader

Abstract

The present invention is a method for repairing exposure frames under endoscopes based on an adversarial neural network RTGAN, which overcomes the problem of serious overexposure of surgical video images caused by a closed environment and high beam power emitted by a visible light laser knife during endoscopic surgery in the prior art. The present invention can completely eliminate the overexposure phenomenon in the laser surgery video stream through an endoscopic exposure frame repair method based on an adversarial neural network RTGAN. The present invention includes the following steps: (1) obtaining an endoscopic video stream under black and white light and de-framing it; (2) preprocessing each frame of the image, including deleting the exposure frame and repairing the highlight points; (3) using color video frames to train the adversarial neural network RTGAN; (4) using the trained adversarial neural network RTGAN to perform real-time coloring on the preprocessed frames; (5) synthesizing the color video frames restored by RTGAN into a normal surgical video stream.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of endoscopic imaging, and relates to an endoscopic exposure frame repair method based on a countermeasure neural network RTGAN. Background Art

[0002] With the continuous development of endoscopic imaging systems, new flexible endoscopes have been developed from traditional rigid endoscopes, which further expands the application scenarios of endoscopes and makes their use more flexible. At the same time, laser technology has been applied to endoscopic treatment and has gradually become one of the important means of endoscopic treatment. In laser surgery, since the laser knife emits high-energy visible light when working, the endoscopic imaging screen will be severely overexposed, and the flexible endoscope cannot be installed with filters like the rigid endoscope. Therefore, when the doctor performs laser treatment on the patient's lesion, there will inevitably be a short period of invisible time, which will be one of the important hidden dangers leading to accidents during surgery.

[0003] There are also methods for detecting and repairing exposure images in the existing technology, which are mainly divided into two types: physics-based methods and algorithm-based methods. The physics-based method usually automatically adjusts the endoscope exposure parameters according to the brightness information of the field of view area in the image. This method uses a feedback mechanism to adjust the object distance and / or focal length of the front-end lens of the endoscope to stabilize the field of view area obtained by the front-end lens. This method seems reasonable, but in practice, this feedback mechanism often produces a large delay, so that its real-time performance is poor, and the uninterrupted adjustment of the lens itself will also bring many unstable factors to laser surgery; because the exposure conditions in laser surgery are relatively complex, the algorithm-based method uses manually designed features to accurately reflect the actual exposure conditions of the image, and even the detected exposure frames are usually discarded or partially repaired. This type of method has great limitations. When faced with large-area overexposure, the repair results are not ideal, and the video is usually stuck due to the loss of a large number of overexposed frames. Summary of the invention

[0004] The purpose of the present invention is to provide an endoscopic exposure frame repair method based on an adversarial neural network RTGAN, which overcomes the problem of severe overexposure of surgical video images caused by the closed environment and high beam power emitted by the visible light laser knife during endoscopic surgery in the prior art. The present invention can completely eliminate the overexposure phenomenon in the laser surgery video stream through an endoscopic exposure frame repair method based on an adversarial neural network RTGAN.

[0005] To achieve the above object, the technical solution adopted by the present invention is:

[0006] A method for repairing exposure frames under endoscope based on adversarial neural network RTGAN, characterized by comprising the following steps:

[0007] Step 1: Change the endoscope imaging mode to black and white mode, obtain the endoscope video stream under black and white light, delete the exposed frames by the inter-frame histogram difference, and repair the highlights by the fast marching algorithm;

[0008] Step 2: Use the video stream collected when the endoscope imaging mode is in color to train the RTGAN colorization network:

[0009] First, the collected color video stream is deframed and the preprocessing operation in step 1 is performed, including deleting the exposed frame and repairing the highlight points. The preprocessed color frame and the black-and-white frame corresponding to the color frame are used as the input training model of the RTGAN until the model training reaches the stop condition.

[0010] Step 3: The coloring network RTGAN consists of a generator and a discriminator; the generator uses the cascaded structure of residual modules as the backbone and introduces strided convolution to learn its own spatial upsampling;

[0011] Step 4: Use the generator in the trained RTGAN to colorize the black-and-white image frames preprocessed in step 1 in real time, and synthesize the colored color video frames into a normal surgical video stream.

[0012] The image preprocessing method in step 1 includes operations of deleting the exposure frame and repairing the highlight points. The specific method is as follows:

[0013] (1) The steps for deleting the exposure frame based on the inter-frame histogram difference are:

[0014] In the black-and-white image sequence, the frame before the start of exposure is taken as the normal frame, and the brightness mean T of the frame is calculated, and T is the exposure threshold; in the black-and-white image sequence, the brightness mean X1, X2, X3, ... Xn of the remaining frames are calculated; if the brightness mean Xi of the i-th frame image is greater than T, the algorithm determines that the frame is an overexposed frame and discards it, and then uses the copy frame of the previous frame to fill the frame; wherein, whether the exposure starts is obtained by physical signal or algorithm calculation;

[0015] (2) The steps for repairing highlights using the fast marching algorithm are:

[0016] Set the highlight threshold as S, and initialize a mask zero matrix M of the same size as the video frame; use S as the threshold to divide the brightness of each pixel in the image, and set the value of the corresponding position in M ​​to 1 for pixels greater than S, otherwise to 0; obtain the mask M after threshold segmentation, and the position with a value of 1 in the mask M is the highlight area that needs to be repaired;

[0017] Assume that the pixel to be repaired is p, u(i) represents the gray value of pixel i, and B is specified as e(p) is a neighborhood of size e around P, B e The contribution u of pixel q to p in (p) q (p) is defined as:

[0018]

[0019] in, The gradient value of q is shown in Figure 1. The gray value calculation formula of P to be repaired is as follows:

[0020]

[0021] Among them, B e (p) is the 8-neighborhood of P, and the weight w(p, q) is obtained using the following formula:

[0022] W(p, q)=dir(p, q)·dst(p, q)·lev(pq)

[0023] W(*) represents the weight function, which is used to limit the contribution of each pixel in the neighborhood; dir(*) is the direction factor; dst(*) is the geometric distance factor, and lev(*) is the level set distance factor.

[0024] The design of the generator in the RTGAN network in step 3 is as follows:

[0025] The generator adopts a codec structure, which consists of three downsampling layers, five intermediate layers, and three upsampling layers. Strided convolution is used in upsampling and downsampling.

[0026] (1) The design of the five intermediate layers in the generator includes:

[0027] The main body of the network is composed of 5 residual blocks, which are defined as:

[0028] Y out =C(C(Y in ))+Y in

[0029] Among them, Y in is the input of the current residual block, the convolution feature of the input layer output in the first residual block, the output of the previous residual block in the remaining four residual blocks, C(·) is the convolution operation, and Y ouc is the output result of the residual block;

[0030] Each residual block contains two 3×3 convolutional layers. Batch normalization and ReLu activation function are added after the first convolutional layer. The BN of the second convolutional layer is placed before addition to avoid the data distribution of the layer being transformed by the BN layer and changing the original input. The ReLu activation function is added after addition. Then the residual blocks are cascaded to further enhance the color detail information of the image. The residual cascade structure is defined as:

[0031] R out =res5(C in )

[0032] Among them, res5(·) represents the cascade operation of 5 layers of residual blocks, C in is the output result of the input layer, R out is the output result of the residual block cascade;

[0033] (2) The design of upsampling and downsampling layers includes:

[0034] At the beginning of the network, the image is padded with boundary reflection to make the input and output of the network have the same size; batch normalization BN and ReLu nonlinear activation functions are added after all convolutional layers of the downsampling layer and upsampling layer; the first downsampling layer uses a 9×9 convolution kernel, and the remaining two downsampling layers use a 3×3 convolution kernel. The output features of each convolution layer are expressed as:

[0035] x i =H i (x i-1 )i=1,2,3

[0036] Among them, H i (·) represents Conv-ReLu operation; i represents the i-th convolutional layer; x i Represents the output features of the i-th convolutional layer;

[0037] In the upsampling layer, the network uses two deconvolution layers, and the output layer uses the tanh activation function to ensure that the output pixels are in the range of [0, 255];

[0038] (3) The discriminator in the RTGAN network uses the resnet18 network, and the loss function uses BCELoss.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] The present invention proposes an endoscopic exposure frame repair method based on an adversarial neural network RTGAN. The exposure frame detection and repair problem in the endoscope is converted into its alternative problem: the problem of coloring video frames in black and white mode. This is because during exposure, the black and white video stream can save more image detail information than the color video stream. Therefore, after the black and white video stream is obtained, each frame of the image can be colorized to achieve the purpose of exposure frame repair. The present invention proposes a real-time colorization method, which can perform real-time colorization on the endoscopic video stream under black and white imaging. First, the smoothness of the surgical video of the exposure frame is deleted by the difference in histograms between frames, and a fast marching algorithm is introduced to perform highlight repair to improve the authenticity of the coloring. At the same time, a real-time colorization network RTGAN is proposed, and strided convolution is introduced in the pooling layer of the GAN network to reduce the number of parameters and the amount of calculation, thereby ensuring the requirements for real-time colorization of surgical videos. Reference Figure 5 The experimental results of the method of the present invention compared with five colorization networks show that RTGAN only takes 0.026s to colorize a single frame image, the colorization speed is increased by up to 67 times, and the peak signal-to-noise ratio (PSNR) is 34.04. It can perform real-time colorization processing on blue-light laser knife surgery videos and obtain satisfactory visual quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a flow chart of the method of the present invention;

[0042] Figure 2 Schematic diagram of the generator of RTGAN in the present invention;

[0043] Figure 3 RB is a structural diagram of the residual block used in the present invention;

[0044] Figure 4 It is a test effect diagram of the present invention;

[0045] Figure 5 1 is a comparison chart of the results of various methods in the embodiments of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0047] See also Figure 1 The present invention is a method for repairing exposure frames under endoscope based on adversarial neural network RTGAN, and the image processing method comprises:

[0048] Step 1: Change the endoscope imaging mode to black and white mode, obtain the endoscope video stream under black and white light, delete the exposed frames by the inter-frame histogram difference, and repair the highlights with the fast marching algorithm.

[0049] (1) The steps of deleting the exposure frame by using the inter-frame histogram difference are:

[0050] In the black-and-white image sequence, the frame before the start of exposure is taken as a normal frame, and the brightness mean T of the frame is calculated, and T is the exposure threshold; in the black-and-white image sequence, the brightness mean X1, X2, X3, ... Xn of the remaining frames are calculated. If the brightness mean Xi of the i-th frame image is greater than T, the algorithm determines that the frame is an overexposed frame and discards it, and then uses the copy frame of the previous frame to fill the frame. Among them, whether the exposure starts can be calculated by physical signals or algorithms.

[0051] (2) The steps for repairing highlights using the fast marching algorithm are:

[0052] Set the highlight threshold as S, and initialize a mask zero matrix M of the same size as the video frame; use S as the threshold to divide the brightness of each pixel in the image, and set the value of the corresponding position in M ​​to 1 for pixels greater than S, otherwise to 0; obtain the mask M after threshold segmentation, and the position with a value of 1 in the mask M is the highlight area that needs to be repaired;

[0053] Assume that the pixel to be repaired is p, u(i) represents the gray value of pixel i, and B is specified as e (p) is a neighborhood of size e around P, B e The contribution u of pixel q to p in (p) q (p) is defined as:

[0054]

[0055] in, Represents the gradient value of q, then the gray value calculation formula of P to be repaired is as follows:

[0056]

[0057] Among them, B e (p) is the 8-neighborhood of P, and the weight w(p, q) is obtained using the following formula:

[0058] W(p, q)=dir(p, q)·dst(p, q)·lev(p, q)

[0059] W(*) represents the weight function, which is used to limit the contribution of each pixel in the neighborhood; dir(*) is the direction factor; dst(*) is the geometric distance factor, and lev(*) is the level set distance factor.

[0060] Step 2: Use the video stream collected when the endoscope imaging mode is in color to train the RTGAN colorization network.

[0061] First, the collected color video stream is deframed and the preprocessing operations in step 1 are performed, including deleting the exposed frames and repairing the highlights. The preprocessed color frames and the black-and-white frames corresponding to the color frames are used as the input training model of the RTGAN until the model training reaches the stop condition.

[0062] Step 3: The coloring network RTGAN consists of a generator and a discriminator. The generator uses the cascaded residual module structure as the backbone and introduces strided convolution to learn its own spatial upsampling. Figure 2 .

[0063] The generator adopts a self-designed codec structure, which consists of three downsampling layers, five intermediate layers, and three upsampling layers. In upsampling and downsampling, strided convolution is used instead of traditional pooling operations to improve efficiency and learning ability.

[0064] (1) The design of the five intermediate layers in the generator includes:

[0065] The main body of the network is composed of 5 residual blocks, see Figure 3 , which is defined as:

[0066] Y out =C(C(Y in ))+Y in

[0067] Among them, Y in is the input of the current residual block, the convolution feature of the input layer output in the first residual block, the output of the previous residual block in the remaining four residual blocks, C(·) is the convolution operation, and Y out is the output result of the residual block;

[0068] Each residual block contains two 3×3 convolutional layers. Batch normalization and ReLu activation function are added after the first convolutional layer. The BN of the second convolutional layer is placed before addition to avoid the data distribution of the layer being transformed by the BN layer and changing the original input. The ReLu activation function is added after addition. Then the residual blocks are cascaded to further enhance the color detail information of the image. The residual cascade structure is defined as:

[0069] R out =res S (C in )

[0070] Among them, res5(·) represents the cascade operation of 5 layers of residual blocks, C in is the output result of the input layer, Rout It is the output result of the residual block cascade.

[0071] (2) The design of upsampling and downsampling layers includes:

[0072] The input of the RTGAN network is 256*256*1, and the output is 256*256*2. At the beginning of the network, the image is padded with boundary reflection to make the input and output of the network have the same size. Batch normalization BN and ReLu nonlinear activation functions are added after all convolution layers in the downsampling layer and upsampling layer. The first downsampling layer uses a 9×9 convolution kernel, and the remaining two downsampling layers use a 3×3 convolution kernel, see Figure 2 , the output features of each convolutional layer are expressed as:

[0073] x i =H i (x i-1 )i=1,2,3

[0074] Among them, H i (·) represents Conv-ReLu operation; i represents the i-th convolutional layer; x i Represents the output features of the i-th convolutional layer.

[0075] In the upsampling layer, the network of the present invention uses two deconvolution layers, and the output layer uses the tanh activation function to ensure that the output pixels are within the range of [0, 255].

[0076] (3) The discriminator in the RTGAN network uses the resnet18 network, and the loss function uses BCELoss.

[0077] The loss of the discriminator uses BCEloss, which is the cross entropy of the two categories. The returned difference is used to update the generator. The loss of the discriminator is the average of the generated BCE and the true value BCE. The specific formula is as follows:

[0078] l n =-ω n [y n log x n +(1-y n )·log(1-x n )]

[0079] Where x represents the output of the model, x = (x1, ..., x n ); vector x represents a batch, n represents batch_size; ln represents the loss of each sample in a batch; w n Represents different weights for different samples. For a batch, the following loss vector will be obtained:

[0080] l(x, y) = L = l1, ..., l N T

[0081] Finally, the loss vector is averaged to get the final loss value.

[0082] Step 4: Use the trained RTGAN generator to perform real-time colorization on the black-and-white image frames preprocessed in step 1. The results are shown in Figure 4 And synthesize the colored video frames into the normal surgical video stream.

[0083] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for repairing exposure frames under endoscope based on adversarial neural network RTGAN, characterized in that: The following steps are involved: Step 1: Change the endoscope imaging mode to black and white mode, obtain the endoscope video stream under black and white light, delete the exposed frames by the inter-frame histogram difference, and repair the highlights by the fast marching algorithm; Step 2: Use the video stream collected when the endoscope imaging mode is in color to train the RTGAN colorization network: First, the collected color video stream is deframed and the preprocessing operation in step 1 is performed, including deleting the exposed frame and repairing the highlight points. The preprocessed color frame and the black-and-white frame corresponding to the color frame are used as the input training model of the RTGAN until the model training reaches the stop condition. Step 3: The coloring network RTGAN consists of a generator and a discriminator; the generator uses the cascaded structure of residual modules as the backbone and introduces strided convolution to learn its own spatial upsampling; Step 4: Use the generator in the trained RTGAN to colorize the black-and-white image frames preprocessed in step 1 in real time, and synthesize the colored color video frames into a normal surgical video stream.

2. According to claim 1, the method for repairing exposure frames under endoscope based on adversarial neural network RTGAN is characterized in that: The image preprocessing method in step 1 includes operations of deleting the exposure frame and repairing the highlight points. The specific method is as follows: (1) The steps of deleting the exposure frame by using the inter-frame histogram difference are: In the black-and-white image sequence, the frame before the exposure starts is taken as the normal frame, and the brightness mean T of the frame is calculated, and T is the exposure threshold; in the black-and-white image sequence, the brightness mean X1, X2, X3...Xn of the remaining frames are calculated; If the brightness mean Xi of the i-th frame image is greater than T, the algorithm determines that the frame is an overexposed frame and discards it, and then uses the copy frame of the previous frame to fill the frame; wherein, whether the exposure starts is obtained through physical signals or algorithm calculations; (2) The steps for repairing highlights using the fast marching algorithm are: Set the highlight threshold as S, and initialize a mask zero matrix M of the same size as the video frame; use S as the threshold to divide the brightness of each pixel in the image, and set the value of the corresponding position in M ​​to 1 for pixels greater than S, otherwise to 0; obtain the mask M after threshold segmentation, and the position with a value of 1 in the mask M is the highlight area that needs to be repaired; Assume that the pixel to be repaired is p, u(i) represents the gray value of pixel i, and B is specified as e (p) is a neighborhood of size e around P, B e The contribution u of pixel q to p in (p) q (p) is defined as: in, Represents the gradient value of q, then the gray value calculation formula of P to be repaired is as follows: Among them, B e (p) is the 8-neighborhood of P, and the weight w(p, q) is obtained using the following formula: w(p, q)=dir(p, q)·dsq(p, q)·lev(p, q) W(*) represents the weight function, which is used to limit the contribution of each pixel in the neighborhood; dir(*) is the direction factor; dst(*) is the geometric distance factor, and lev(*) is the level set distance factor.

3. The endoscopic exposure frame repair method based on the adversarial neural network RTGAN according to claim 1 is characterized in that: The design of the generator in the RTGAN network in step 3 is as follows: The generator adopts a codec structure, which consists of three downsampling layers, five intermediate layers, and three upsampling layers. Strided convolution is used in upsampling and downsampling. (1) The design of the five intermediate layers in the generator includes: The main body of the network is composed of 5 residual blocks, which are defined as: Y out =C(C(Y in ))+Y in Among them, Y in is the input of the current residual block, the convolution feature of the input layer output in the first residual block, the output of the previous residual block in the remaining four residual blocks, C(·) is the convolution operation, and Y out is the output result of the residual block; Each residual block contains two 3×3 convolutional layers. Batch normalization and ReLu activation function are added after the first convolutional layer. The BN of the second convolutional layer is placed before addition to avoid the data distribution of the layer being transformed by the BN layer and changing the original input. The ReLu activation function is added after addition. Then the residual blocks are cascaded to further enhance the color detail information of the image. The residual cascade structure is defined as: R out =res s (C in ) Among them, res5(·) represents the cascade operation of 5 layers of residual blocks, C in is the output result of the input layer, R out is the output result of the residual block cascade; (2) The design of upsampling and downsampling layers includes: At the beginning of the network, the image is padded with boundary reflection to make the input and output of the network have the same size; batch normalization BN and ReLu nonlinear activation functions are added after all convolutional layers of the downsampling layer and upsampling layer; the first downsampling layer uses a 9×9 convolution kernel, and the remaining two downsampling layers use a 3×3 convolution kernel. The output features of each convolution layer are expressed as: x i =H i (x i-1 )i=1,2,3 Among them, H i (·) represents Conv-ReLu operation; i represents the i-th convolutional layer; x i Represents the output features of the i-th convolutional layer; In the upsampling layer, the network uses two deconvolution layers, and the output layer uses the tanh activation function to ensure that the output pixels are in the range of [0,255]; (3) The discriminator in the RTGAN network uses the resnet18 network, and the loss function uses BCELoss.