An unsupervised lesion positioning system and method for fundus images based on a wavelet conditional diffusion model

By using an unsupervised lesion localization system based on a wavelet conditional diffusion model, and training with healthy fundus images and introducing wavelet domain multi-frequency modeling and self-supervised training, the problems of high data annotation cost and insufficient model stability in the localization of diabetic retinopathy lesions are solved, and efficient and accurate lesion localization is achieved.

CN123160446APending Publication Date: 2026-11-24SOUTHEAST UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611171479.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-04
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies for localizing diabetic retinopathy lesions suffer from problems such as high data annotation costs, difficulty in ensuring cross-center consistency, insufficient model stability, and insufficient ability to distinguish lesions from normal anatomical structures. In particular, in unsupervised anomaly detection, the high-frequency texture of small lesions is easily over-smoothed, resulting in insufficient residual signal discrimination.

Method used

An unsupervised lesion localization system based on a wavelet conditional diffusion model is adopted. The denoising diffusion probability model is trained using healthy fundus images. A wavelet domain multi-frequency modeling and synthetic anomaly self-supervised training mechanism are introduced. Wavelet decomposition is used to preserve high-frequency lesion texture, and lesions are located through pseudo-health reconstruction and residual calculation.

Benefits of technology

It achieves pixel-level labeling of lesions without the need for labeling, significantly reducing data labeling costs, improving the sensitivity and localization accuracy of small lesions, and the modular system makes it easy to embed into existing diagnostic processes, thereby improving the stability of the model and the ability to identify lesions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123160446A_ABST
    Figure CN123160446A_ABST
Patent Text Reader

Abstract

This invention relates to an unsupervised lesion localization system and method for fundus images based on a wavelet conditional diffusion model. The system includes: a healthy image diffusion training module, a synthetic anomaly self-supervised training module, a wavelet conditional diffusion denoising module, a pseudo-healthy reconstruction inference module, a residual lesion localization module, and a lesion mask post-processing module. The system of this invention has a clear modular division, and each module can be independently replaced or extended, making it easy to embed into existing DR-assisted diagnostic processes or different backbone networks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of medical image processing and artificial intelligence-assisted diagnosis, and in particular to an unsupervised lesion localization system and method for fundus images based on a wavelet conditional diffusion model. Background Technology

[0002] Diabetic retinopathy is a common microvascular complication of diabetes and one of the leading causes of preventable vision impairment in working-age individuals. Its early manifestations mainly include various subtle lesions such as microaneurysms, punctate hemorrhages, hard exudates, and soft exudates. Accurately and rapidly determining the specific location and extent of these lesions in fundus images is of significant clinical importance for follow-up management and assessment of lesion evolution.

[0003] Currently, research approaches for DR lesion localization mainly fall into two categories. The first category is fully supervised semantic segmentation methods, such as pixel-level classification networks represented by convolutional neural networks like U-Net. These methods are stable when adequately labeled, but require ophthalmologists to delineate the lesion region pixel by pixel, resulting in high labeling costs, long processing times, and difficulty in ensuring cross-center consistency. Taking the publicly available dataset IDRiD as an example, the scale of precisely labeled data available for lesion segmentation is significantly smaller than that of common DR grading datasets, creating a data bottleneck for fully supervised training.

[0004] The second category is reconstruction-based unsupervised anomaly detection methods. The basic idea is to learn the normal appearance distribution using only healthy images, reconstruct abnormal images into pseudo-healthy images, and then locate the abnormal regions using the residual between the original and pseudo-healthy images. Early methods were mostly built on the Generative Adversarial Network (GAN) framework. However, in DR (Diagnosis Related-Repair) repair localization tasks, the GAN approach suffers from three problems: First, when the appearance difference between the input and target domains is small, the model is prone to identity mapping, preserving the original lesions in the reconstructed image; second, cyclic consistency constraints can easily induce lesion information to be retained in the reconstruction result as implicit noise, weakening the true "erasing" effect; third, adversarial training is highly sensitive to hyperparameters and training strategies, resulting in insufficient stability when reproducing across datasets.

