An indocyanine green fluorescence image classification and recognition method based on diffusion model and contrast learning

By introducing a self-supervised pre-trained contrastive learning and diffusion model into a deep learning classification network to generate image samples, the problem of insufficient samples in ICG image classification is solved, and efficient classification results are achieved with fewer samples.

CN117115500BActive Publication Date: 2026-02-03BEIJING UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310299982.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-25
Publication Date
2026-02-03
Estimated Expiration
2043-03-25

AI Technical Summary

Technical Problem

Existing deep learning-based ICG image processing methods struggle to obtain a sufficient number of high-quality samples in clinical practice, resulting in poor classification performance. Diffusion models and contrastive learning have not yet been fully developed in medical imaging, especially ICG image applications.

Method used

Introducing self-supervised pre-training contrastive learning into traditional deep learning classification networks, and generating more image samples through a diffusion model, the model is trained using the diffusion model and contrastive learning methods to improve classification performance.

Benefits of technology

By combining diffusion model with contrastive learning, better ICG image classification results can be achieved with fewer training samples, thus improving classification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117115500B_ABST
    Figure CN117115500B_ABST
Patent Text Reader

Abstract

The application discloses an indocyanine green fluorescence image classification and recognition method based on a diffusion model and contrast learning, and comprises the following steps: step one, collecting indocyanine green fluorescence images as a data set; step two, inputting the images obtained in step one into a diffusion model network after cutting and scaling processing, and training a diffusion model; step three, training a contrast learning model based on the diffusion model based on the pre-trained diffusion model in step two; and step four, fine-tuning the model in step three, and detecting and classifying indocyanine green fluorescence images. The application learns the distribution between real samples by using the diffusion model, and fits the real distribution by using the learned distribution, thereby solving the problems of low data set quality and insufficient samples, and improving the classification ability of the model for indocyanine green fluorescence images.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of medical image classification in computer vision, and particularly relates to an indocyanine green fluorescence image classification and recognition method based on a diffusion model and contrast learning. BACKGROUND

[0002] Indocyanine green (hereinafter referred to as ICG) is a fluorescent dye commonly used in fluorescence imaging, especially near-infrared fluorescence imaging technology (NIRF), in the biomedical field. In NIRF, ICG is injected into animals or human bodies, which binds to proteins, cells and tissues, and emits a fluorescence signal after being irradiated by a laser light source, thereby generating an image, and is therefore widely used in aspects such as tissue blood supply evaluation, tumor positioning, and lymph node tracing. However, due to the lack of equipment and personnel, hospitals often need to consume a lot of resources to obtain and analyze ICG images. Existing ICG image processing methods based on deep learning usually use classification networks based on convolutional neural networks, such as ResNet-50, VGG-19, etc. In the training process of these networks, a large number of samples are often needed for training, but it is difficult to obtain enough high-quality ICG image samples in clinical practice. At present, diffusion models have achieved significant results in general image generation tasks, and self-supervised tasks based on contrast learning have also achieved significant results in tasks with small sample sizes, but further development is still needed in the application scenarios of medical images, especially ICG images. SUMMARY

[0003] Therefore, the present application proposes an ICG image classification and recognition method based on a diffusion model and contrast learning to address the shortcomings of existing ICG image classification and recognition technologies. Specifically, contrast learning based on self-supervised pre-training methods is introduced into traditional deep learning classification networks, and a diffusion model is trained to generate more images to expand the sample size, thereby achieving better classification results with fewer training samples. The specific technical method is as follows:

[0004] An indocyanine green fluorescence image classification and recognition method based on a diffusion model and contrast learning, the specific steps are as follows:

[0005] Step one, collect indocyanine green fluorescence images as a data set;

[0006] Step two, input the images of step one into the diffusion model network after cropping and scaling processing, and train the diffusion model;

[0007] Step three, train the contrast learning model based on the diffusion model based on the pre-trained diffusion model in step two;

[0008] Step four: Fine-tune the model from step three, and detect and classify the indocyanine green fluorescence images.

[0009] Preferably, step two is as follows:

