Eye fundus macular edema image processing method based on improved YOLOv11 and DeepSeek
By improving the combination of the YOLOv11 network and the DeepSeek large language model, and optimizing feature extraction and lesion segmentation, the inefficiency and lack of intelligence in the diagnosis of macular edema are solved, enabling high-precision classification and generation of personalized treatment suggestions, adapting to complex scenarios and patient diversity.
Patent Information
- Application Number
- CN202511386817.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2025-12-26
AI Technical Summary
Existing technologies for diagnosing macular edema suffer from low diagnostic efficiency, insufficient feature extraction capabilities, poor robustness, and a lack of intelligent treatment suggestion generation, leading to missed diagnoses or misdiagnoses and an inability to generate personalized treatment plans based on patient clinical information.
An improved YOLOv11 network was used in conjunction with the DeepSeek large language model. Feature extraction was optimized through linear deformation convolution LDConv and convolutional block attention module CBAM. The lesion region was segmented by combining the U-KAN segmentation model and OpenCV algorithm. Personalized diagnosis and treatment suggestions were generated using DeepSeek.
It achieves high-precision classification and segmentation of macular edema, generates personalized treatment recommendations that conform to clinical guidelines, improves diagnostic efficiency and intelligent decision support capabilities, and adapts to different imaging conditions and patient groups.
Smart Images