[0005] The Denoising Diffusion Probabilistic Model (DDPM) and the Accelerated Sampling Model (DDIM) proposed in recent years, model data distribution through forward denoising and backward denoising, and the training process does not rely on adversarial games, showing good stability in medical image anomaly detection. However, directly using standard pixel-domain DDPM for DR lesion localization still has two shortcomings: First, the high-frequency textures of small lesions such as microaneurysms are easily over-smoothed under the mean square error optimization of pixel-domain U-Net, resulting in weak signals in the residual map; second, ordinary DDPM only optimizes the noise prediction loss of healthy images and lacks the ability to distinguish between the high-frequency textures of real lesions and normal anatomical structures. During the reconstruction process, it is easy to use the same denoising strategy for normal anatomical structures and lesion areas, resulting in insufficient discrimination of the residual signal and difficulty in simultaneously achieving high response of small lesions and low response of normal areas. Summary of the Invention

[0006] Purpose of the invention: The purpose of this invention is to provide an unsupervised lesion localization system and method for fundus images based on a wavelet conditional diffusion model. It can be trained using only unpaired healthy fundus images, and by introducing wavelet domain multi-frequency modeling and self-supervised synthesis of anomaly-assisted training mechanisms, it can achieve pixel-level localization of various lesions in diabetic retinopathy.

[0007] Technical solution: The present invention provides an unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model, comprising:

[0008] The healthy image diffusion training module is used to train a denoised diffusion probability model using only healthy fundus images to learn the distribution of healthy fundus images.

[0009] The synthetic anomaly self-supervised training module is used to generate pseudo-abnormal regions simulating lesions on healthy fundus images, construct pseudo-disease images and corresponding synthetic anomaly masks, and construct auxiliary training tasks based on pseudo-disease images, which are jointly optimized with the healthy image diffusion training module.

[0010] The wavelet conditional diffusion denoising module is used to perform wavelet decomposition on the noisy image in the denoising network, convert the image to the wavelet domain for multi-frequency modeling, and restore the signal to the image domain by inverse wavelet transform after denoising.

[0011] The pseudo-healthy reconstruction inference module is used to perform forward denoising on the diseased fundus image to be detected, and then call the wavelet conditional diffusion denoising module to perform inverse denoising to reconstruct the corresponding pseudo-healthy image.

[0012] The residual lesion localization module is used to calculate the difference between the diseased fundus image and the pseudo-healthy reconstructed image, and generate a residual heatmap reflecting the location of the lesion.

[0013] The lesion mask post-processing module is used to perform adaptive threshold segmentation and morphological processing on the residual heatmap and output a binary mask of the lesion.

[0014] Furthermore, the denoising network in the wavelet conditional diffusion denoising module adopts a U-shaped structure, with its encoder and decoder having a symmetrical architecture. Spatial self-attention mechanisms are embedded in the deep layers and bottleneck layers of the encoder to model the global anatomical topology of fundus images.

[0015] Furthermore, the synthetic anomaly self-supervised training module simulates lesions by randomly generating multiple tiny elliptical patches within the effective imaging area of ​​a healthy fundus image. The size, shape, and color of each elliptical patch vary randomly within a preset range. The synthetic anomaly mask is formed by taking the union of all elliptical patches and then softening the edges.

[0016] Furthermore, the lesion mask post-processing module sequentially performs adaptive threshold segmentation, opening operation to remove isolated noise points, closing operation to fill holes inside the lesion, and connected region area filtering on the residual heatmap, and applies upper and lower bound constraints on the foreground area ratio to the threshold segmentation results.

[0017] Furthermore, the system also includes a time-dimensional bidirectional attention residual module, which is used to cache historical states and pre-generated future states along the denoising time axis during the inverse denoising process of the pseudo-health reconstruction inference module, and perform channel-dimensional residual correction on the current denoising state through an attention mechanism. This module is decoupled from the backbone network of the wavelet conditional diffusion denoising module.

[0018] The present invention discloses an unsupervised lesion localization method for fundus images based on a wavelet conditional diffusion model, comprising the following steps:

[0019] Step 1: Collect healthy fundus images and preprocess them as training samples for the denoising diffusion probability model;