[0010] S21: The collected indocyanine green fluorescence images have various resolutions, with common resolutions including 720*576, 944*1080, and 1920*1080. To ensure size uniformity and reduce the cost of model training and inference, they are uniformly compressed to 224*224.

[0011] S22: Define q(x) as the distribution followed by the ICG images acquired in step one. The diffusion model is mainly based on the denoising diffusion probability model method. The denoising diffusion probability model includes the diffusion process and the reverse diffusion process. For the diffusion process, an image sample x0 is randomly selected from the training set, i.e., x0 ~ q(x). Define t as the time step in the diffusion process and f as the number of time steps in the diffusion process. The diffusion process gradually adds Gaussian noise within T time steps starting from time step 0. Each step will generate a sample x1, x2, ..., x with added noise. T Define the diffusion rate sequence β1, ..., β T During the diffusion process, the step of adding Gaussian noise is controlled by the aforementioned diffusion rate sequence. Let I be a d-dimensional identity matrix, where d is the dimension of the ICG image obtained in step S21. For a sample x... t-1 Diffusion to x t The process satisfies the conditional distribution q(x) t |x t-1 ),have:

[0012]

[0013] Where q(x) t |x t-1 Let be the distribution followed from step t-1 to step t. Let β represent a Gaussian distribution. t Let be the diffusion rate sequence at step t. At this point, based on parameter renormalization and the properties of Markov chains, let α... t =1-β t α t product Take any noise Then x can be obtained directly. t The analytical expression:

[0014]