Figure CN121214033A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geostress testing technology, and in particular to a method for processing macular edema images based on an improved YOLOv11 and DeepSeek. Background Technology
[0002] Macular edema is an eye condition that affects vision, usually caused by conditions such as diabetic retinopathy and retinal vein occlusion. It manifests as fluid accumulation in the macular region of the retina. Early diagnosis is crucial for preventing vision loss. Currently, the diagnosis of macular edema relies on ophthalmologists manually analyzing fundus photography or optical coherence tomography (OCT) images, but this process is time-consuming and susceptible to human error.
[0003] With the advancement of artificial intelligence (AI) technology, the YOLOv11 deep learning algorithm, through optimized network architecture, possesses highly efficient image processing capabilities. When processing OCT images, YOLOv11 can quickly identify lesions of macular edema in the fundus, such as edema or exudates, providing preliminary automated diagnosis.
[0004] However, existing technologies still have some shortcomings in the detection of macular edema: First, traditional diagnosis relies on manual analysis, which is inefficient, and automated systems lack processing speed and deployment flexibility; second, images are often affected by noise, occlusion, or changes in lighting, and existing algorithms have poor robustness, affecting accuracy; finally, existing systems are limited to lesion detection and lack intelligent treatment suggestion generation functions, making it impossible to generate personalized treatment plans based on patient clinical information.
[0005] Therefore, the main shortcomings of existing technologies lie in their lack of diagnostic efficiency, feature extraction capabilities, adaptability to complex scenarios, and intelligent decision support. There is an urgent need for an intelligent system that integrates deep learning image analysis and large language model reasoning capabilities. This system would not only improve detection accuracy and efficiency but also automatically generate personalized treatment suggestions based on clinical data, providing efficient auxiliary decision support. This will help improve the early diagnosis and treatment outcomes of macular edema and promote the development of intelligent medical imaging. Summary of the Invention
[0006] This invention proposes an image processing method for macular edema based on an improved YOLOv11 and DeepSeek. It aims to address the problems of existing technologies, such as the long time consumption of manual diagnosis, the limited ability of existing algorithms to extract features of small lesions such as macular edema and exudates in fundus images, and the susceptibility to interference from complex scenes such as changes in lighting and image noise, leading to missed diagnoses or misdiagnoses. Furthermore, existing systems are limited to lesion detection and lack intelligent treatment suggestion generation functions, making it impossible to generate personalized treatment plans based on patients' clinical information.
[0007] This invention provides a method for processing macular edema images based on improved YOLOv11 and DeepSeek, comprising the following steps: Step S1: Acquire fundus images and preprocess the images; Step S2: Construct a mixed image dataset and divide it into a training set, a validation set, and a test set; Step S3: Based on linear deformation convolution LDConv and convolutional block attention module CBAM, the YOLOv11 network is improved to obtain a macular edema classification model; Step S4: Train the macular edema classification model based on the training set; Step S5: Evaluate the performance of the macular edema classification model using the test set and output the classification results; Step S6: If the classification result is macular edema, then use the U-KAN segmentation model to segment the lesion area and generate a segmentation mask; Step S7: Based on the OpenCV algorithm, draw the disease region on the generated segmentation mask to obtain the segmented image; Step S8: Combine patient clinical information and classification results to generate personalized treatment suggestions using the DeepSeek large language model; Step S9: Output a comprehensive report containing classification results, segmented images, and diagnostic recommendations.
[0008] Furthermore, the specific methods for acquiring fundus images and preprocessing the images in step 1 include: S1-1: Image cropping: Crop the image center to 512x512 pixels, focusing on the macular region, and retaining key diagnostic information; S1-2: Adjust image resolution: Further adjust the cropped image to 224x224 pixels to match the model input requirements; S1-3: Normalization: Standardize pixel values and map them to the [0,1] range to ensure data consistency; S1-4: Data Augmentation: Random brightness adjustment, contrast enhancement, Gaussian noise addition, and blurring are used to simulate lighting changes, noise, and blurred scenes in the clinical environment, thereby improving the robustness of the model.
[0009] Furthermore, the specific methods for constructing the image hybrid dataset and dividing it into training, validation, and test sets in step S2 include: The hybrid dataset consists of fundus images collected within the hospital and publicly available fundus image datasets. The specific steps for dividing the hybrid dataset into training, validation, and test sets in an 8:1:1 ratio are as follows: S2-1: Allocate a training set for optimizing model parameters, which includes diverse macular edema and non-macular edema samples; S2-2: Allocate a validation set to tune hyperparameters and validate model performance; S2-3: Assign a test set for the final performance evaluation to ensure objective results.
[0010] Furthermore, the specific method for improving the YOLOv11 network based on linear deformable convolution LDConv and convolutional block attention module CBAM as described in step S3 to obtain the macular edema classification model includes: S3-1: The standard convolutional layer in the C3k2 module of the YOLOv11 network backbone is replaced with linear deformable convolution LDConv. By dynamically adjusting the shape and size of the convolutional kernel, multi-scale feature extraction is optimized. S3-2: Add a convolutional block attention module (CBAM) before the classify header. Generate an attention map through channel and spatial attention mechanisms to prioritize key lesion areas of macular edema and suppress background noise interference. S3-3: Set initial parameters for the improved network structure, randomly initialize weights, and set the initial learning rate to 0.001; S3-4: Train the improved network multiple times using the training set, dynamically adjust the learning rate using the Adam optimizer and cosine annealing strategy, and monitor the training process using the cross-entropy loss function until the model converges. The cross-entropy loss function is: in, For real labels, To predict probabilities; S3-5: Save the network weights obtained after training and generate the macular edema classification model.
[0011] Furthermore, the specific method for evaluating the performance of the macular edema classification model using the test set and outputting the classification results in step S5 includes: S5-1: Input the test set images into the trained macular edema classification model to obtain the classification label for each image; S5-2: Based on the confusion matrix generated from the test set, calculate the performance metrics of the macular edema classification model, including: The accuracy rate is calculated using the following formula: The sensitivity is calculated using the following formula: The specificity is calculated using the following formula: The accuracy rate is calculated using the following formula: The formula for calculating the F1 score is as follows: In the formula, True Positive (TP): represents the number of samples that are actually macular edema and are predicted as macular edema; False Negative (FN): represents the number of samples that are actually macular edema but are incorrectly predicted as not macular edema; False Positive (FP): represents the number of samples that are actually not macular edema but are incorrectly predicted as macular edema; True Negative (TN): represents the number of samples that are actually not macular edema and are predicted as not macular edema. S5-3: Output the classification result, which includes a determination label for whether the image is macular edema and its corresponding confidence level.
[0012] Furthermore, in step S6, if the classification result is macular edema, the U-KAN segmentation model is used to segment the lesion area, and the specific method for generating the segmentation mask includes: S6-1: Construct the U-KAN segmentation model, which adopts an encoder-decoder structure based on the Kolmogorov-Arnold network; S6-2: Collect a dataset of macular edema lesions with pixel-level annotations, and preprocess and augment the images and corresponding segmentation masks; S6-3: The U-KAN segmentation model is trained using the aforementioned macular edema lesion dataset. A composite loss function, combining Dice Loss and cross-entropy loss, is used to optimize the segmentation accuracy, as shown in the following formula: in Binary cross-entropy loss measures the pixel-wise difference between the predicted probability and the true label; The Dice loss measures the degree of overlap between the predicted segmented region and the actual segmented region. , This is a weighting coefficient used to balance the contributions of the two types of losses, and is usually adjusted according to task requirements; S6-4: Input the test set images classified as macular edema into the trained U-KAN segmentation model, perform forward inference, and output a pixel-level binary segmentation mask; S6-5: Post-process the output segmentation mask to generate an accurate mask for labeling lesion areas.
[0013] Furthermore, the specific method for generating personalized treatment suggestions using the DeepSeek large language model by combining patient clinical information and classification results as described in step S8 includes: S8-1: Construct prompt word templates to convert patient clinical information, macular edema classification results, and lesion feature information into structured text input that can be understood by a large language model; S8-2: Input the structured text into the locally deployed DeepSeek large language model; S8-3: The DeepSeek large language model performs multi-round reasoning on the input information based on the embedded medical knowledge base to generate preliminary diagnosis and treatment suggestion text that conforms to clinical guidelines and includes treatment plans and follow-up plans; S8-4: Post-process and format the generated preliminary suggestion text to output the final structured personalized treatment suggestions.
[0014] Compared with the prior art, the present invention has the following advantages: This invention significantly improves the performance of central retinal edema (macular edema) classification and treatment suggestion generation by improving the combination of YOLOv11 and DeepSeek, specifically in the following ways: (1) High-precision macular edema classification: By introducing linear deformation convolution LDConv and convolutional block attention module CBAM into the YOLOv11 network, multi-scale feature extraction and macular region focusing are optimized, and the classification accuracy reaches 0.991, sensitivity 0.986, and specificity 0.994, which is better than standard YOLOv11 (0.989) and ResNet34 (0.978), effectively dealing with complex fundus image scenarios; (2) Intelligent diagnosis and treatment suggestions: Using the DeepSeek large language model, the macular edema classification results (macular edema severity) and patient clinical information (age, etiology) are integrated to generate personalized diagnosis and treatment suggestions (such as anti-VEGF treatment, OCT follow-up), covering more than 90% of the clinical guideline recommendations, providing doctors with efficient and accurate decision support; (3) Fast real-time processing: Through the local deployment of DeepSeek and the optimization of YOLOv11 architecture (depth separable convolution), it meets the needs of large-scale clinical screening and real-time diagnosis.
[0015] (4) Strong robustness and universality: Based on a mixed dataset (432 images from hospitals + 16,000 images from the public, divided in an 8:1:1 ratio) and diverse data augmentation (brightness, noise, etc.), the model adapts to different imaging conditions and patient groups, achieving an F1 score of 0.99, and has broad clinical application prospects.
[0016] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description
[0017] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent upon reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, with the same or corresponding reference numerals denoteing the same or corresponding parts, wherein: Figure 1 This is a flowchart of the present invention; Figure 2 This is the improved YOLOv11 network architecture of the present invention; Figure 3 This is the CBAM attention mechanism of the present invention; Figure 4a shows the curve of loss variation of the macular edema classification model; Figure 4b shows the curve of accuracy variation of the macular edema classification model. Figure 5 This is a diagram showing the classification results of macular edema according to the present invention; Figure 6 The confusion matrix generated for the test set of the macular edema classification model of the present invention; Figure 7 shows the segmentation model loss curve (Figure a), segmentation model IoU curve (Figure b), and segmentation model IoU curve (Figure c). Figure 8 This is a diagram showing the system interface of the present invention; Figure 9 shows the generated report of this invention; Detailed Implementation
[0018] The exemplary embodiments disclosed in this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art.
[0019] The core of this invention lies in achieving rapid and accurate classification and lesion marking of central retinal edema (macular edema), generating high-quality personalized treatment recommendations to improve ophthalmic diagnostic efficiency and clinical decision support capabilities. This invention relates to an image classification method based on an improved YOLOv11 and DeepSeek inference technology. By optimizing feature extraction, image classification, and knowledge reasoning, it completes a continuous and efficient process from macular edema diagnosis to treatment recommendations. The system includes the following modules: data acquisition and processing module, model generation module, classification result generation module, treatment recommendation generation module, and performance evaluation module. The overall process is as follows: Figure 1 As shown.
[0020] This invention provides a method for processing macular edema images based on improved YOLOv11 and DeepSeek, comprising the following steps: Step S1: Acquire fundus images and preprocess the images; Step S2: Construct a mixed image dataset and divide it into a training set, a validation set, and a test set; Step S3: Based on linear deformation convolution LDConv and convolutional block attention module CBAM, the YOLOv11 network is improved to obtain a macular edema classification model; Step S4: Train the macular edema classification model based on the training set; Step S5: Evaluate the performance of the macular edema classification model using the test set and output the classification results; Step S6: If the classification result is macular edema, then use the U-KAN segmentation model to segment the lesion area and generate a segmentation mask; Step S7: Based on the OpenCV algorithm, draw the disease region on the generated segmentation mask to obtain the segmented image; Step S8: Combine patient clinical information and classification results to generate personalized treatment suggestions using the DeepSeek large language model; Step S9: Output a comprehensive report containing classification results, segmented images, and diagnostic recommendations.
[0021] Optionally, the specific method for acquiring fundus images and preprocessing the images in step 1 includes: S1-1: Image cropping: Crop the image center to 512x512 pixels, focusing on the macular region, and retaining key diagnostic information; S1-2: Adjust image resolution: Further adjust the cropped image to 224x224 pixels to match the model input requirements; S1-3: Normalization: Standardize pixel values and map them to the [0,1] range to ensure data consistency; S1-4: Data Augmentation: Random brightness adjustment, contrast enhancement, Gaussian noise addition, and blurring are used to simulate lighting changes, noise, and blurred scenes in the clinical environment, thereby improving the robustness of the model.
[0022] Optionally, the specific method for constructing the image hybrid dataset and dividing it into a training set, a validation set, and a test set in step S2 includes: The hybrid dataset consists of fundus images collected within the hospital and publicly available fundus image datasets. The specific steps for dividing the hybrid dataset into training, validation, and test sets in an 8:1:1 ratio are as follows: S2-1: Allocate a training set for optimizing model parameters, which includes diverse macular edema and non-macular edema samples; S2-2: Allocate a validation set to tune hyperparameters and validate model performance; S2-3: Assign a test set for the final performance evaluation to ensure objective results.
[0023] Optionally, the specific method for improving the YOLOv11 network based on linear deformation convolution LDConv and convolutional block attention module CBAM in step S3 to obtain the macular edema classification model includes: S3-1: The standard convolutional layer in the C3k2 module of the YOLOv11 network backbone is replaced with linear deformable convolution LDConv. By dynamically adjusting the shape and size of the convolutional kernel, multi-scale feature extraction is optimized. S3-2: Add a convolutional block attention module (CBAM) before the classify header. Generate an attention map through channel and spatial attention mechanisms to prioritize key lesion areas of macular edema and suppress background noise interference. S3-3: Set initial parameters for the improved network structure, randomly initialize weights, and set the initial learning rate to 0.001; S3-4: Train the improved network multiple times using the training set, dynamically adjust the learning rate using the Adam optimizer and cosine annealing strategy, and monitor the training process using the cross-entropy loss function until the model converges. The cross-entropy loss function is: in, For real labels, To predict probabilities; S3-5: Save the network weights obtained after training and generate the macular edema classification model.
[0024] Optionally, the specific method for evaluating the performance of the macular edema classification model using a test set and outputting the classification results in step S5 includes: S5-1: Input the test set images into the trained macular edema classification model to obtain the classification label for each image; S5-2: Based on the confusion matrix generated from the test set, calculate the performance metrics of the macular edema classification model, including: The accuracy rate is calculated using the following formula: The sensitivity is calculated using the following formula: The specificity is calculated using the following formula: The accuracy rate is calculated using the following formula: The formula for calculating the F1 score is as follows: S5-3: Output the classification result, which includes a determination label for whether the image is macular edema and its corresponding confidence level.
[0025] Optionally, if the classification result in step S6 is macular edema, then the U-KAN segmentation model is used to segment the lesion area, and the specific method for generating the segmentation mask includes: S6-1: Construct the U-KAN segmentation model, which adopts an encoder-decoder structure based on the Kolmogorov-Arnold network; S6-2: Collect a dataset of macular edema lesions with pixel-level annotations, and preprocess and augment the images and corresponding segmentation masks; S6-3: The U-KAN segmentation model is trained using the aforementioned macular edema lesion dataset. A composite loss function, combining Dice Loss and cross-entropy loss, is used to optimize the segmentation accuracy, as shown in the following formula: in Binary cross-entropy loss measures the pixel-wise difference between the predicted probability and the true label; The Dice loss measures the degree of overlap between the predicted segmented region and the actual segmented region. , This is a weighting coefficient used to balance the contributions of the two types of losses, and is usually adjusted according to task requirements; S6-4: Input the test set images classified as macular edema into the trained U-KAN segmentation model, perform forward inference, and output a pixel-level binary segmentation mask; S6-5: Post-process the output segmentation mask to generate an accurate mask for labeling lesion areas.
[0026] Optionally, the specific method for generating personalized treatment suggestions using the DeepSeek large language model by combining patient clinical information, classification results, and lesion feature information in step S8 includes: S8-1: Construct prompt word templates to convert patient clinical information, macular edema classification results, and lesion feature information into structured text input that can be understood by a large language model; S8-2: Input the structured text into the locally deployed DeepSeek large language model; S8-3: The DeepSeek large language model performs multi-round reasoning on the input information based on the embedded medical knowledge base to generate preliminary diagnosis and treatment suggestion text that conforms to clinical guidelines and includes treatment plans and follow-up plans; S8-4: Post-process and format the generated preliminary suggestion text to output the final structured personalized treatment suggestions. Example
[0027] This invention provides a method for processing macular edema images based on improved YOLOv11 and DeepSeek, comprising the following steps: Step 1: Constructing a hybrid dataset: Based on preprocessed fundus images, integrate hospital data and publicly available data to construct a hybrid dataset; specifically including: Step 1.1: Collect hospital data: Obtain 432 fundus images provided by the hospital, including 132 images of macular edema and 300 images of non-macular edema.
[0028] Step 1.2: Introduce public data: Integrate public datasets containing 16,000 images, including 10,000 images of macular edema and 6,000 images of non-macular edema.
[0029] Step 1.3: Ensure data diversity: Mixed datasets cover a variety of case scenarios to ensure the model's generalization ability.
[0030] Step 2: Preprocessing fundus image data: Standardize and preprocess the acquired fundus images to ensure the data is suitable for model input; this includes the following sub-steps: Step 2.1: Image cropping: Crop the image center to 512x512 pixels, focusing on the macular region, and retaining key diagnostic information.
[0031] Step 2.2: Adjust image resolution: Further adjust the cropped image to 224x224 pixels to match the model input requirements.
[0032] Step 2.3: Normalization: Standardize the pixel values and map them to the [0,1] range to ensure data consistency.
[0033] Step 2.4: Apply data augmentation: Use random brightness adjustment, contrast enhancement, Gaussian noise addition and blur processing to simulate lighting changes, noise and blurry scenes in the clinical environment to improve the robustness of the model.
[0034] Step 3: Split the dataset: Divide the mixed dataset into training, validation, and test sets in an 8:1:1 ratio; specifically including: Step 3.1: Allocate a training set for optimizing model parameters, which includes diverse macular edema and non-macular edema samples.
[0035] Step 3.2: Allocate a validation set to adjust hyperparameters and validate model performance.
[0036] Step 3.3: Allocate a test set for the final performance evaluation to ensure the results are objective.
[0037] Step 4: Perform interpolation on the dataset; to ensure data uniformity, the dataset is interpolated into fixed batches of training units, with an interpolation period of 64 images per batch to ensure efficient training.
[0038] Step 5: Optimize the YOLOv11 network structure. To improve the classification accuracy of macular edema, the YOLOv11 network is improved to adapt to medical image classification tasks. The structure is as follows: Figure 2 Specifically, it includes the following sub-steps: Step 5.1: Introduce the LDConv module. Replace the standard convolution in the C3k2 module with linear deformable convolution (LDConv), which optimizes multi-scale feature extraction by dynamically adjusting the shape and size of the convolution kernel.
[0039] Step 5.2: Enhance feature capture capability. LDConv generates deformation parameters based on the image feature distribution, enhancing its ability to capture features of macular edema and exudates.
[0040] Step 5.3: Add the CBAM attention mechanism. Add a Convolutional Block Attention (CBAM) module before the classify header. The structure is as follows: Figure 3 As shown.
[0041] Step 6: Initialize network parameters. Set initial parameters for the improved YOLOv11 network, randomly initialize weights, and set the initial learning rate to 0.001.
[0042] Step 7: Configure the training environment. Select high-performance hardware (NVIDIA 4090 GPU) for model training to ensure computational efficiency.
[0043] Step 8: Perform model training. Train the improved YOLOv11 network multiple times using the training set, specifically including: Step 8.1: Set up the training cycle. Perform 100 training cycles based on the training set, lasting approximately 6 hours.
[0044] Step 8.2: Predict classification probabilities. In each training round, the network predicts the classification probability of the image (positive / negative for macular edema and severity).
[0045] Step 8.3: Calculate the loss. Use the cross-entropy loss function to compare the predicted results with the true labels. The formula is as follows: in, For real labels, To predict probabilities.
[0046] Step 8.4: Optimize model parameters. Update network parameters using the Adam optimizer and dynamically adjust the learning rate using a cosine annealing strategy until the loss converges to the preset threshold of 0.01.
[0047] Step 8.5: Monitor the training process. Record the changes in model accuracy and loss during training to ensure gradual convergence to high accuracy (accuracy of 0.991) and low loss (below 0.01), as shown in Figure 4.
[0048] Step 9: Generate the classification model. After training, save the optimized YOLOv11 classification model for subsequent macular edema classification tasks.
[0049] Step 10: Validate model performance. Test the model using the validation set, adjust hyperparameters, and optimize classification accuracy and generalization ability.
[0050] Step 11: Obtain classification results. Input the test set into the optimized YOLOv11 model to generate macular edema classification results. Output classification labels, such as... Figure 5 As shown. Determine whether the image is macular edema or NO macular edema. Step 12: Evaluate classification performance. The confusion matrix generated based on the test set is as follows: Figure 6 As shown, the performance metrics for the improved YOLOv11 are calculated, including: Step 12.1: Calculate the accuracy rate using the following formula: The result calculated using the above formula and confusion matrix is 0.991.
[0051] Step 12.2: Calculate the sensitivity using the following formula: The result calculated using the formula and confusion matrix is 0.986.
[0052] Step 12.3: Calculate the specificity using the following formula: The result calculated using the above formula and confusion matrix is 0.994.
[0053] Step 12.4: Calculate the precision rate using the following formula: The result calculated using the above formula and confusion matrix is 0.994.
[0054] Step 12.5: Calculate the F1 score using the following formula: In the formula, True Positive (TP): represents the number of samples that are both true CME and predicted as CME. False Negative (FN): represents the number of samples that are true CME but are incorrectly predicted as non-CME. False Positive (FP): represents the number of samples that are true non-CME but are incorrectly predicted as CME. True Negative (TN): represents the number of samples that are both true non-CME and predicted as non-CME.
[0055] Step 13: Compare model performance. Compare LDConv and CBAM with standard YOLOv11 (accuracy 0.989) and ResNet34 (accuracy 0.978) to verify their improvements. The comparison results are shown below: Step 14: Save the trained classification model in ONNX format for efficient deployment and use in subsequent classification tasks.
[0056] Step 15: Determine the segmentation task target. Based on the preprocessed fundus image, the U-KAN network is used to perform pixel-level segmentation of macular edema-related regions (such as macular edema, exudate, or fluid accumulation areas) to generate a precise segmentation mask, providing more granular lesion information for subsequent diagnostic and treatment suggestions. The goal of the segmentation task is to label the macular edema lesion region (labeled as "macular edema_region") and the non-lesion region (labeled as "Background").
[0057] Step 16: Use publicly available online datasets to uniformly process the images and resize them to 512*512 pixels.
[0058] Step 17: Constructing the U-KAN Segmentation Model. A segmentation network is constructed based on the U-KAN algorithm to adapt to the macular edema lesion segmentation task. U-KAN is a variant of U-Net based on KAN (Kolmogorov-Arnold network), optimizing medical image segmentation performance through efficient nonlinear feature representation and multi-scale feature fusion. Specifically, U-KAN employs an encoder-decoder structure. The encoder extracts multi-scale features, and the decoder restores spatial resolution through upsampling. The KAN module replaces the traditional convolutional layer, using basis functions to approximate complex features, improving the ability to model the irregularities of macular edema lesion boundaries.
[0059] Step 18: Train the U-KAN segmentation model Step 18.1: Data augmentation involves performing operations such as random rotation on the image and mask to increase the amount of data and improve the model's robustness to clinical images.
[0060] Step 18.2: Initialize parameters Randomly initialize the U-KAN network weights, set the initial learning rate to 0.001, and the optimizer to Adam.
[0061] Step 18.3: Configure the training environment. Use an NVIDIA 4090 GPU for training, with a batch size of 16, a training cycle of 400 epochs, and a training time of approximately 8 hours.
[0062] Step 18.4: Define the loss function. A composite loss function is used, combining DiceLoss and cross-entropy loss to optimize segmentation accuracy. The formula is as follows: in Binary cross-entropy loss measures the pixel-by-pixel difference between the predicted probability and the true label.
[0063] Dice loss measures the degree of overlap between the predicted segmented region and the actual segmented region.
[0064] Weighting coefficients are used to balance the contributions of the two types of losses and are usually adjusted according to task requirements.
[0065] Step 18.5: Monitor the training records during the training process, including the loss, Dice coefficient, and IoU (Intersection over Union), as shown in Figure 7, to ensure that the model converges to high performance.
[0066] Step 18.6: Generate and store the segmentation model for efficient deployment and use in subsequent segmentation tasks.
[0067] Step 19: Build a DeepSeek model locally. To achieve intelligent diagnosis and treatment support, the DeepSeek large language model is used to generate personalized diagnosis and treatment suggestions.
[0068] Step 20: Create a user profile, including the patient's age, cause of illness (such as diabetes or postoperative inflammation), and treatment history.
[0069] Step 21: Prepare data for diagnosis and treatment recommendations.
[0070] Step 22: Obtain the classification results. This includes the macular edema / NO macular edema labels, probabilities, and confidence scores output by YOLOv11.
[0071] Step 23: If the classification result is macular edema, input the test set image into the trained U-KAN model to generate a binary mask of the macular edema lesion area. If the classification result is NO macular edema, skip steps 23-24.
[0072] Step 24: Overlay a segmentation mask (macular edema lesions are shown in blue) onto the fundus image to generate a visualization output, which is included in the comprehensive report in step 26.
[0073] Step 25: Combining clinical information and test results, execute treatment recommendation reasoning. DeepSeek generates structured recommendations through multiple rounds of reasoning, integrating classification results, clinical information, and a knowledge base.
[0074] Step 26: Support report output formats. The comprehensive report supports screen display and PDF export to meet clinical needs; as shown in Figure 9, (a), (b) and (c) in Figure 9 are a single report.
[0075] This invention provides a method for processing macular edema images based on an improved YOLOv11 and DeepSeek, optimizing feature extraction: by employing an improved YOLOv11 algorithm and adding an LDConv (lightweight dynamic convolution) module, the shape and size of the convolution kernel are dynamically adjusted to accurately capture multi-scale lesion features such as macular edema and exudates; this improvement enhances the detection accuracy of macular edema lesions in complex scenarios (such as changes in illumination and noise interference).
[0076] Enhanced focus on lesions: The CBAM (Convolutional Block Attention Module) attention mechanism is integrated into the YOLOv11 network; attention maps are generated through channel and spatial attention mechanisms to prioritize key lesion areas of macular edema and suppress background noise interference, thereby further improving the accuracy and robustness of lesion identification.
[0077] Improving processing efficiency: The YOLOv11 network architecture was optimized to reduce computational complexity, and training was performed using a hybrid dataset of hospital data and publicly available data to enhance the model's generalization ability. This optimization not only ensures detection accuracy but also supports the system's real-time processing speed, thereby meeting the needs of large-scale screening.
[0078] Intelligent treatment recommendations are achieved by introducing the DeepSeek large language model. Based on the test results and combined with the patient's clinical information (such as age, etiology, treatment history, etc.), personalized treatment recommendations that conform to clinical guidelines are generated. The system provides structured treatment plans and follow-up plans to help doctors make more scientific and personalized decisions.
[0079] Ensuring system stability: Through multimodal data fusion and continuous optimization training strategies, combined with image preprocessing techniques (such as image cropping, normalization, and enhancement), the system is ensured to maintain high stability and high accuracy output under diverse fundus image inputs.
[0080] Through the above technical solutions, this invention can efficiently and accurately detect macular edema lesions and automatically generate intelligent diagnostic and treatment suggestions, greatly improving diagnostic efficiency and the quality of clinical decision support. The system's innovative measures, such as optimized feature extraction, enhanced lesion focus, and intelligent suggestion generation, successfully solve the problems of insufficient accuracy, low efficiency, and inadequate intelligent support in the diagnosis of macular edema in existing technologies, demonstrating significant application prospects.
[0081] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for processing macular edema images based on improved YOLOv11 and DeepSeek, characterized in that, Includes the following steps: Step S1: Acquire fundus images and preprocess the images; Step S2: Construct a mixed image dataset and divide it into a training set, a validation set, and a test set; Step S3: Based on linear deformation convolution and convolutional block attention module, improve YOLOv11 network to obtain macular edema classification model; Step S4: Train the macular edema classification model based on the training set; Step S5: Evaluate the performance of the macular edema classification model using the test set and output the classification results; Step S6: If the classification result is macular edema, then use the U-KAN segmentation model to segment the lesion area and generate a segmentation mask; Step S7: Based on the OpenCV algorithm, draw the disease region on the generated segmentation mask to obtain the segmented image; Step S8: Combine patient clinical information and classification results to generate personalized treatment suggestions using the DeepSeek large language model; Step S9: Output a comprehensive report containing classification results, segmented images, and diagnostic recommendations.
2. The method for processing macular edema images based on improved YOLOv11 and DeepSeek according to claim 1, characterized in that, The specific methods for acquiring fundus images and preprocessing the images in step 1 include: S1-1: Image cropping: Crop the image center to 512x512 pixels, focusing on the macular region, and retaining key diagnostic information; S1-2: Adjust image resolution: Further adjust the cropped image to 224x224 pixels to match the model input requirements; S1-3: Normalization: Standardize the pixel values and map them to the [0,1] range; S1-4: Application data enhancement: employs random brightness adjustment, contrast enhancement, Gaussian noise addition, and blurring.
3. The image processing method for central retinal edema based on improved YOLOv11 and DeepSeek according to claim 1, characterized in that, The specific methods for constructing the image hybrid dataset and dividing it into training, validation, and test sets in step S2 include: The hybrid dataset consists of fundus images collected within the hospital and publicly available fundus image datasets. The specific steps for dividing the hybrid dataset into training, validation, and test sets in an 8:1:1 ratio are as follows: S2-1: Allocate a training set for optimizing model parameters, which includes diverse macular edema and non-macular edema samples; S2-2: Allocate a validation set to tune hyperparameters and validate model performance; S2-3: Assign a test set for the final performance evaluation to ensure objective results.
4. The image processing method for central retinal edema based on improved YOLOv11 and DeepSeek according to claim 1, characterized in that, The specific method for improving the YOLOv11 network based on linear deformation convolution and convolutional block attention modules to obtain the macular edema classification model in step S3 includes: S3-1: Replace the standard convolutional layer in the C3k2 module of the YOLOv11 network backbone with linear deformation convolution, and optimize multi-scale feature extraction by dynamically adjusting the shape and size of the convolutional kernel; S3-2: Add a convolutional block attention module before the classify header to generate an attention map through channel and spatial attention mechanisms, prioritizing key lesion areas of macular edema and suppressing background noise interference; S3-3: Set initial parameters for the improved network structure, randomly initialize weights, and set the initial learning rate to 0.001; S3-4: Train the improved network multiple times using the training set, dynamically adjust the learning rate using the Adam optimizer and cosine annealing strategy, and monitor the training process using the cross-entropy loss function until the model converges. The cross-entropy loss function is: in, For real labels, To predict probabilities; S3-5: Save the network weights obtained after training and generate the macular edema classification model.
5. The method for processing macular edema images based on improved YOLOv11 and DeepSeek according to claim 1, characterized in that, The specific method for evaluating the performance of the macular edema classification model using the test set and outputting the classification results in step S5 includes: S5-1: Input the test set images into the trained macular edema classification model to obtain the classification label for each image; S5-2: Based on the confusion matrix generated from the test set, calculate the performance metrics of the macular edema classification model, including: The accuracy rate is calculated using the following formula: The sensitivity is calculated using the following formula: The specificity is calculated using the following formula: The accuracy rate is calculated using the following formula: The formula for calculating the F1 score is as follows: In the formula: TP represents the number of samples that are actually macular edema and are predicted to be macular edema; FN represents the number of samples that are actually macular edema but are incorrectly predicted as not macular edema; FP represents the number of samples that are actually not macular edema but are incorrectly predicted as macular edema; TN represents the number of samples that are actually not macular edema and are predicted as not macular edema. S5-3: Output the classification result, which includes a determination label for whether the image is macular edema and its corresponding confidence level.
6. The method for processing macular edema images based on improved YOLOv11 and DeepSeek according to claim 1, characterized in that, If the classification result in step S6 is macular edema, then the U-KAN segmentation model is used to segment the lesion area. The specific method for generating the segmentation mask includes: S6-1: Construct the U-KAN segmentation model, which adopts an encoder-decoder structure based on the Kolmogorov-Arnold network; S6-2: Collect a dataset of macular edema lesions with pixel-level annotations, and preprocess and augment the images and corresponding segmentation masks; S6-3: The U-KAN segmentation model is trained using the aforementioned macular edema lesion dataset. A composite loss function, combining Dice Loss and cross-entropy loss, is used to optimize the segmentation accuracy, as shown in the following formula: in, Binary cross-entropy loss measures the pixel-wise difference between the predicted probability and the true label; The Dice loss measures the degree of overlap between the predicted segmented region and the actual segmented region. , This is a weighting coefficient used to balance the contributions of the two types of losses, and is usually adjusted according to task requirements; S6-4: Input the test set images classified as macular edema into the trained U-KAN segmentation model, perform forward inference, and output a pixel-level binary segmentation mask; S6-5: Post-process the output segmentation mask to generate an accurate mask for labeling lesion areas.
7. The method for processing macular edema images based on improved YOLOv11 and DeepSeek according to claim 1, characterized in that, The specific method for generating personalized treatment suggestions using the DeepSeek large language model by combining patient clinical information and classification results as described in step S8 includes: S8-1: Construct prompt word templates to convert patient clinical information, macular edema classification results, and lesion feature information into structured text input that can be understood by a large language model; S8-2: Input the structured text into the locally deployed DeepSeek large language model; S8-3: The DeepSeek large language model performs multi-round reasoning on the input information based on the embedded medical knowledge base to generate preliminary diagnosis and treatment suggestion text that conforms to clinical guidelines and includes treatment plans and follow-up plans; S8-4: Post-process and format the generated preliminary suggestion text to output the final structured personalized treatment suggestions.
Citation Information
Patent Citations
Fundus image-oriented microaneurysm detection method
CN110766643A
Breast mass detection method based on improved YOLOv5s
CN116468675A
Personalized patient treatment suggestion system based on large language model
CN118262933A
Ophthalmic disease intelligent diagnosis and treatment management method and system based on large model
CN119181495A
Crop disease and insect pest identification method and device and prevention and control scheme generation method and device
CN120219805A