[0020] Step 2: Generate pseudo-abnormal regions simulating lesions on healthy fundus images, and construct pseudo-disease images and their corresponding synthetic abnormality masks;

[0021] Step 3: Jointly train a denoising network with wavelet transform by using the main task loss of healthy fundus images across all time steps and the auxiliary loss of pseudo-disease images at low-noise time steps.

[0022] Step 4: Perform partial forward noise addition on the diseased fundus images to be tested;

[0023] Step 5: Call the trained denoising network to perform deterministic inverse sampling on the noisy diseased image to reconstruct the pseudo-healthy image;

[0024] Step 6: Calculate the difference between diseased images and pseudo-healthy images to generate a single-channel residual heatmap;

[0025] Step 7: Perform adaptive thresholding and morphological post-processing on the residual heatmap to output a binary mask of the lesion.

[0026] Furthermore, in step 2, the denoising network with wavelet transform performs wavelet decomposition on the noisy image at the input end to obtain multiple frequency sub-bands, and at the output end, it performs inverse wavelet transform to restore the predicted wavelet domain noise to the image domain noise.

[0027] Furthermore, in step 3, the auxiliary loss only participates in the optimization within the low-noise time step interval, and is weighted and summed with the main task loss with preset weights to form the total loss function.

[0028] Furthermore, in step 4, the number of noise steps for some forward noise additions is within a preset range, and the number of deterministic reverse sampling steps is less than the total number of forward noise addition steps.

[0029] Furthermore, in step 5, during the reverse sampling process, the denoising trajectory is divided into multiple macroscopic periods. First, anchor point information for future periods is pre-generated using coarse sampling. Then, in the fine sampling stage, the generated historical anchor points are combined with the future anchor points, and the current denoising state is corrected through attention residuals.

[0030] Compared with existing technologies, this invention has the following advantages: The training phase of this invention relies solely on healthy fundus images, completely eliminating the dependence on pixel-level lesion annotation and significantly reducing data annotation costs; by introducing Haar wavelet decomposition at the input of the U-shaped denoising network and inverse Haar transform at the output, the high-frequency textures of micro-aneurysms and other small lesions are explicitly preserved in the three high-frequency subbands of LH, HL, and HH, improving the sensitivity of the residual map to small lesions; by designing a multi-scale elliptical synthetic anomaly self-supervised training mechanism, the synthetic lesions are trained for targeted erasure at low-noise time steps, enabling the denoising network to have the ability to "identify and erase" lesions; through an optional time-dimensional bidirectional attention residual module, structural drift in long-range DDIM sampling can be further suppressed without altering the weights of the trained backbone; the system has a clear modular division, and each module can be independently replaced or expanded, facilitating embedding into existing DR-assisted diagnostic processes or different backbone networks. Attached Figure Description

[0031] Figure 1 This is a flowchart of the present invention;

[0032] Figure 2 is a flowchart of the WC-DDPM U-shaped denoising backbone network of the wavelet conditional diffusion denoising module of the present invention;

[0033] Figure 3 is a complete inference flowchart of the pseudo-health reconstruction inference module of the present invention on diseased fundus images;

[0034] Figure 4 is a flowchart of the draft-refine two-stage inference process of the optional time-dimensional bidirectional attention residual module (T-AttnRes) of the present invention;

[0035] Figure 5 is a schematic diagram of the WC-DDPM U-shaped denoising backbone network structure of the present invention (including the complete structure of wavelet decomposition—encoding—bottleneck—decoding—inverse wavelet reconstruction);

[0036] Figure 6 is a schematic diagram of the multi-scale elliptical synthetic anomaly self-supervised sample example and the dual-task training data flow of the present invention;

[0037] Figure 7 is a visualization diagram of the pseudo-health reconstruction of the present invention (including the original diseased image, the pseudo-health reconstructed image and the residual comparison).

[0038] Figure 8 shows the different noise steps of the present invention. A comparative diagram of the pseudo-health reconstruction effect under different values;

[0039] Figure 9 is an example of the lesion binary mask generation result of the present invention. Detailed Implementation

[0040] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. It should be understood that the following embodiments are only used to explain the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention. Equivalent transformations, parameter adjustments, or structural substitutions made by those skilled in the art based on this specification without departing from the technical concept of the present invention should all fall within the scope of protection of the present invention.