[0015] For the reverse diffusion process, it follows a standard Gaussian distribution. Initially, Gaussian noise is added incrementally to reconstruct the distribution of the original dataset q(x), where each step is q(x) t-1 |x t ). q(x t-1 |x t This distribution is difficult to obtain directly, so a fitted likelihood distribution p is used. θ In order to facilitate the reverse diffusion process, p θ Training is performed using U-net, i.e.:

[0016]

[0017] Where p θ (x t-1 |x t ) indicates from x t To x t-1 The process follows a distribution. Where sample x t The mean at step t is μ θ (x t ,t), with variance σ θ (x t ,t), where θ are the trainable parameters of the U-net network.

[0018] In the training of the reverse diffusion process, for p θ (x t-1 |x t This can be further simplified by incorporating the variance σ during training. θ (x t With t) fixed, only the U-net network needs to predict p. θ mean v θ (x t In the denoising diffusion probability model, the mean can be predicted by predicting the noise ∈, and formula (2) can be written as:

[0019]

[0020] Where x t For the predicted samples at step t, the loss function L of the final denoising diffusion probability model is... loss for:

[0021]

[0022] in Describe x ~ q(x) and The mathematical expectation of t, where x is a sample sampled from the dataset, q(x) is the distribution corresponding to the dataset, ∈ is the true noise when obtaining the diffused sample corresponding to step t, ∈0(x t ,t) represents the noise predicted by the neural network.

[0023] S23: Training and Sampling. Randomly select a step size t, apply noise to each image in the training set according to Equation 4, and convert t into a time-coded representation that is embedded into the input. Here, the noise predicted by the model is ∈ θ (x t ,t),∈ represents the true noise when obtaining the diffusion sample corresponding to step t; next, the U-net network is used to predict the noise, and gradient descent is performed according to formula 5 to update the loss function, that is, the denoising diffusion probability model is obtained, which can be used for image generation; the generation process randomly samples a noisy image from the standard normal distribution, and then iterates from step T, removing the noise predicted by the model in step t in each step, and after completing the iteration, a generated image is obtained.

[0024] Preferably, step three is as follows:

[0025] S31: Sample Preprocessing. First, the image is compressed to 256*256 pixels. Then, an arbitrary 224*224 pixel image is cut from the original image and used as the final input to the neural network. To enhance the learning and generalization capabilities of the neural network, image enhancement is applied to each image. Image enhancement methods include horizontal flipping, vertical flipping, adjusting brightness, saturation, and contrast, and randomly adding Gaussian noise.

[0026] S32: For an image sample x that has undergone preprocessing in step S31, apply image enhancement twice randomly, as described in S31. The image after the two enhancements is called x. i and x j Simultaneously, an image x is generated using the diffusion model from step two. diff "Diff" stands for the first four letters of "diffusion," meaning diffusion, and it is used to enhance the image.

[0027] S33: Take the three ICG images obtained in step S32 and x i x j x aiff The image is input into the encoder network f(·), and after passing through the encoder f(·), the input sample is converted into a 2048-dimensional vector h. i h j and h diff Obtain h i h j and h diff Then, h i h j and h diffThe vector is fed into the projection head g(·), which consists of two fully connected layers. This mapping transforms the input vector from 2048 dimensions to 128 dimensions. After passing through the projection head g(·), a 128-dimensional vector z is obtained. i , z j and z diff Then calculate z respectively i , z j and z diff The cosine similarity between them. The formula for calculating the cosine similarity (sim) is:

[0028]

[0029] Where τ is a temperature coefficient to control the output range of cosine similarity, u and v are the input vectors, T represents transpose, and || represents the magnitude of the vector.

[0030] The final loss function l sim for:

[0031]

[0032] Where α is the diffusion coefficient, used to determine the degree to which the model learns to generate images, and N is the number of samples in a batch during training, then exp(x) represents e raised to the power of x, 1 k≠i This means that 1 is taken when k is not equal to i, and 0 is taken otherwise. Finally, the positions of the same pair of images are swapped, and the batch loss is calculated and averaged:

[0033]

[0034] Using Equation (8) as the loss function in the contrastive learning phase, the encoder f(·) and projectionheadg(·) are trained to minimize L, gradients are performed, and the loss function is updated.

[0035] Preferably, step four is as follows:

[0036] S41: For the model based on diffusion model and contrastive learning as described in claim 4, after completing the training of the contrastive learning stage, the model discards the projection headg(·) and retains only the encoder f(·), and then connects a fully connected layer after f(·) as a classifier.

[0037] S42: Input a sample x from the dataset into the model and perform data augmentation on it.

[0038] S43: Input x into the encoder f(·) to obtain the high-dimensional vector h, then feed h into the fully connected layer, and use the Softmax function to obtain the probability of whether the classifier classifies sample x as a positive image. The formula for the Softmax function is:

[0039]

[0040] Among them, v i This represents the probability that the result belongs to the i-th class. For v i The natural constant exponent is represented by ∑ j e j This represents the sum of the natural constant exponents of the probabilities of all classes. During the training phase of classification, the cross-entropy function is used as the loss function. The formula for the cross-entropy function is:

[0041]

[0042] Where p(x) i ) is the sample x i The true label, q(x) i The model obtained after applying the Softmax function is the model for x. i The probability of being predicted as belonging to that category. Attached Figure Description

[0043] Figure 1 The specific process of this method

[0044] Figure 2 The model structure of this method

[0045] Figure 3 A schematic diagram of the generation and sampling process for the denoising diffusion probability model. Detailed Implementation

[0046] To better explain the methods described in this invention, the technical solution of this invention will be further explained and described below in conjunction with the accompanying drawings and specific embodiments. Through this specification, those skilled in the art can quickly understand the principles and functions of this invention, and can implement and apply it through other specific methods. It should be noted that, without conflict, the embodiments and features described below can be combined with each other. The embodiments described below elaborate on some details in model data acquisition and training to provide a more thorough understanding of this invention. These details are limited by the performance of the equipment used in this embodiment. However, this invention can also be implemented using other embodiments different from those in this specification. Therefore, the scope of protection of this invention is not limited to the specific embodiments described below.

[0047] Specifically, this invention provides a method for classifying and recognizing indocyanine green fluorescence images based on a diffusion model and contrastive learning, such as... Figure 1 The following specific implementation details are shown:

[0048] Step 1: Collect indocyanine green fluorescence images as a dataset;

[0049] Specifically, the images used in this embodiment were all acquired by doctors using professional handheld devices. In this embodiment, the images collected were from patients with upper limb lymphedema following breast cancer prognosis. The dataset includes ICG fluorescence images of lymphedema from 194 breast cancer patients with upper limb lymphedema. Each patient has images from seven sites, with at least three images for each site: back of hand, wrist-10cm above the wrist, 10cm above the wrist-elbow, elbow, elbow-10cm above the elbow, 10cm above the elbow-axillary, and axilla. Images that have developed edema are labeled 1, and images that have not developed edema are labeled 0. There are 119 patients with edema, totaling 2523 images, and 75 patients without edema, totaling 1605 images.

[0050] Step two: After cropping and scaling the image from step one, input it into the diffusion model network for training.

[0051] Practice diffusion models;

[0052] S21: The collected indocyanine green fluorescence images have various resolutions, with common resolutions including 720*576, 944*1080, and 1920*1080. To ensure uniform size and reduce the cost of model training and inference, they are uniformly compressed to 224*224. Preferably, the 4128 images collected in step one are used as the training set for the diffusion model.

[0053] S22: Define q(x) as the distribution followed by the ICG images acquired in step one. The diffusion model is mainly based on the denoising diffusion probability model method. The denoising diffusion probability model includes a diffusion process and a reverse diffusion process. For the diffusion process, an image sample x0 is randomly selected from the training set, i.e., x0 ~ q(x). Define t as the time step in the diffusion process and T as the time number of the diffusion process. The diffusion process gradually adds Gaussian noise within T time steps starting from time step 0. Preferably, T is set to 1000 in this embodiment. Each step will generate a sample x1, x2, ..., x with added noise. T Define the diffusion rate sequence β1, ..., β r Preferably, in this embodiment, β1 is set to 0.0001 and increases linearly to β. T0.02. During the diffusion process, the step of adding Gaussian noise is controlled by the aforementioned diffusion rate sequence. Let I be a d-dimensional identity matrix, where d is the dimension of the ICG image obtained in step S21. According to step S21, in this embodiment, preferably, d is 224-dimensional. For a sample x... t-1 Diffusion to x t The process satisfies the conditional distribution q(x) t |x t-1 ),have:

[0054]

[0055] Where q(x) t |x t-1 Let be the distribution followed from step t-1 to step t. Let β represent a Gaussian distribution. t Let be the diffusion rate sequence at step t. At this point, based on parameter renormalization and the properties of Markov chains, let α... t =1-β t α t product Take any noise Then x can be obtained directly. t The analytical expression:

[0056]

[0057] For the reverse diffusion process, it follows a standard Gaussian distribution. Initially, Gaussian noise is added incrementally to reconstruct the distribution of the original dataset q(x), where each step is q(x) t-1 |x t ). q(x t-1 |x t This distribution is difficult to obtain directly, so a fitted likelihood distribution p is used. θ In order to facilitate the reverse diffusion process, p θ Training is performed using U-net, i.e.:

[0058]

[0059] Where p θ (x t-1 |x t ) indicates from x t To x t-1 The process follows a distribution. Where sample x t The mean at step t is μ θ (x t ,t), with variance σ θ (x t,t), where θ are the trainable parameters of the U-net network.

[0060] In the training of the reverse diffusion process, for p θ (x t-1 |x t This can be further simplified by incorporating the variance σ during training. θ (x t With t) fixed, only the U-net network needs to predict p. θ mean v θ (x t In the denoising diffusion probability model, the mean can be predicted by predicting the noise ∈, and formula (2) can be written as:

[0061]

[0062] Where x t For the predicted samples at step t, the loss function L of the final denoising diffusion probability model is... loss for:

[0063]

[0064] in Describe x ~ q(x) and The mathematical expectation of t, where x is a sample sampled from the dataset, q(x) is the distribution corresponding to the dataset, ∈ is the true noise when obtaining the diffused sample corresponding to step t, ∈0(x t ,t) represents the noise predicted by the neural network.

[0065] S23: Training and Sampling. Randomly select a step size t, apply noise to each image in the training set according to Equation 4, and convert t into a time-coded representation that is embedded into the input. Here, the noise predicted by the model is ∈ θ (x t Let ,t), ∈ be the true noise when obtaining the diffusion sample corresponding to step t; next, the U-net network is used to predict the noise, and gradient descent is performed according to formula 5 to update the loss function, thus obtaining the denoising diffusion probability model, which can be used for image generation; the generation process randomly samples a noisy image from the standard normal distribution, and then iterates from step T, removing the noise predicted by the model in step t in each step, and obtaining a generated image after completing the iteration. Figure 3 The diagram illustrates a single sampling process. In this embodiment, the training run consists of 200 epochs, with a batch size of 5 per epoch. This means that 5 images in each batch are sampled and diffused by the denoising diffusion probability model during training. During the generation phase, T is set to 1, representing the generation of 1 image, which is x. diffThe size of the generated image is set to 224*224, which is consistent with the image size of the input model.

[0066] Step 3: Train a contrastive learning model based on the diffusion model pre-trained in Step 2;

[0067] S31: Sample Preprocessing. First, the image is compressed to a size of 256*256. Then, an arbitrary 224*224 image is cut from the original image and used as the final input to the neural network. To enhance the learning and generalization capabilities of the neural network, image enhancement is applied to each image. Image enhancement methods include horizontal flipping, vertical flipping, adjusting brightness, saturation, and contrast, and randomly adding Gaussian noise. In this embodiment, the image enhancement method uses the transforms image processing function provided in the PyTorch deep learning open-source framework.

[0068] S32: For an image sample x that has undergone preprocessing in step S31, apply image enhancement twice randomly, as described in S31. The image after the two enhancements is called x. i and x j Simultaneously, an image x is generated using the diffusion model from step two. diff "Diff" stands for the first four letters of "diffusion," meaning diffusion, and it is used to enhance the image.

[0069] S33: Take the three ICG images obtained in step S32 and x i x j x diff The input samples are fed into the encoder network f(·). In this embodiment, preferably, a ConvNeXt_Small network is used as the encoder network. After the image passes through the encoder f(·), the input samples are converted into a 2048-dimensional vector h. i h j and h diff Obtain h i h j and h diff Then, h i h j and h diff The vector is fed into the projection head g(·), which consists of two fully connected layers. This mapping transforms the input vector from 2048 dimensions to 128 dimensions. After passing through the projection head g(·), a 128-dimensional vector z is obtained. i , z j and z diff Then calculate z respectively i , z jand z diff The cosine similarity between them. The formula for calculating the cosine similarity (sim) is:

[0070]

[0071] Where τ is a temperature coefficient to control the output range of cosine similarity, u and v are the input vectors, T represents transpose, and || represents the magnitude of the vector.

[0072] The final loss function l sim for:

[0073]

[0074] Where α is the diffusion coefficient, used to determine the degree to which the model learns to generate images, and N is the number of samples in a batch during training, then exp(x) represents e raised to the power of x, 1 k≠i This means that 1 is taken when k is not equal to i, and 0 is taken otherwise. Finally, the positions of the same pair of images are swapped, and the batch loss is calculated and averaged:

[0075]

[0076] Formula (8) is used as the loss function in the contrastive learning stage. The encoder f(·) and projectionhead g(·) are trained to minimize L, gradients are calculated, and the loss function is updated. In this embodiment, preferably, the number of samples N in each batch is set to 64, the number of training epochs is 500, the initial learning rate is set to 0.001, and the learning rate is decayed to 65% of the original every 100 epochs. The optimization algorithm uses AdamW, and the weight decay is set to 0.000001. In the contrastive learning method based on the diffusion model, we want the network to have the same weights for generated images and real images, so the diffusion coefficient α is set to 1, and the temperature coefficient τ of cosine similarity is set to 0.5.

[0077] Step four: Fine-tune the model from step three, and detect and classify the indocyanine green fluorescence images.

[0078] S41: For the model based on diffusion model and contrastive learning as described in claim 4, after completing the training of the contrastive learning stage, the model discards the projection headg(·) and retains only the encoder f(·), and then connects a fully connected layer after f(·) as a classifier.

[0079] S42: Input a sample x from the dataset into the model and perform data augmentation. The data augmentation method is as described in step S21.

[0080] S43: Input x into the encoder f(·) to obtain the high-dimensional vector h, then feed h into the fully connected layer, and use the Softmax function to obtain the probability of whether the classifier classifies sample x as a positive image. The formula for the Softmax function is:

[0081]

[0082] Among them, v i This represents the probability that the result belongs to the i-th class. For v i The natural constant exponent is represented by ∑ j e j This represents the sum of the natural constant exponents of the probabilities of all classes. During the training phase of classification, this patent uses the cross-entropy function as the loss function. The formula for the cross-entropy function is:

[0083]

[0084] Where p(x) i ) is the sample x i The true label, q(x) i The model obtained after applying the Softmax function is the model for x. i The probability of being predicted as belonging to that category.

[0085] In the classifier training stage, preferably, the training and test sets are divided in a 4:1 ratio in this embodiment. The batch size during training is set to 128, the model training epochs are 200, the initial learning rate is set to 0.001, and the learning rate decays to 65% of its original value every 50 epochs. The optimization algorithm used is AdamW, with weight decay set to 0.000001.

[0086] To verify the effectiveness of the indocyanine green fluorescence image recognition method based on diffusion model and contrastive learning, a set of comparative verification experiments were designed. First, three common deep learning classification networks were used to train and test the ICG dataset in this embodiment. The average result was 63.2%, while the result of this invention was 82.1%, showing a significant improvement. The evaluation metric used in this embodiment is accuracy, and its formula is as follows:

[0087]

[0088] TP represents a true positive, TN represents a true negative, FP represents a false positive, and FN represents a false negative.

[0089] Table 1 shows the experimental results comparing the proposed method with traditional deep learning classification networks.

[0090]

[0091] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for classifying and recognizing indocyanine green fluorescence images based on a diffusion model and contrastive learning, characterized in that, Includes the following steps: Step 1: Collect indocyanine green fluorescence images as a dataset; Step 2: After cropping and scaling the image from Step 1, input it into the diffusion model network to train the diffusion model; Step 3: Train a contrastive learning model based on the diffusion model pre-trained in Step 2; Step three includes the following steps: S31: Sample preprocessing; First, compress the image to a size of 256*256, then arbitrarily cut a 224*224 image from the image as the final input to the neural network; apply image enhancement to each image; S32: For an image sample x that has undergone preprocessing in step S31, randomly apply image enhancement twice. The enhanced image is x. i and x j Simultaneously, an image x is generated using the diffusion model from step two. diff diff stands for the first four letters of diffusion, meaning diffusion, and it is used to enhance the image as well. S33: Take the three ICG images obtained in step S32 and x i x j x diff The image is input into the encoder network f(·), and after passing through the encoder f(·), the input sample is converted into a 2048-dimensional vector h. i ,h j and h diff ; obtain h i ,h j and h diff Then, h i ,h j and h diff The vector is fed into the projection head g(·), which consists of two fully connected layers. This mapping transforms the input vector from 2048 dimensions to 128 dimensions. After passing through the projection head g(·), a 128-dimensional vector z is obtained. i ,z j and z diff Then calculate z respectively i ,z j and z diff The cosine similarity between them; the formula for calculating the cosine similarity sim is: Where τ is a temperature coefficient to control the output range of cosine similarity, u and v are the input vectors respectively, T represents transpose, and || represents the magnitude of the vector; The final loss function l sim for: Where α is the diffusion coefficient, N is the number of samples in a batch during training, and exp(x) represents e raised to the power of x, 1 k≠i This means that 1 is taken when k is not equal to i, and 0 is taken otherwise; finally, the positions of the same pair of images are swapped, and the loss of a batch is calculated and averaged: Using Equation (8) as the loss function in the contrastive learning phase, the encoder f(·) and projection headg(·) are trained to minimize L, gradients are performed, and the loss function is updated. Step four: Fine-tune the model from step three, and detect and classify the indocyanine green fluorescence images.

2. The indocyanine green fluorescence image classification and recognition method based on diffusion model and contrastive learning according to claim 1, the implementation sub-steps of step two are as follows: S21: The collected indocyanine green fluorescent ICG images have multiple resolutions, which are uniformly compressed to 224*224; S22: Define q(x) as the distribution followed by the ICG images acquired in step one, and the diffusion model is based on the denoising diffusion probability model method; The denoising diffusion probability model includes the diffusion process and the reverse diffusion process; For the diffusion process, an image sample x0 is randomly selected from the training set, i.e., x0 ~ q(x). t is defined as the time step in the diffusion process, and T is the time count of the diffusion process. Gaussian noise is gradually added to the image within T time steps starting from time step 0. Each step corresponds to generating a sample x1, x2, ..., x with added noise. T Define the diffusion rate sequence β1,…,β T During the diffusion process, the step of adding Gaussian noise is controlled by the aforementioned diffusion rate sequence; let I be a d-dimensional identity matrix, where d is the dimension of the ICG image obtained in step S21; for a sample x t-1 Diffusion to x t The process satisfies the conditional distribution q(x) t |x t-1 ),have: Where q(x) t |x t-1 Let be the distribution followed from step t-1 to step t. Let β represent a Gaussian distribution. t Let be the diffusion rate sequence at step t; at this point, based on parameter renormalization and the properties of Markov chains, let α... t =1-β t α t product Take any noise Then x is obtained directly. t The analytical expression: For the reverse diffusion process, it follows a standard Gaussian distribution. Initially, Gaussian noise is added incrementally to reconstruct the distribution of the original dataset q(x), where each step is q(x)... t-1 |x t );q(x t-1 |x t This distribution is difficult to obtain directly, so a fitted likelihood distribution p is used. θ In order to facilitate the reverse diffusion process, p θ Training is performed using U-net, i.e.: Where p θ (x t-1 |x t ) indicates from x t To x t-1 The process follows a distribution. Where sample x t The mean at step t is μ θ (x t ,t), with variance σ θ (x t ,t), where θ is the trainable parameters of the U-net network; In the training of the reverse diffusion process, for p θ (x t-1 |x t To further simplify, the variance σ is included in the training... θ (x t With t) fixed, only the U-net network needs to predict p. θ mean μ θ (x t In the denoising diffusion probability model, the mean is predicted by predicting the noise ∈, and formula (2) is: Where x t For the predicted samples at step t, the loss function L of the final denoising diffusion probability model is... loss for: in Describe x ~ q(x) and The mathematical expectation of t, where x is a sample sampled from the dataset, q(x) is the distribution corresponding to the dataset, and ∈ represents the true noise when obtaining the diffused sample corresponding to step t. θ (x t ,t) represents the noise predicted by the neural network; S23: Training and Sampling; Randomly select a step size t, apply noise to each image in the training set according to Equation 4, and convert t into a temporal code that is embedded into the input. Here, the noise predicted by the model is ∈ θ (x t ,t), ∈ represents the true noise when obtaining the diffusion sample corresponding to step t; Next, the U-net network is used to predict noise. Gradient descent is performed according to formula (5) and the loss function is updated to obtain the denoising diffusion probability model, which is used for image generation. The generation process randomly samples a noisy image from the standard normal distribution, and then iterates from step size T. In each step, the noise predicted by the model in step size t is removed. After the iteration is completed, a generated image is obtained.

3. The indocyanine green fluorescence image classification and recognition method based on diffusion model and contrastive learning according to claim 1, characterized in that, The implementation method for step four is as follows: S41: After completing the training of the contrastive learning phase, the model discards the projection head g(·) and keeps only the encoder f(·). Then, a fully connected layer is added after f(·) as a classifier. S42: Input a sample x from the dataset into the model and perform data augmentation on it; S43: Input x into the encoder f(·) to obtain the high-dimensional vector h, then feed h into the fully connected layer, and use the Softmax function to obtain the probability of whether the classifier classifies sample x as a positive image. The formula for the Softmax function is: Among them, v i This represents the probability that the result belongs to the i-th class. For v i The natural constant exponent is represented by ∑ j e j The sum of the natural constants representing the probabilities of all classes is expressed as the exponentiation of the probabilities. During the training phase of classification, the cross-entropy function is used as the loss function. The formula for the cross-entropy function is: Where p(x) i ) is the sample x i The true label, q(x) i The model obtained after applying the Softmax function is the model for x. i The probability of being predicted as belonging to this category.

Citation Information

Patent Citations

  • Glaucoma fundus image recognition method based on transfer learning

    CN111476283A

  • Visual content generation method, device, system, equipment and medium

    CN114880441A