[0041] This invention discloses an unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model. The overall flowchart of the system is shown in Figure 1, and it mainly includes a healthy image diffusion training module, a synthetic anomaly self-supervised training module, a wavelet conditional diffusion denoising module, a pseudo-healthy image reconstruction inference module, a residual lesion localization module, and a lesion mask post-processing module. Each module is described in detail below.

[0042] Healthy Image Diffusion Training Module: This module uses healthy fundus images with diabetic retinopathy grade 0 as training samples. Each image is scaled proportionally to 224. 224 resolution, and linearly mapped to each channel. Interval. Let... For sampled healthy fundus images, the forward noise addition process of DDPM is a fixed Markov chain without trainable parameters, with a pre-defined noise schedule. Gradually add Gaussian noise to the data:

[0043]

[0044] By using reparameterization techniques, arbitrary time steps can be obtained. Closed form:

[0045]

[0046] in , . Cosine tuning , , , .

[0047] The health image diffusion training module is based on a neural network. Added noise The estimated loss for the main task is:

[0048]

[0049] In this embodiment, time step from Sampling is performed on a uniformly distributed surface.

[0050] Synthetic Anomaly Self-Supervised Training Module: The input to the synthetic anomaly self-supervised training module is a healthy image. The output is a pseudo-disease image. Its corresponding synthetic anomaly mask The working steps are as follows:

[0051] exist Within the effective imaging area (excluding the 10-pixel outer frame with black background at the edge), with probability Enable composition; within integer range Number of tiny ellipses sampled uniformly inside The baseline radius of each ellipse is uniformly sampled between 3 and 6 pixels, and the major and minor axes are independently perturbed between 0.6 and 1.4 times the baseline radius. Color is independently sampled for each tiny ellipse, covering a continuous range of colors including dark red hemorrhage, light red vascularization, dark yellow aging, and bright white exudation. The union of all elliptical regions is used as a synthetic anomaly mask. And apply a kernel size of 5 to its edges. Gaussian filtering softens sharp edges; standard deviations are superimposed within elliptical regions. Gaussian texture noise was used to obtain pseudo-disease images. .

[0052] Synthetic anomaly-assisted loss in low-noise time step interval Calculation of pseudo-disease images:

[0053]

[0054] The combined loss is:

[0055]

[0056] in .

[0057] The rationale for limiting assisted training to the low-noise range is that: low... stage When the value is close to 1, the image still retains a lot of original detail information. At this point, the task of the denoising network is to directly deal with the fine-grained texture features of the synthesized lesions, which is similar to the task of targeted erasing of real lesions in the inference stage. In the high-noise stage, the information of the synthesized lesions has been submerged by noise, and it is difficult to provide an effective signal for continued training.

[0058] Wavelet conditional diffusion denoising module: The wavelet conditional diffusion denoising module is one of the core modules of this invention. Its network structure is shown in Figure 5, and its workflow is shown in Figure 2. This module consists of three parts: a wavelet decomposition layer, a U-shaped denoising backbone, and an inverse wavelet reconstruction layer.

[0059] Wavelet decomposition layer. For noisy images. Perform two-dimensional, first-order Haar wavelet decomposition. The analysis filter for the Haar wavelet is low-pass. With Qualcomm The two-dimensional image is filtered sequentially in both the horizontal and vertical directions, resulting in four sub-bands:

[0060]

[0061]

[0062] Wavelet domain features are obtained by splicing the four sub-bands along the channel dimension. The LL subband preserves the global low-frequency structure, the LH / HL subbands carry high-frequency edge information in the horizontal and vertical directions respectively, and the HH subband carries high-frequency texture details in the diagonal direction, including texture contrast of small round lesions such as microaneurysms.

[0063] U-shaped denoising skeleton. The U-shaped skeleton features wavelet domain characteristics. and time step embedding Input: Wavelet domain noise estimate The specific structure is as follows:

[0064] First, time step embedding: scalar Sine / cosine position encoding mapped to the reference channel number Vectors of the same dimension, then mapped through two layers of MLP, become (256-dimensional), injected into each ResBlock in an affine manner;

[0065] Second, the encoder: 4-level downblock, each level has 2 ResBlocks (GroupNorm + SiLU) and a stride of 2 downsampling convolution, with channel numbers of 64, 128, 256, and 512 respectively; the last two levels have 28 channels. 28, 14 Spatial self-attention is introduced at 14 locations to globally model and dissect topological relationships;

[0066] Third, the bottleneck layer: in 14 ResBlocks are arranged sequentially at channels 14 and 512. Self-attention ResBlock;

[0067] Fourth, the decoder: 4-stage UpBlock, symmetrically restoring the number of channels from 512 to 64. The order of each UpBlock stage is: skipping concatenation with the symmetrical encoder. Several ResBlocks Optional Spatial Self-Attention Bilinear upsampling and convolution;

[0068] Fifth, 1 1. Projection: After 4 upsampling iterations, the feature is restored to 112. 112, via 1 1. Convolutional projection to 12-channel wavelet noise prediction.

[0069] Inverse wavelet reconstruction layer. Predicts 12-channel wavelet domain noise. Reducing to pixel-domain noise prediction via inverse Haar transform It is aligned with the forward noise addition process for loss calculation.

[0070] Pseudo-health reconstruction inference module: The workflow of the pseudo-health reconstruction inference module is shown in Figure 3, and it is executed according to the following steps:

[0071] Step 1, Partial Forward Noise Addition: Adding noise to the diseased image in the RGB image domain. Execute according to cosine scheduling , The optimal value is 300. At this point... The original image information is retained at a rate of about 2%, making it difficult for the model to achieve near-identical restoration based on original image cues.

[0072] The second step, DDIM deterministic inverse sampling: Starting from, execute DDIM deterministic sampling of steps ( The core recurrence relation of DDIM is:

[0073]

[0074] Wavelet decomposition and inverse transform are performed within the U-shaped network, while the diffusion scheduling itself iterates within the RGB image domain; ultimately, a pseudo-healthy reconstructed image is obtained. .

[0075] Residual lesion localization module: The input to the residual lesion localization module is the lesion image. With pseudo-healthy reconstructed images The output is a single-channel residual heatmap. :

[0076]

[0077] Healthy areas (such as normal blood vessels, uniform background) in and The residuals remained almost unchanged between the two regions, approaching zero; however, lesion areas that were damaged and filled by healthy distributions exhibited higher residuals. The value is high in the middle range.

[0078] Lesion masking post-processing module: The lesion masking post-processing module processes residual heatmaps. Execute the following process:

[0079] First, adaptive threshold segmentation: using the Otsu algorithm to calculate a global threshold based on maximizing inter-class variance. And impose upper and lower bound constraints on the foreground area ratio (upper bound 20%, lower bound 0.1%) to avoid extreme cases; Set the position to 1 and the rest to 0 to obtain the initial binary mask. ;

[0080] Second, opening operation: erosion followed by dilation (structural element 3) 3) Remove isolated noise spots;

[0081] Third, closing operation: first dilation then erosion (structural element 5) 5) Fill the cavities inside large lesions;

[0082] Fourth, connected component filtering: perform connected component analysis with 8-connectivity to remove extremely small connected regions with a pixel area of ​​less than 50;

[0083] Fifth, visual overlay: refining the mask. A semi-transparent color is overlaid on the original disease image to obtain a visual overlay image that is easy for doctors to review.

[0084] Optional Module: Time-Dimensional Bidirectional Attention Residual (T-AttnRes): To further suppress structural drift in DDIM long-range sampling, this invention provides an optional time-dimensional bidirectional attention residual module (T-AttnRes) without altering the backbone weights of the wavelet conditional diffusion denoising module. Its complete inference flow is shown in Figure 4. T-AttnRes employs a plug-and-play decoupled connection during the inference phase. Without modifying the trained backbone weights, the module is inserted into the iterative loop of DDIM inverse sampling. At each step, residual correction is performed on the current state of the backbone output, and the correction result is then sent back to the backbone for the next iteration.

[0085] Specifically, The denoising trajectory is divided into equal parts. Macroeconomic period (preferred) ), and perform the following two-stage reasoning:

[0086] Phase One (Draft): Step DDIM Quick Completion Full-process coarse sampling, denoising the current RGB domain at the boundary of each time period. Perform spatial global average pooling to obtain the anchor vector. And store it in the future anchor point library (Prospective Bank); optionally, perform one-dimensional Gaussian smoothing on the future anchor points along the period axis. To suppress coarse sampling noise.

[0087] Phase Two (Refine): Step DDIM formal sampling. At each time boundary is reached, anchor points are retrieved from both the Retrospective Bank and the Future Anchor Bank, and then fused using time-aware gating:

[0088]

[0089] in The normalized epoch progress; w and b represent preset hyperparameters, w=2, b=0; the fused anchor sequence serves as the key and value for multi-head attention, currently... The channel-dimensional global summary is used as the query, and the attention output is expanded by spatial replication and then... Residual scaling injection :

[0090]

[0091] This module's multi-head attention count The number of channels must be divisible by 3, which is preferred. Its parameters are decoupled from the backbone weights of the wavelet conditional diffusion denoising module, and are randomly initialized by default, but can also be finely adjusted under the premise of a fixed backbone.

[0092] This embodiment provides a method implementation method corresponding to the system in Embodiment 1. Its overall flow is also shown in Figure 1, and the steps are described below.

[0093] Step 1: Data Acquisition and Preprocessing: Collect healthy fundus images with a DR classification of level 0, and adjust each image to 224 pixels using proportional scaling and zero-padding. 224; pixel values ​​linearly mapped to The model training data comes from the EyePACS dataset (https: / / www.kaggle.com / datasets / dreamer07 / eyepacs). This dataset contains 35,126 fundus images, labeled from 0 to 4 according to the severity of diabetic retinopathy, with level 0 indicating no diabetic retinopathy and containing 25,810 images. This method uses only healthy fundus images labeled level 0 that actually exist for training, in order to learn the distribution of normal fundus images.

[0094] The external lesion localization evaluation data for the model used the IDRiD public dataset (https: / / idrid.grand-challenge.org / Home / ). IDRiD's lesion segmentation data includes 81 high-resolution fundus images and provides pixel-wise binary annotations for four types of lesions: microaneurysms (MA), hard exudates (EX), hemorrhages (HE), and soft exudates (SE). During the evaluation process, the diseased fundus images were used as model input, and the model generated a predicted lesion mask. The pixel-level lesion annotations provided by IDRiD were only used as the standard answer for calculating lesion localization metrics such as Dice, IoU, and AUROC, and were not used in model training.

[0095] Step 2: Construction of Synthetic Anomalous Self-Supervised Samples: For each healthy image, with probability... Enable synthetic anomaly generation, and generate a set of tiny elliptical pseudo-lesions as described in Section 1.2 of Example 1 to obtain a pseudo-disease image. With synthetic anomaly mask .

[0096] Step 3: Jointly train the denoising network: In Under cosine noise scheduling, the following training iterations are performed for each mini-batch of samples:

[0097] First, the main task: to analyze health images. sampling ,according to Add noise, then feed it into a denoising U-shaped network with DWT / IDWT for prediction. Calculate the main task loss ;

[0098] Second, auxiliary task: analyzing pseudo-disease images. sampling Similarly, after adding noise, the data is fed into the network to calculate the loss for the auxiliary task. ;

[0099] Third, total losses , With AdamW optimizer and initial learning rate The warmup consists of 500 steps, followed by cosine decay to update parameters; EMA weights (decay coefficient 0.9999) are maintained simultaneously for inference. Batch size and number of training epochs are set according to actual conditions, and an early stopping strategy is used to determine the optimal number of epochs.

[0100] Step 4: Adding noise to the diseased image: [This refers to adding noise to the diseased image to be detected.] (Scaling to 224) 224, normalized to Add noise to the cosine-distributed portion of the RGB image domain. , .

[0101] Step 5: DDIM Deterministic Backsampling Starting from, execute Step DDIM Deterministic Backsampling ( ); optionally enable T-AttnRes Draft-Refine inference; obtain pseudo-healthy reconstructed images. .

[0102] Step 6: Residual Heatmap Calculation: (According to...) Calculate the single-channel residual heatmap.

[0103] Step 7 Thresholding and Morphological Post-processing: Following the Otsu adaptive thresholding described in Section 1.6 of Example 1, 3... 3-opening operation, 5 5. A filtering process involving closing operations and a minimum connected region area of ​​50 pixels is used to obtain the final binary mask for the lesion. Overlay with visualizations.

[0104] Method Example 2 corresponds one-to-one with each module in System Example 1. The parts that are consistent with the specific processing parameters and structure of Example 1 will not be described again.

[0105] Experimental Verification: To verify the effectiveness of this invention, experiments were conducted on two publicly available DR datasets with pixel-level lesion annotations: IDRiD (81 images) and DDR (a subset of 578 images with complete pixel annotations). The complete scheme of this invention (wavelet conditional diffusion denoising + CutPaste synthesis for anomaly-assisted training; excluding optional T-AttnRes) was compared with several baselines and ablation variants on the IDRiD test set. The main quantitative results are as follows:

[0106] False Health Reconstruction Quality (PSNR) / SSIM / FID / FPR@95TPR The baseline values ​​for CycleGAN are 22.6 / 0.72 / 84.5 / 0.418; the baseline values ​​for AnoDDPM are 25.8 / 0.78 / 56.9 / 0.306; and the complete solution of this invention is 27.2 / 0.82 / 44.3 / 0.274.

[0107] Lesion segmentation performance (IoU) / Dice / AUROC CycleGAN is 0.138 / 0.213 / 0.651; AnoDDPM is 0.246 / 0.339 / 0.752; the complete solution of this invention is 0.286 / 0.386 / 0.806.

[0108] Core mechanism ablation (comprehensive Dice): Base DDPM 0.284 +Haar wavelet 0.336 +CutPaste Synthesis Anomaly 0.386; it can be seen that both wavelet decomposition and self-supervised training of synthesis anomalies bring stable gains to this scheme.

[0109] Noise Steps Sensitivity: On the IDRiD test set, The combined values ​​of Dice and AUROC were relatively high, while FPR@95TPR remained at an acceptable level. Dice is relatively stable within the interval; Insufficient removal of lesions can lead to missed detection. Excessive loss of normal anatomical information can lead to an increase in false positives.

[0110] Inference latency (NVIDIA RTX 4090, batch=1): Standard 1000-step DDPM single image latency is approximately 76.8 seconds; this invention uses DDIM 50-step sampling, resulting in approximately 3.8 seconds per image latency, with a Dice loss of only about 0.3 percentage points.

[0111] Optional T-AttnRes extension: Enables bidirectional T-AttnRes without altering the backbone weights. After Draft 5 steps and future anchor smoothing, both Dice and FPR@95TPR showed further improvement, with single-graph inference time increasing to approximately 4.2 to 4.4 seconds, which is still within the clinically acceptable range.

[0112] The above results show that, under the condition of training only with healthy fundus images, the present invention can simultaneously obtain high pseudo-health reconstruction quality and good lesion localization accuracy; wavelet decomposition and CutPaste synthesis anomaly have additive synergistic gains; the optional T-AttnRes module can further improve performance in the inference stage and is decoupled from the trained backbone weights, making it easy to deploy in engineering.

Claims

1. An unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model, characterized in that, include: The Healthy Image Diffusion Training Module is used to train a denoised diffusion probability model using only healthy fundus images to learn the distribution of healthy fundus images. The synthetic anomaly self-supervised training module is used to generate pseudo-abnormal regions simulating lesions on healthy fundus images, construct pseudo-disease images and corresponding synthetic anomaly masks, and construct auxiliary training tasks based on pseudo-disease images, which are jointly optimized with the healthy image diffusion training module. The wavelet conditional diffusion denoising module is used to perform wavelet decomposition on the noisy image in the denoising network, convert the image to the wavelet domain for multi-frequency modeling, and restore the signal to the image domain by inverse wavelet transform after denoising. The pseudo-healthy reconstruction inference module is used to perform forward denoising on the diseased fundus image to be detected, and then call the wavelet conditional diffusion denoising module to perform inverse denoising to reconstruct the corresponding pseudo-healthy image. The residual lesion localization module is used to calculate the difference between the diseased fundus image and the pseudo-healthy reconstructed image, and generate a residual heatmap reflecting the location of the lesion. The lesion mask post-processing module is used to perform adaptive threshold segmentation and morphological processing on the residual heatmap and output a binary mask of the lesion.

2. The unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model according to claim 1, characterized in that, The denoising network in the wavelet conditional diffusion denoising module adopts a U-shaped structure, with its encoder and decoder having a symmetrical architecture. Spatial self-attention mechanisms are embedded in the deep layers and bottleneck layers of the encoder to model the global anatomical topology of fundus images.

3. The unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model according to claim 1, characterized in that, The synthetic anomaly self-supervised training module simulates lesions by randomly generating multiple tiny elliptical patches within the effective imaging area of ​​a healthy fundus image. The size, shape, and color of each elliptical patch vary randomly within a preset range. The synthetic anomaly mask is formed by taking the union of all elliptical patches and then softening the edges.

4. The unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model according to claim 1, characterized in that, The lesion mask post-processing module sequentially performs adaptive threshold segmentation, opening operation to remove isolated noise points, closing operation to fill holes inside the lesion, and connected region area filtering on the residual heatmap, and applies upper and lower bound constraints on the foreground area ratio to the threshold segmentation results.

5. The unsupervised lesion localization system for fundus images based on a wavelet conditional diffusion model according to claim 1, characterized in that, The system also includes a time-dimensional bidirectional attention residual module, which is used to cache historical states and pre-generated future states along the denoising time axis during the inverse denoising process of the pseudo-health reconstruction inference module, and perform channel-dimensional residual correction on the current denoising state through an attention mechanism. This module is decoupled from the backbone network of the wavelet conditional diffusion denoising module.

6. An unsupervised lesion localization method for fundus images based on a wavelet conditional diffusion model, characterized in that, Includes the following steps: Step 1: Collect healthy fundus images and preprocess them as training samples for the denoising diffusion probability model; Step 2: Generate pseudo-abnormal regions simulating lesions on healthy fundus images, and construct pseudo-disease images and their corresponding synthetic abnormality masks; Step 3: Jointly train a denoising network with wavelet transform by using the main task loss of healthy fundus images across all time steps and the auxiliary loss of pseudo-disease images at low-noise time steps. Step 4: Perform partial forward noise addition on the diseased fundus images to be tested; Step 5: Call the trained denoising network to perform deterministic inverse sampling on the noisy diseased image to reconstruct the pseudo-healthy image; Step 6: Calculate the difference between diseased images and pseudo-healthy images to generate a single-channel residual heatmap; Step 7: Perform adaptive thresholding and morphological post-processing on the residual heatmap to output a binary mask of the lesion.

7. The unsupervised lesion localization method for fundus images based on a wavelet conditional diffusion model according to claim 6, characterized in that, In step 2, the denoising network with wavelet transform performs wavelet decomposition on the noisy image at the input end to obtain multiple frequency sub-bands, and at the output end, it performs inverse wavelet transform to restore the predicted wavelet domain noise to the image domain noise.

8. The unsupervised lesion localization method for fundus images based on a wavelet conditional diffusion model according to claim 6, characterized in that, In step 3, the auxiliary loss only participates in the optimization within the low-noise time step interval, and is weighted and summed with the main task loss with preset weights to form the total loss function.

9. The unsupervised lesion localization method for fundus images based on a wavelet conditional diffusion model according to claim 6, characterized in that, In step 4, the number of noise steps for some forward noise additions is within a preset range, and the number of deterministic reverse sampling steps is less than the total number of forward noise additions.

10. The unsupervised lesion localization method for fundus images based on a wavelet conditional diffusion model according to claim 6, characterized in that, In step 5, during the reverse sampling process, the denoising trajectory is divided into multiple macro periods. First, anchor point information for future periods is pre-generated using coarse sampling. Then, in the fine sampling stage, the generated historical anchor points are combined with the future anchor points, and the current denoising state is corrected by attention residuals.