A dynamic decision image segmentation method based on SAM basic model

The dynamic decision-making image segmentation method based on SAM solves the deficiencies in accuracy and computational efficiency of fundus image segmentation technology, achieves flexible adaptation to individual differences and complex pathologies, meets the needs of rapid clinical diagnosis, and improves segmentation accuracy and Computational efficiency.

CN118072378BActive Publication Date: 2024-09-27ZHUHAI ESSEX TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410272817.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-11
Publication Date
2024-09-27
Estimated Expiration
2044-03-11

AI Technical Summary

Technical Problem

Existing fundus image segmentation technology has insufficient accuracy and computational efficiency when processing images of varying quality, and lacks flexibility and adaptability. It is difficult to meet individual differences and complex pathological needs, especially in rapid clinical diagnosis due to computational resource and time constraints. .

Method used

A dynamic decision-making image segmentation method based on the SAM basic model is used to identify key areas through denoising and sharpening preprocessing, establish a feature extraction model and assign different weights, adopt a task adaptation strategy and incremental update mechanism, and combine the hierarchical attention mechanism and feature library , to achieve image segmentation and optimization.

Benefits of technology

It improves the accuracy and generalization of image analysis, reduces the risk of misdiagnosis, improves the adaptability to individual differences and disease states, meets the needs of rapid clinical diagnosis, improves calculation efficiency and segmentation accuracy, and ensures long-term stability and reliability .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118072378B
    Figure CN118072378B
Patent Text Reader

Abstract

The present application provides a dynamic decision-making image segmentation method based on the SAM basic model, including: performing denoising and sharpening preprocessing on the acquired fundus image, using SAM to identify the key areas and non-key areas in the processed fundus image, and using regional growing to establish the boundaries and positions of the areas; using fundus image data to establish a fundus feature extraction model, obtain features for distinguishing key areas and non-key areas, and assign different weights; adding a hierarchical attention mechanism to the AI-Agent, focusing on the main key areas for feature extraction and processing, and turning to the secondary key areas after the analysis of the main key areas is completed; after processing the key areas, the AI-Agent obtains and analyzes the segmentation results, pays attention to the segmentation quality and recognition problems, and performs incremental learning based on the obtained result feedback; based on user feedback, the AI-Agent automatically adjusts the segmentation strategy and reports the progress and results to the user in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of information technology, and in particular to a dynamic decision image segmentation method based on a SAM basic model. Background Art

[0002] As a key technology in the field of medical image processing, fundus image segmentation plays an irreplaceable role in the diagnosis and treatment of ophthalmic diseases. Although some progress has been made in this field, it still faces many unresolved technical problems. The quality of fundus images is affected by many factors, such as lighting conditions, differences in imaging equipment, and physiological variations of patients. Problems such as image blur, distortion or noise seriously affect the accuracy and reliability of segmentation. At present, the industry lacks a robust method to process these images of varying quality to achieve accurate segmentation. Most existing segmentation algorithms rely on fixed rules or predefined features, lack the necessary flexibility and adaptability, and are not effective when processing unseen image types or complex pathologies. Fundus image segmentation requires not only the identification of a single structure, but also the simultaneous processing of multiple structures and features. Existing single-task segmentation methods are difficult to meet this diversified demand. The diversity and complexity of fundus structures, including differences in structures such as blood vessels, optic discs, and macula, as well as the significant differences between diseased and normal states, place high demands on the accuracy and generalization ability of segmentation algorithms. Existing technologies are difficult to fully meet these demands, especially when dealing with extreme or special situations. In clinical applications, quickly obtaining segmentation results is crucial for timely diagnosis and treatment of diseases. However, many high-precision segmentation techniques require a lot of computing resources and time, which is a significant limitation in actual clinical environments. Therefore, how to improve the computational efficiency and real-time performance of the algorithm while maintaining segmentation accuracy has become an urgent problem to be solved. Each patient's fundus image is unique. Most current segmentation technologies use a unified processing method that ignores individual differences between patients. Therefore, developing a personalized fundus image segmentation method that can adapt to the unique needs of each patient is an important direction for future research. Summary of the invention

[0003] The present invention provides a dynamic decision image segmentation method based on the SAM basic model, which mainly includes:

[0004] Perform denoising and sharpening preprocessing on the acquired fundus images, use SAM to identify key areas and non-key areas in the processed fundus images, and use region growing to establish the boundaries and positions of the regions;

[0005] Use fundus image data to establish a fundus feature extraction model to obtain features that distinguish key areas from non-key areas and assign different weights;

[0006] After obtaining the key area features of the image, a task adaptation strategy is adopted. Multiple segmentation tasks share the key area features in the AI-Agent based on the task adaptation strategy, and the features are fine-tuned according to the requirements of different tasks to achieve the segmentation goal;

[0007] Monitor the performance of the AI-Agent based on the task adaptation strategy. When the performance of the AI-Agent based on the task adaptation strategy degrades when performing a certain task, implement an incremental update mechanism, adjust the feature extraction strategy of the key area, update the attention allocation mode, and retrain to optimize the single-task performance;

[0008] According to the adjusted key area features, a key area feature library of fundus images is established. When a new fundus image is input into the system, the sample image in the matching feature library is retrieved, the key area position information with a matching degree higher than the preset similarity with the new image is extracted, and the attention area of ​​the AI-Agent is determined;

[0009] After the AI-Agent determines the attention area, it performs the fundus image segmentation task based on the shared feature learning and task adaptation strategy, obtains the segmentation results, and updates the new features and results to the fundus image key area feature library;

[0010] Add a hierarchical attention mechanism to AI-Agent, focusing on the main key areas for feature extraction and processing. After the analysis of the main key areas is completed, it turns to the secondary key areas.

[0011] After processing the key areas, AI-Agent obtains and analyzes the segmentation results, focusing on segmentation quality and identification issues, and performs incremental learning based on the obtained result feedback;

[0012] Based on user feedback, AI-Agent automatically adjusts the segmentation strategy and reports progress and results to users in real time.

[0013] Preferably, the method of performing denoising and sharpening preprocessing on the acquired fundus image, using SAM to identify key areas and non-key areas in the processed fundus image, and using region growing to establish the boundaries and positions of the regions includes:

[0014] Pre-training is performed on the acquired fundus image dataset, and general image features are learned through self-supervised tasks, including predicting the pixel content of randomly occluded parts and performing pixel-level contrast learning; based on the pre-training, transfer learning is performed on the segmentation task, and the performance on the target segmentation task is improved by fine-tuning the model parameters; the model parameters are optimized, the network weights are updated through the back-propagation algorithm, and the model performance is iteratively optimized on the training data until the predetermined stopping condition is reached to obtain the trained SAM; the acquired fundus image is input into the image encoder, mapped to the image feature space, used adaptive mean filtering for noise reduction, smoothed the image and reduced speckle noise; enhanced image contrast through histogram equalization, and sharpened the image with the Laplace algorithm to improve detail clarity; used SAM to process the pre-processed fundus image, identified and located the key areas of the fundus, including the optic disc, blood vessels, and cups; used SAM to further segment and identify the key areas including the optic disc, blood vessels, and cups, and combined with the color and texture features of the original image, identified and subdivided the lesion site; for the lesion area where the boundary is difficult to determine, the region growing algorithm is used, starting from the seed point, and gradually absorbing the surrounding similar pixels to determine the scope of the lesion area. SAM provides an accurate starting seed point for the region growing algorithm to enhance the segmentation accuracy; according to the segmentation results of SAM and the results of the region growing algorithm, the boundary of the lesion area is adjusted and confirmed, and the accurate boundary information, area, and position of the lesion area are output.

[0015] Preferably, the fundus image data is used to establish a fundus feature extraction model to obtain features for distinguishing key areas from non-key areas and assigning different weights, including:

[0016] Obtain fundus image data segmented and labeled by SAM, including normal images and images of various fundus diseases, and annotate the data, marking key areas and lesion types. Non-key areas are areas outside the key areas in the image; perform preprocessing operations on the image, including denoising and image enhancement, to generate a fundus image dataset, and divide the dataset into a training set and a test set according to a preset ratio; use ResNet to establish a fundus feature extraction model based on the training set of fundus image data, and map the prompts input by the fundus feature extraction model, including sparse prompts and dense prompts, to the prompt feature space through the prompttencoder in SAM, with the points, target boxes or descriptive texts input by the user as sparseprompts, and the segmentation mask of the target area to be segmented as dense. prompts; use the error back propagation algorithm and Adam to update the network parameters, so that the fundus feature extraction model learns and extracts the global features of the fundus image, and represents the extracted features in vector form. During the training process, the performance of the fundus feature extraction model on the test set is regularly verified to ensure that the fundus feature extraction model has generalization ability; use a support vector machine to evaluate the features of each layer output in the fundus feature extraction model, and assign different weights to the features of the key areas and non-key areas according to the contribution of the features to identifying the key areas and non-key areas; also includes: assigning different weights to the features of the key areas and non-key areas to strengthen the feature expression of the key areas.

[0017] The method of assigning different weights to the features of the key area and the non-key area to strengthen the feature expression of the key area specifically includes:

[0018] The fundus feature extraction model is used to extract the vector representation of the global features of the fundus image data. An attention layer is added to the fundus feature extraction model, and the pixels in the image are weighted according to the annotated key areas to obtain a new representation of the weighted key area features, in which the feature weights of the key areas are enhanced. The weights of each feature in the key areas and non-key areas are determined according to the gradient boosting decision tree, and the adjusted feature representations are adjusted according to the weights to obtain re-weighted features. The fundus feature extraction model is retrained using the re-weighted features to ensure that the fundus feature extraction model pays attention to the key areas during the retraining process and improves the recognition accuracy of the key areas. The retrained fundus feature extraction model is evaluated using the test set to obtain the precision, recall rate, and F1 value indicators, and the model is comprehensively evaluated. According to the evaluation results, the parameters of the fundus feature extraction model are adjusted.

[0019] Preferably, after acquiring the key area features of the image, a task adaptation strategy is adopted, and multiple segmentation tasks share the key area features in the AI-Agent based on the task adaptation strategy, and the features are fine-tuned according to the requirements of different tasks to achieve the segmentation goal, including:

[0020] The key area features are obtained from the fundus retinal image, and the key areas include retinal blood vessels, optic disc, and macula, and the feature representation mask of the key areas is obtained; the extracted key area feature mask is input into the AI-Agent, and for each segmentation task, including segmentation of blood vessels, optic disc or macula, relevant feature subsets are selected and extracted, so that the AI-Agent selects feature subsets related to different segmentation tasks according to the current task requirements, and obtains the AI-Agent based on the task adaptation strategy; through the recursive feature elimination of the support vector machine, according to the weights assigned to the features by the support vector machine, the features are recursively eliminated, and the features that contribute most to the classification are retained, so as to ensure that the extracted feature subsets have relevance and discrimination; the feature transformation adopted for each task is fine-tuned to ensure that the feature space matches the requirements of the encoder module of SAM, and the encoder module of SAM is used to extract the key area features. The er module requires that the feature dimension, feature type and distribution are consistent with the model compatibility. If the feature space distribution of a segmentation task does not match the requirements of the SAM encoder module, linear mapping is used to adjust the feature subset; the fine-tuned feature subset is input into the SAM encoder module corresponding to the AI-Agent based on the task adaptation strategy; according to the calculation method of each segmentation task, the adapted features are repeatedly input until a segmentation result with a segmentation accuracy higher than the preset accuracy is obtained. For segmentation tasks with a segmentation accuracy lower than the preset accuracy, the features and SAM parameters are fine-tuned iteratively for multiple times; the feature fine-tuning process is evaluated and feedback is given based on the segmentation results. If the feedback segmentation results do not meet the requirements, analyze whether the problem lies in feature selection or feature transformation, and adjust the AI-Agent based on the task adaptation strategy accordingly; it also includes: using a mask decoder to integrate the outputs of the image encoder and prompt encoder to decode the final segmentation mask from the feature map.

[0021] The mask decoder is used to integrate the output of the image encoder and the prompt encoder to decode the final segmentation mask from the feature map, specifically including:

[0022] Construct components image encoder, prompt encoder, mask decoder, Image Encoder (IE), IE (I) receives fundus image I and outputs feature map F I, Prompt Encoder (PE), PE (S, D) receives sparse prompts S and dense prompts D, and outputs feature prompts F S and F D ,Mask-Decoder(MD),MD(F I , F S , F D ) receives features from Image Encoder and Prompt Encoder, and decodes them to generate the final segmentation mask M. Image Encoder processes the input fundus image I and generates a feature map F I At the same time, Prompt Encoder processes sparse prompts S and dense prompts D to generate feature prompts F S and F D , the feature hint F S and F D Input Mask Decoder. MaskDecoder integrates features and uses the decoding formula to generate the final segmentation mask M. Let F I , F S , F D They are image features, sparse prompt features, and dense prompt features. The decoding formula is in, Represents the feature fusion operation, which is a connection or weighted sum, W f and b f are the weights and biases of the Mask Decoder, * represents the convolution operation, and σ is the activation function, sigmoid, which is used to generate binary or multi-value segmentation masks.

[0023] Preferably, the monitoring of the performance of the AI-Agent based on the task adaptation strategy, when the performance of the AI-Agent based on the task adaptation strategy deteriorates when performing a certain task, implements an incremental update mechanism, adjusts the feature extraction strategy of the key area, updates the attention allocation mode, and retrains to optimize the single-task performance, including:

[0024] Set periodic evaluation points, use accuracy, recall, and F1 score indicators to evaluate the performance of AI-Agent, monitor the output of the model in real time, and pay attention to tasks that degrade the model performance; when the performance indicator is lower than the preset threshold, or has a drop of more than the preset percentage relative to the previous evaluation point, trigger the problem identification mechanism; analyze the tasks with degraded performance and determine the direction of the problem, including feature extraction problems and data distribution changes; obtain the features that contribute to the degraded performance of the current task, and determine whether it is necessary to introduce new features or eliminate useless features; if the problem direction is a feature extraction problem, introduce a new feature extraction method and use an updated eye Fundus feature extraction model, or adjust the parameters of the existing fundus feature extraction model; readjust the attention weights according to the results of the error analysis to make the model focus on the key areas; if the problem direction is the change of data distribution, adapt to the new data distribution through data augmentation or resampling, update the training and validation data sets, and add the latest or performance-degraded related data; retrain the model according to the updated features and adjusted data sets, optimize the learning rate and regularization strength hyperparameters, and improve the performance and generalization ability of the model; verify the updated model performance on an independent test set, and continuously monitor the model performance to ensure that the improvement measures are effective and no new problems are introduced.

[0025] Preferably, the method of establishing a fundus image key area feature library based on the adjusted key area features, retrieving sample images in the matching feature library when a new fundus image is input into the system, extracting key area position information with a matching degree higher than a preset similarity with the new image, and determining the attention area of ​​the AI-Agent includes:

[0026] The existing fundus image dataset is subjected to feature extraction, and the extracted features and their corresponding images and region information are stored in the database to obtain the fundus image key region feature library. When a new fundus image is input, features are extracted from the image, and the most similar image or feature is retrieved from the fundus image key region feature library. The feature vector of the new image is f new , the feature vector of the sample image in the feature library is f sample , the similarity is calculated using cosine similarity, Where · represents the dot product, and ║f║ is the Euclidean norm of the vector. N images with similarity higher than the preset similarity are obtained from the feature library, and the position information of each image is P i And the similarity score with the new image is S i , attention area P att is the average score of the key area positions weighted by similarity. The AI-Agent's attention area is adjusted according to the average score, and the AI-Agent's processing strategy is adjusted to prioritize the analysis of P att Scores above the preset average indicate areas.

[0027] Preferably, after the AI-Agent determines the attention area, the fundus image segmentation task is performed according to the shared feature learning and task adaptation strategy, the segmentation result is obtained, and the new features and results are updated to the fundus image key area feature library, including:

[0028] The fundus feature extraction model is trained using annotated images from different segmentation tasks, including blood vessels, optic discs, and macula. The fundus feature extraction model learns common features between different tasks while retaining unique information useful for each task to establish a shared feature extraction model. A task-adaptive network layer is designed for each segmentation task, including a convolutional layer or a fully connected layer. The task-adaptive network layer receives the output of the shared feature extraction model and further processes the adaptation task. For each new segmentation task, the task-adaptive network layer is fine-tuned using the annotated data, while the parameters of the shared feature extraction model remain unchanged or are only fine-tuned to ensure that the shared feature extraction model is consistent with the original image. The model can quickly adapt to new tasks while maintaining the learned common features; by implementing the spatial attention mechanism in the shared feature extraction model, the attention area determined by the AI-Agent is integrated into the shared feature extraction model as additional input information, and the shared feature extraction model focuses on the features of the key areas and ignores other areas; for the newly input fundus image, the shared feature extractor and the adapted task-adaptive network layer are used to perform image segmentation to obtain accurate segmentation of the key areas; the Dice coefficient is used to evaluate the segmentation results of each task, and the task-adaptive network layer is further optimized based on the evaluation results, and the shared feature extractor is updated.

[0029] Preferably, the AI-Agent adds a hierarchical attention mechanism to focus on the main key areas for feature extraction and processing. After the analysis of the main key areas is completed, it turns to the secondary key areas, including:

[0030] Define the key area hierarchy in the fundus image, with the top layer focusing on the global structure of the entire retina, the middle layer focusing on the main key areas of retinal blood vessels, optic disc, and macula, and the bottom layer focusing on detail features of blood vessel bifurcation points and tiny lesions; design an attention mechanism to integrate multi-scale features from AI-Agent, with the top layer attention based on overall features, while the bottom layer attention focuses on local features; at the top layer, AI-Agent uses its visual feature extraction capabilities to identify the overall retinal shape, size, and edges, and locate the main key areas of retinal blood vessels, optic disc, and macula; at the middle layer, the attention mechanism is refined to focus on the main key areas, including the direction of blood vessels, optic disc, and macula. The boundary of the neural disc connects the global view and detailed features through the middle-level attention. At the bottom level, the AI-Agent focuses on details, including tiny blood vessels and microscopic features of small lesions. The information obtained from each level is comprehensively analyzed to ensure that the AI-Agent not only focuses on a single area, but also integrates the features of each level. According to task requirements and real-time feedback during the processing, the resource allocation of each level of attention is dynamically adjusted. If the analysis of the main key area is completed, the AI-Agent reallocates resources to focus on the secondary key area. It also includes: after the AI-Agent completes the analysis of the main key area, it adjusts the focus of attention to the secondary key area.

[0031] After the AI-Agent completes the analysis of the primary key area, it adjusts its focus to the secondary key area, including:

[0032] When the segmentation accuracy of the region reaches the preset threshold, AI-Agent determines that the analysis of the main key area is completed. After the analysis of the main key area is completed, AI-Agent evaluates the current resource usage, including computing resources, time, and task priority. According to the resource evaluation results, resources and attention are transferred to the secondary key areas, reducing resource allocation to the analyzed areas and increasing resource investment in the unanalyzed areas. AI-Agent identifies the secondary key areas in the image, including small branches of blood vessels and tiny lesions, and performs detailed analysis of the secondary key areas. AI-Agent continuously monitors the processing effects on all areas to ensure the quality and efficiency of the overall analysis, and makes iterative improvements based on continuous performance monitoring and feedback to optimize the attention mechanism and analysis strategy.

[0033] Preferably, after processing the key areas, the AI-Agent obtains and analyzes the segmentation results, focusing on the segmentation quality and recognition issues, and performs incremental learning based on the obtained result feedback, including:

[0034] After completing the segmentation of a preset number of fundus images, AI-Agent obtains all segmentation results, including the segmentation map and segmentation accuracy and recall rate of each area; AI-Agent performs preliminary analysis, compares the segmentation results with the true labels, calculates the segmentation quality index, and identifies images with segmentation accuracy higher than the preset accuracy and images with problems; for images with segmentation accuracy lower than the preset accuracy, AI-Agent further analyzes to determine the nature of the problem, including mis-segmented areas, unidentified key structures, and unclear segmentation boundaries; based on the analysis results, AI-Agent performs incremental learning, adjusts SAM model parameters, updates training data, and introduces new feature representations, adjusts the SAM segmentation model, and solves the identified problems; AI-Agent reapplies the results of incremental learning to the image segmentation task, and obtains and analyzes the results again, continuing the feedback loop to improve the segmentation quality; AI-Agent continuously monitors the segmentation performance, regularly evaluates the overall and individual area segmentation quality, and makes iterative improvements based on the results of performance monitoring.

[0035] Preferably, the AI-Agent automatically adjusts the segmentation strategy based on user feedback and reports progress and results to the user in real time, including:

[0036] The design interface allows users to upload images and provide scores for the segmentation results through a form; users use annotation tools to mark problem areas on the image and describe feedback in the text box, which integrates a BERT-based dialogue system; users enter feedback through the text box, BERT parses the user's natural language and interacts with the AI-Agent, while the AI-Agent processes the rating feedback given by the user through a support vector machine and automatically adjusts the segmentation parameters; for text feedback, BERT is used to parse the user's opinions and suggestions, and for graphic annotations, a convolutional neural network is used to recognize and understand the annotation content; based on user feedback, the AI-Agent strategy is adjusted, including changing the segmentation algorithm SAM parameters, selecting different preprocessing methods, or adjusting the segmentation algorithm SAM; Matplotlib is used to display the completion status of the dynamically updated task, the estimated remaining time, and the segmentation results, and an interface is provided for users to confirm or request re-segmentation; the report generation tool Python's ReportLab library is integrated to automatically generate a report containing segmentation quality assessment and improvement suggestions.

[0037] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:

[0038] The present invention discloses a dynamic decision-making image segmentation method based on the SAM basic model. Through image preprocessing and key area identification, the accuracy and generalization of image analysis are improved, and the risk of misdiagnosis caused by inconsistent image quality is reduced. At the same time, the innovation of this technology in feature extraction and management optimizes the segmentation process, improves the adaptability to individual differences and disease states, and makes the diagnosis more personalized and accurate. In terms of real-time and computational efficiency, by quickly processing and accurately segmenting fundus images, the needs of clinical rapid diagnosis are met, especially in emergency or high-load clinical environments, and the continuous learning and optimization mechanism ensures the improvement of long-term stability and reliability. In addition, the introduced hierarchical attention mechanism and feature library establishment further improve efficiency while improving accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 The present invention is a flow chart of a dynamic decision image segmentation method based on the SAM basic model.

[0040] Figure 2 It is a schematic diagram of a dynamic decision image segmentation method based on the SAM basic model of the present invention.

[0041] Figure 3 It is another schematic diagram of a dynamic decision image segmentation method based on the SAM basic model of the present invention.

[0042] Figure 4 It is another schematic diagram of a dynamic decision image segmentation method based on the SAM basic model of the present invention.

[0043] Figure 5 It is another schematic diagram of a dynamic decision image segmentation method based on the SAM basic model of the present invention.

[0044] Figure 6 It is another schematic diagram of a dynamic decision image segmentation method based on the SAM basic model of the present invention. DETAILED DESCRIPTION

[0045] In order to further understand the content of the present invention, the present invention is described in detail in conjunction with the accompanying drawings and embodiments. The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant inventions, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.

[0046] like Figure 1-6 In this embodiment, a dynamic decision image segmentation method based on a SAM basic model may specifically include:

[0047] S101, performing denoising and sharpening preprocessing on the acquired fundus image, using SAM to identify key areas and non-key areas in the processed fundus image, and using region growing to establish the boundaries and positions of the regions.

[0048] Pre-training is performed on the acquired fundus image dataset, and general image features are learned through self-supervised tasks, including predicting the pixel content of randomly occluded parts and performing pixel-level contrast learning; based on pre-training, transfer learning is performed for segmentation tasks, and the performance on the target segmentation task is improved by fine-tuning the model parameters; the model parameters are optimized, the network weights are updated through the back-propagation algorithm, and the model performance is iteratively optimized on the training data until the predetermined stop condition is reached to obtain the trained SAM; the acquired fundus image is input into the image encoder of the SAM model, mapped to the image feature space, and the adaptive mean filter is used for denoising, smoothing the image and reducing speckle noise. The image contrast is enhanced by histogram equalization, and the image is sharpened by the Laplace algorithm to improve the clarity of details. The pre-processed fundus image is processed by SAM to identify and locate the key areas of the fundus, including the optic disc, blood vessels, and cups. The key areas including the optic disc, blood vessels, and cups are further segmented and identified using SAM, and the lesion sites are identified and subdivided by combining the color and texture features of the original image. For lesion areas with difficult-to-determine boundaries, the region growing algorithm is used to gradually absorb similar pixels around the seed point to determine the scope of the lesion area. SAM provides an accurate starting seed point for the region growing algorithm to enhance segmentation accuracy. Based on the segmentation results of SAM and the results of the region growing algorithm, the boundaries of the lesion area are adjusted and confirmed, and the precise boundary information, area, and position of the lesion area are output.

[0049] For example, on a dataset of 1000 fundus images, it was decided to perform self-supervised pre-training to learn common image features. A pre-training task was designed, which consisted of randomly blocking 10% of the pixels in the image and asking the model to predict the content of these blocked parts. In this task, the model successfully predicted 75% of the blocked pixels, indicating that some useful image features had been learned. In addition, pixel-level contrastive learning was performed, randomly selecting similar pixel blocks in two images and asking the model to determine whether they came from the same location. In this task, a contrastive loss function was used, and the model achieved an accuracy of 80% on the validation set. Based on the pre-training, the model was applied to the task of blood vessel segmentation of fundus images. A dataset of 200 annotated images was used as the target for transfer learning. By fine-tuning the parameters of the pre-trained model, the Dice coefficient on the validation set of the segmentation task was improved from a baseline of 85 to 90. For the optimization of the model parameters, a stochastic gradient descent optimizer with momentum was used, with a learning rate of 0.01 and a momentum of 9. During the iteration process, the loss function value of the model on the training set was monitored, and it was found that the initial loss was 3. After 10 epochs of training, the loss dropped to 0.5. An early stopping condition was set, that is, if the performance of the model on the validation set did not improve for 5 consecutive epochs, the training would be stopped. The model stopped training at the 15th epoch, when the Dice coefficient on the validation set had not improved significantly for 5 consecutive epochs. A trained SAM was obtained, which showed a higher performance than the pre-trained model on an independent test set, with a Dice coefficient of 92, which was 2 percentage points higher than the pre-trained model. For the collected fundus images, the image size was 512x512 pixels, and the input image encoder used an adaptive mean filter to denoise the image, and the neighborhood size of the filter was set to 5x5 pixels. The mean square error of the filtered image was calculated to evaluate the denoising effect. The mean square error of the denoised image was 10. Next, the denoised image was histogram equalized to enhance the contrast of the image. The contrast of the image after histogram equalization was improved by 30%. The Laplace algorithm was used to sharpen the image to improve the clarity of details. The average gradient of the sharpened image increased by 20%. The pre-processed fundus image was processed using SAM to identify and locate the key areas of the fundus, including the optic disc, blood vessels, and cups. SAM successfully located these key areas and generated their position and size information. Then, SAM was used to further segment and identify the key areas. SAM successfully segmented the lesions from the key areas and gave their position and area information. For the lesion areas whose boundaries were difficult to determine, the region growing algorithm was used to successfully determine the scope of the lesion area and give the boundary information of the lesion area.According to the segmentation results of SAM and the results of the region growing algorithm, the boundary of the lesion area is adjusted and confirmed, and the accurate boundary information, area, and position of the lesion area are output. The accuracy of the boundary information of the lesion area finally outputted reaches 90%, the area is 1000 square pixels, and the position is in the center of the image.

[0050] S102: Use the fundus image data to establish a fundus feature extraction model, obtain features for distinguishing key areas from non-key areas, and assign different weights.

[0051] Obtain fundus image data segmented and labeled by SAM, including normal images and images of various fundus diseases, and annotate the data, marking key areas and lesion types. Non-key areas are areas outside the key areas in the image; perform preprocessing operations on the image, including denoising and image enhancement, to generate a fundus image dataset, and divide the dataset into a training set and a test set according to a preset ratio; use ResNet to establish a fundus feature extraction model based on the training set of fundus image data, and map the prompts input by the fundus feature extraction model, including sparse prompts and dense prompts, to the prompt feature space through the prompttencoder in SAM, with the points, target boxes or descriptive texts input by the user as sparseprompts, and the segmentation mask of the target area to be segmented as dense. prompts; use the error back propagation algorithm and Adam to update the network parameters, so that the fundus feature extraction model learns and extracts the global features of the fundus image, and represents the extracted features in vector form. During the training process, the performance of the fundus feature extraction model on the test set is regularly verified to ensure that the fundus feature extraction model has generalization ability; use a support vector machine to evaluate the features of each layer output in the fundus feature extraction model, and assign different weights to the features of the key areas and non-key areas according to the contribution of the features to identifying the key areas and non-key areas; also includes: assigning different weights to the features of the key areas and non-key areas to strengthen the feature expression of the key areas.

[0052] For example, 1000 fundus image data were obtained from the SAM database, and these images were segmented and annotated. Among them, 800 images are normal fundus images, and 200 images are images of various fundus diseases, including macular degeneration and glaucoma. Before preprocessing the image, a noise removal operation was performed first. The median filter was applied using a 3x3 window to remove the noise in the image. Next, the image enhancement technology was applied to successfully enhance the brightness and contrast of the image through histogram equalization. 80% of the data was selected as the training set, that is, 800 images as the training set, and the remaining 200 images as the test set. Using the prepared training set, the fundus feature extraction model was trained. Using the ResNet architecture as the basis, a fundus feature extraction model was constructed, which not only receives fundus images as input, but also receives two types of prompts, sparse prompts and dense prompts. Sparse prompts are small but informative inputs. They are points, target boxes, or descriptive texts entered by users about specific parts of the image. In images of macular lesions, doctors will point out the macular area and provide a label or text description for it. In the training set, sparse prompts are annotated by experts or generated by some algorithms. Dense prompts are detailed descriptions of the target area to be segmented in the image. They are segmentation masks. In fundus images, this is an accurate segmentation of the lesion area, optic disc, or macula. Masks are used as labels during training, which not only help the model identify the target area more accurately, but also provide rich contextual information. A prompt encoder is designed to map sparse prompts and dense prompts to the prompt feature space. The mapping process extracts features by learning the relationship between prompts and fundus images, and converts them into a form that the model understands. In the training phase, fundus images and their corresponding sparse prompts and dense prompts are fed into the model. The model learns how to combine image content and prompt information to extract global features of the fundus. It not only learns the features of the image itself, but also learns how to extract features based on additional prompt information. The error back propagation algorithm and Adam optimizer were used to update the weights of the fundus feature extraction model. 100 epochs were used for training, and the loss and accuracy on the training set were monitored. During the training process, the model was validated every 10 epochs, and the loss and accuracy were calculated on the validation set. At the 50th epoch, the loss on the validation set was 5 and the accuracy was 90%.The support vector machine is used to evaluate the features output by each layer in the fundus feature extraction model, and the importance index of each feature in the gradient boosting support vector machine is calculated, including the feature importance score. If the feature importance score of a certain layer is [2, 3, 1, 4], the weights are assigned to [1, 3, 0.5, 5.5] respectively, reflecting the contribution of the feature to the identification of key areas and non-key areas.

[0053] Different weights are assigned to the features of key areas and non-key areas to strengthen the feature expression of key areas.

[0054] The fundus feature extraction model is used to extract the vector representation of the global features of the fundus image data. An attention layer is added to the fundus feature extraction model, and the pixels in the image are weighted according to the annotated key areas to obtain a new representation of the weighted key area features, in which the feature weights of the key areas are enhanced. The weights of each feature in the key areas and non-key areas are determined according to the gradient boosting decision tree, and the adjusted feature representations are adjusted according to the weights to obtain re-weighted features. The fundus feature extraction model is retrained using the re-weighted features to ensure that the fundus feature extraction model pays attention to the key areas during the retraining process and improves the recognition accuracy of the key areas. The retrained fundus feature extraction model is evaluated using the test set to obtain the precision, recall rate, and F1 value indicators, and the model is comprehensively evaluated. According to the evaluation results, the parameters of the fundus feature extraction model are adjusted.

[0055] For example, a fundus feature extraction model is used to extract a vector representation of the global features of fundus image data, focusing on the lesion area in the fundus image as the key area, and determining the weight of each feature in the key area and non-key area according to the gradient boosting decision tree. The fundus feature extraction model is trained to extract the global feature vector representation of the fundus image. There is a training set of 1,000 fundus images, each of which has a corresponding label indicating whether there is a fundus lesion. The fundus feature extraction model is trained using this training set to obtain a global feature vector representation. An attention layer is added to the fundus feature extraction model to weight the pixels in the image according to the annotated key area, and a new representation of the key area feature weight is obtained, in which the feature weight of the key area is enhanced, and the feature weight of the key area is set to twice the original feature weight. A gradient boosting decision tree is used to determine the weight of each feature in the key area and non-key area, and a decision tree algorithm is used to train a classifier, whose goal is to predict whether there is a fundus lesion in the fundus image based on the feature vector. During the training process, the decision tree assigns a weight to each feature, indicating the importance of the feature to the classification result. According to the results of the decision tree, the obtained feature representation is adjusted to obtain reweighted features. If a feature has a higher weight in the key area, the weight of the feature in the entire feature vector is doubled. The reweighted features are used to retrain the fundus feature extraction model. In this process, the fundus feature extraction model is ensured to focus on the key areas and improve the recognition accuracy of the key areas. The feature weights of the key areas are set to three times the original feature weights to emphasize the importance of the key areas. The retrained fundus feature extraction model is evaluated using the test set to obtain the precision, recall rate, and F1 value indicators to comprehensively evaluate the model. On the test set, the retrained fundus feature extraction model achieved 90% precision and recall rate, and 85% F1 value. According to the evaluation results, the performance of the model is analyzed and the parameters of the fundus feature extraction model are adjusted. If the recognition accuracy of the model in non-key areas is low, the feature weights of the key areas are increased to further improve the model's attention to the key areas.

[0056] S103, after acquiring the key area features of the image, a task adaptation strategy is adopted, and multiple segmentation tasks in the AI-Agent based on the task adaptation strategy share the key area features, and the features are fine-tuned according to the requirements of different tasks to achieve the segmentation goal.

[0057] The key area features are obtained from the fundus retinal image, and the key areas include retinal blood vessels, optic disc, and macula, and the feature representation mask of the key areas is obtained; the extracted key area feature mask is input into the AI-Agent, and for each segmentation task, including segmentation of blood vessels, optic disc or macula, relevant feature subsets are selected and extracted, so that the AI-Agent selects feature subsets related to different segmentation tasks according to the current task requirements, and obtains the AI-Agent based on the task adaptation strategy; through the recursive feature elimination of the support vector machine, according to the weights assigned to the features by the support vector machine, the features are recursively eliminated, and the features that contribute most to the classification are retained, so as to ensure that the extracted feature subsets are relevant and discriminative; the feature transformation adopted for each task is fine-tuned to ensure that the feature space matches the requirements of the encoder module of SAM, and the The encoder module requires that the feature dimension, feature type and distribution are consistent with the model compatibility. If the feature space distribution of a segmentation task does not match the requirements of the SAM encoder module, linear mapping is used to adjust the feature subset; the fine-tuned feature subset is input into the SAM encoder module corresponding to the AI-Agent based on the task adaptation strategy; according to the calculation method of each segmentation task, the adapted features are repeatedly input until a segmentation result with a segmentation accuracy higher than the preset accuracy is obtained. For segmentation tasks with a segmentation accuracy lower than the preset accuracy, the features and SAM parameters are fine-tuned iteratively for multiple times; the feature fine-tuning process is evaluated and feedback is given based on the segmentation results. If the feedback segmentation results do not meet the requirements, analyze whether the problem lies in feature selection or feature transformation, and adjust the AI-Agent based on the task adaptation strategy accordingly.

[0058] For example, there are 1,000 fundus retinal images, each of which marks the location of retinal blood vessels, optic discs, and macula, and extracts features from each key area. A 100-dimensional feature vector is extracted from the retinal blood vessels, and a 50-dimensional feature vector is extracted from the optic disc and macula. Design an AI-Agent,

[0059] AI-Agent is designed based on AutoGPT, which can select and extract relevant feature subsets according to tasks, including blood vessels, optic disc, and macula segmentation. When the task is blood vessel segmentation, AI-Agent may select 30 of the most informative blood vessel features out of 100 dimensions. In the blood vessel segmentation task, recursive feature elimination of vector machines is run to identify and retain the most contributing 30-dimensional features. 5% of the features are eliminated each iteration, and 14 rounds of iterations are performed to reduce to 30 dimensions. For each specific task, if the selected feature subset does not match the encoder module requirements of SAM, feature transformation is performed. If SAM requires a 20-dimensional encoder, the feature dimension is further reduced by principal component analysis. In the blood vessel segmentation task, the 30-dimensional features are reduced to 20 dimensions by principal component analysis. These 20-dimensional features are input into SAM, and the initial segmentation accuracy is 85%. Iterative training is performed, and the features and SAM parameters are fine-tuned each iteration, the regularization parameters of the support vector machine are adjusted, or the number of components of the principal component analysis is adjusted. After 5 iterations, the segmentation accuracy is increased to 92%. Based on the segmentation results, evaluate the effect of the feature fine-tuning process. The preset target is 95% accuracy. If the segmentation result does not meet the requirements, the analysis problem may lie in feature selection or feature transformation. Adjust the AI-Agent strategy, select more features, use different feature elimination strategies, or change the feature transformation method, and continue to iterate until the target accuracy is reached.

[0060] Use the mask decoder to integrate the output of the image encoder and prompt encoder to decode the final segmentation mask from the feature map.

[0061] Construct components image encoder, prompt encoder, mask decoder, Image Encoder (IE), IE (I) receives fundus image I and outputs feature map F I , Prompt Encoder (PE), PE (S, D) receives sparse prompts S and dense prompts D, and outputs feature prompts F S and F D ,Mask-Decoder(MD),MD(F I , F S , F D ) receives features from Image Encoder and Prompt Encoder, and decodes them to generate the final segmentation mask M. Image Encoder processes the input fundus image I and generates a feature map F IAt the same time, Prompt Encoder processes sparse prompts S and dense prompts D to generate feature prompts F S and F D , the feature hint F S and F D Input Mask Decoder. MaskDecoder integrates features and uses the decoding formula to generate the final segmentation mask M. Let F I , F S , F D They are image features, sparse prompt features, and dense prompt features. The decoding formula is in, Represents the feature fusion operation, which is a connection or weighted sum, W f and b f are the weights and biases of the Mask Decoder, * represents the convolution operation, and σ is the activation function, sigmoid, which is used to generate binary or multi-value segmentation masks.

[0062] For example, there is a set of fundus images and corresponding sparse prompts and dense prompts. We need to generate segmentation masks by constructing Image Encoder, Prompt Encoder, and Mask Decoder. Image Encoder (IE) inputs fundus image I with a size of 256×256 and feature map F I , each feature map has a size of 64×64×32. PromptEncoder (PE) inputs Sparse prompts S, including point coordinates and text descriptions, and has 5 sparse prompts. Dense prompts D is a 256×256 mask image. Feature prompt F S and F D , each is a 64×64×16 feature map. Mask Decoder (MD) inputs F from Image Encoder and Prompt Encoder I ,F S ,F D , output segmentation maskM, size 256×256. Decoding formula

[0063] Among them, W f is a 3×3×64 weight matrix, b fis the bias term, and σ is the sigmoid function. IE receives a 256×256 fundus image and generates a 64×64×32 feature map F through convolution, pooling and other operations. I PE receives 5 sparse prompts and one dense prompt D, each of which is processed to generate a 64×64×16 feature map F S and F D . I ,F S ,F D A comprehensive feature map is obtained by concatenation, and its size is 64×64×64. MD uses the preset weight W f and bias b f , through convolution and sigmoid activation, the final segmentation maskM is decoded with a size of 256×256.

[0064] S104. Monitor the performance of the AI-Agent based on the task adaptation strategy. When the performance of the AI-Agent based on the task adaptation strategy deteriorates when performing a certain task, implement an incremental update mechanism, adjust the feature extraction strategy of the key area, update the attention allocation mode, and retrain to optimize the single-task performance.

[0065] Set periodic evaluation points, use accuracy, recall, and F1 score indicators to evaluate the performance of AI-Agent, monitor the output of the model in real time, and pay attention to tasks that degrade the model performance. When the performance indicator is lower than the preset threshold, or has a drop of more than the preset percentage relative to the previous evaluation point, the problem identification mechanism is triggered. Analyze the tasks with degraded performance and determine the direction of the problem, including feature extraction problems and changes in data distribution. Obtain the features that contribute to the degraded performance of the current task, and determine whether it is necessary to introduce new features or eliminate useless features. If the problem direction is feature extraction problems, introduce new feature extraction methods, use updated fundus feature extraction models, or adjust the parameters of existing fundus feature extraction models. Readjust the attention weights based on the results of error analysis to focus the model on key areas. If the problem direction is changes in data distribution, adapt to the new data distribution through data augmentation or resampling, update the training and validation datasets, and add the latest or performance-related data. Retrain the model based on the updated features and adjusted datasets, optimize the learning rate and regularization strength hyperparameters, and improve the performance and generalization ability of the model. Validate updated model performance on an independent test set and continuously monitor model performance to ensure that improvements are effective and do not introduce new issues.

[0066] For example, evaluate the performance of the AI-Agent every 100 samples, set the thresholds for accuracy, recall, and F1 score, and set the accuracy>90%, recall>85%, and F1 score>88%. Track the output of the AI-Agent in real time, especially mark and record the tasks with sudden performance drops. If any performance indicator falls below the threshold or drops by more than the preset 5% relative to the previous evaluation point, trigger the problem identification mechanism. In-depth analysis of the tasks with degraded performance to identify whether it is a feature extraction problem, data distribution change, or other problems. Use tools such as LIME to analyze which features contribute significantly to the performance drop and decide whether to introduce new features or remove old features. If the problem is insufficient feature extraction, introduce new feature extraction methods and adjust the parameters of the existing fundus feature extraction model, including the number of layers, learning rate, or other hyperparameters. Based on the results of the error analysis, readjust the model's attention weights to ensure that the model focuses on the key areas to solve the problem. If the analysis shows that the data distribution has changed, use data augmentation or resampling strategies to adapt to the new data distribution and update the dataset, especially to add the latest data or data related to performance drops. Retrain the model using the updated features and adjusted dataset, and optimize the model's hyperparameters, such as learning rate and regularization strength, to improve performance and generalization. Use cross-validation to ensure model stability and effectiveness, and verify the updated model performance on an independent test set to ensure performance improvement. Even if the model performance has improved, continue to monitor its performance to promptly discover and resolve new issues.

[0067] S105. A fundus image key area feature library is established based on the adjusted key area features. When a new fundus image is input into the system, a sample image in the matching feature library is retrieved, key area position information with a matching degree higher than a preset similarity with the new image is extracted, and the attention area of ​​the AI-Agent is determined.

[0068] The existing fundus image dataset is subjected to feature extraction, and the extracted features and their corresponding images and region information are stored in the database to obtain the fundus image key region feature library. When a new fundus image is input, features are extracted from the image, and the most similar image or feature is retrieved from the fundus image key region feature library. The feature vector of the new image is f new , the feature vector of the sample image in the feature library is f sample , the similarity is calculated using cosine similarity, Where · represents the dot product, and ║f║ is the Euclidean norm of the vector. N images with similarity higher than the preset similarity are obtained from the feature library, and the position information of each image is P i And the similarity score with the new image is S i , attention area P attis the average score of the key area positions weighted by similarity. The AI-Agent's attention area is adjusted according to the average score, and the AI-Agent's processing strategy is adjusted to prioritize the analysis of P att Scores above the preset average indicate areas.

[0069] For example, there is a dataset containing 1,000 annotated fundus images. For each image, a 200-dimensional feature vector is extracted, including the color, texture, and shape information of the image. The key areas of each image, including the location information of retinal vessels, optic disc, and macula, are marked as coordinates (x, y). All feature vectors and location information are stored in the feature library. There is a new fundus image input system, from which a 200-dimensional feature vector f is extracted. new In the feature library, the cosine similarity is used to calculate the similarity with each image in the library. The five images with the highest matching degree are obtained, and their feature vectors are f sample1 ,f sample2 ,f sample3 , f sample4 ,f sample5 , the similarity scores are s1, s2, s3, s4, s5. The key area position information of these five images are p1, p2, p3, p4, p5, where pi = (xi, yi). The weighted average position score is calculated according to the formula Through feature matching, the following values ​​are obtained: similarity scores, s1=0.90, s2=0.85, s3=0.80, s4=0.78, s5=0.75, key area positions, p1=(100,200), p2=(110,210), p3=(105,205), p4=(120,220), p5=(115,215).

[0070] calculate

[0071] P att =0.90×(100,200)+0.85×(110,210)+0.80×(105,205)+0.78×(120,220)+0.75×(115,215) / (0.90+0.85+0.80+0.78+0.75). Calculate P att The coordinate point is (109,209). AI-Agent uses P att =(109,209) The determined attention area prioritizes processing of this area.

[0072] S106. After the AI-Agent determines the attention area, it performs the fundus image segmentation task according to the shared feature learning and task adaptation strategy, obtains the segmentation result, and updates the new features and results to the fundus image key area feature library.

[0073] The fundus feature extraction model is trained using annotated images from different segmentation tasks, including blood vessels, optic discs, and macula. The fundus feature extraction model learns common features between different tasks while retaining unique information useful for each task to establish a shared feature extraction model. A task-adaptive network layer is designed for each segmentation task, including a convolutional layer or a fully connected layer. The task-adaptive network layer receives the output of the shared feature extraction model and further processes the adaptation task. For each new segmentation task, the task-adaptive network layer is fine-tuned using the annotated data, while the parameters of the shared feature extraction model remain unchanged or are only fine-tuned to ensure that the shared feature extraction model is consistent with the original image. The model can quickly adapt to new tasks while maintaining the learned common features; by implementing the spatial attention mechanism in the shared feature extraction model, the attention area determined by the AI-Agent is integrated into the shared feature extraction model as additional input information, and the shared feature extraction model focuses on the features of the key areas and ignores other areas; for the newly input fundus image, the shared feature extractor and the adapted task-adaptive network layer are used to perform image segmentation to obtain accurate segmentation of the key areas; the Dice coefficient is used to evaluate the segmentation results of each task, and the task-adaptive network layer is further optimized based on the evaluation results, and the shared feature extractor is updated.

[0074] For example, the fundus feature extraction model is trained using annotated images from different segmentation tasks, including the segmentation tasks of blood vessels, optic disc, and macula. The shared feature extraction model is used to learn common features and retain unique information useful for each task. During the training process, 1000 annotated images are used to train the fundus feature extraction model. Among them, 500 images are used to train the shared feature extraction model, and the remaining 500 images are used for fine-tuning the task-adaptive network layer. For the shared feature extraction model, the features of the image are extracted using a convolutional layer, and its output is used as the input of the task-adaptive network layer. The output dimension of the shared feature extraction model is 256. For each segmentation task, a task-adaptive network layer is designed, including two fully connected layers. The output dimension of the first fully connected layer of the task-adaptive network layer is 128, and the output dimension of the second fully connected layer is 2, which is used for binary classification problems. The task-adaptive network layer receives the output of the shared feature extraction model and further processes it to adapt to the task. In the fine-tuning stage, 50 annotated images were used to fine-tune the task-adaptive network layer. For the vascular segmentation task, the Dice coefficient of the task-adaptive network layer after fine-tuning was 9. The spatial attention mechanism was introduced, and the attention area determined by the AI-Agent was used as additional input information to be integrated into the shared feature extraction model. The attention area determined by the AI-Agent is a rectangular box with a center coordinate of (100,100) and a width and height of 50 pixels respectively. For the newly input fundus image, it is input into the shared feature extractor and the adapted task-adaptive network layer for image segmentation. The Dice coefficient of the segmentation result is 85, indicating the accuracy of the segmentation. According to the evaluation results, it was found that for the vascular segmentation task, the Dice coefficient of the segmentation result was low, at 6.5. The vascular segmentation task-adaptive network layer was further optimized, and the shared feature extractor was updated.

[0075] S107. Add a hierarchical attention mechanism to the AI-Agent to focus on the main key areas for feature extraction and processing. After the analysis of the main key areas is completed, turn to the secondary key areas.

[0076] Define the key area hierarchy in the fundus image. The top layer focuses on the global structure of the entire retina, the middle layer focuses on the main key areas of retinal blood vessels, optic disc, and macula, and the bottom layer focuses on the detail features of blood vessel bifurcation points and tiny lesions. Design an attention mechanism to integrate multi-scale features from the AI-Agent. The top layer attention is based on the overall features, while the bottom layer attention is focused on local features. At the top layer, the AI-Agent uses its visual feature extraction capabilities to identify the overall retinal shape, size and edge, and locate the main key areas of retinal blood vessels, optic disc, and macula. At the middle layer, the attention mechanism is refined to focus on the main key areas, including the direction of blood vessels and the boundary of the optic disc. Through the middle layer attention, the global view and detail features are connected. At the bottom layer, the AI-Agent focuses on details, including microscopic features of tiny blood vessels and small lesions. The information obtained from each layer is comprehensively analyzed to ensure that the AI-Agent not only focuses on a single area, but also integrates the features of each layer. According to the task requirements and real-time feedback during the processing process, the resource allocation of each level of attention is dynamically adjusted. After the analysis of the main key area is completed, the AI-Agent reallocates resources to focus on the secondary key area.

[0077] For example, AI-Agent analyzed 100 fundus images and identified the shape and edges of the entire retina from each image. At this level, AI-Agent used global statistical features of the image, including average brightness, contrast, and simple shape descriptors to quickly locate the retina. AI-Agent refined the analysis of the retinal vessels in each image and identified an average of 300 vessel points, 1 optic disc per image, and 1 macula per image. In the process, it used the local texture features of the image to accurately identify the area. After analyzing the vascular bifurcation points with an average of 50 bifurcation points per image and the microlesion details with an average of 5 lesion details per image, AI-Agent focused on more detailed feature analysis, using local image segmentation algorithms or texture analysis techniques. AI-Agent first allocated 70% of resources to the top and middle layers, and the remaining 30% to the bottom layer. After completing the preliminary analysis of the main key areas and the middle layer, AI-Agent dynamically adjusted the resource allocation based on the analysis results. If the vascular structure of an image is found to be abnormally complex, more resources will be transferred from other areas to the bottom analysis of this image to ensure accurate segmentation. After each analysis, AI-Agent collects feedback on the segmentation effect. The segmentation accuracy of a certain area is 90%, and the accuracy of another area is 85%. Based on the feedback, AI-Agent adjusts its attention model and feature extraction strategy. It finds that the segmentation accuracy of a certain area is 85%, which is lower than the preset value of 88%. It increases the feature learning intensity of this area, or adjusts the attention weight to improve the accuracy of future analysis.

[0078] After AI-Agent completes the analysis of the primary key area, it adjusts its focus and turns to the secondary key area.

[0079] When the segmentation accuracy of the region reaches the preset threshold, AI-Agent determines that the analysis of the main key area is completed. After the analysis of the main key area is completed, AI-Agent evaluates the current resource usage, including computing resources, time, and task priority. According to the resource evaluation results, resources and attention are transferred to the secondary key areas, reducing resource allocation to the analyzed areas and increasing resource investment in the unanalyzed areas. AI-Agent identifies the secondary key areas in the image, including small branches of blood vessels and tiny lesions, and performs detailed analysis of the secondary key areas. AI-Agent continuously monitors the processing effects on all areas to ensure the quality and efficiency of the overall analysis, and makes iterative improvements based on continuous performance monitoring and feedback to optimize the attention mechanism and analysis strategy.

[0080] For example, AI-Agent was used to analyze a batch of 200 fundus images, and the preset accuracy threshold for retinal vascular segmentation was set to 95%. When AI-Agent segmented the first 100 images, it achieved an average segmentation accuracy of 96%, judging that the analysis of the main key areas had been completed. AI-Agent evaluated that the analysis of the first 100 images consumed 60% of the computing resources and half of the scheduled time. Based on the resource evaluation results, AI-Agent decided to invest the remaining 40% of resources in the analysis of the secondary key areas, reducing the resource allocation to the completed main areas. In the remaining 100 images, AI-Agent identified an average of about 10 microlesions and 20 small vascular branches per image as secondary key areas. AI-Agent refined the analysis of the secondary key areas, using more sophisticated feature extraction techniques, and the average analysis time per image increased by 30%. After processing all 200 images, AI-Agent continued to monitor the segmentation effect and found that the segmentation accuracy in the secondary key areas was 92%. Based on the monitoring results, AI-Agent adjusted its feature learning model and attention allocation strategy, investing more learning resources into improving the accuracy of sub-critical area segmentation. In the next batch of image analysis, the average segmentation accuracy of sub-critical areas was improved to 94%.

[0081] S108. After processing the key areas, the AI-Agent obtains and analyzes the segmentation results, focusing on the segmentation quality and recognition issues, and performs incremental learning based on the obtained result feedback.

[0082] After completing the segmentation of a preset number of fundus images, AI-Agent obtains all segmentation results, including the segmentation map of each area and the segmentation accuracy and recall rate. AI-Agent performs preliminary analysis, compares the segmentation results with the true labels, calculates the segmentation quality index, and identifies images with segmentation accuracy higher than the preset accuracy and images with problems. For images with segmentation accuracy lower than the preset accuracy, AI-Agent further analyzes to determine the nature of the problem, including mis-segmented areas, unidentified key structures, and unclear segmentation boundaries. Based on the analysis results, AI-Agent performs incremental learning, adjusts SAM model parameters, updates training data, and introduces new feature representations to adjust the SAM segmentation model and solve the identified problems. AI-Agent reapplies the results of incremental learning to the image segmentation task, and obtains and analyzes the results again, continuing the feedback loop to improve the segmentation quality. AI-Agent continuously monitors segmentation performance, regularly evaluates the overall and individual area segmentation quality, and makes iterative improvements based on the results of performance monitoring.

[0083] For example, AI-Agent completed the segmentation of 500 images with an average segmentation accuracy of 92% and an average recall rate of 90%. Compared with the true labels, AI-Agent identified 450 images with good segmentation results, while 50 images showed poor segmentation results. Among the 50 images with poor segmentation results, AI-Agent identified 25 images with mis-segmented areas, 15 images without identifying key structures, and 10 images with unclear segmentation boundaries. For the mis-segmented areas, the average error area was 2%, the unidentified key structures were mainly small blood vessels and macular edges, and images with unclear segmentation boundaries were usually in the retinal edge area. AI-Agent adjusted the segmentation model SAM, focused on training the 25 mis-segmented images with the most frequent errors, and increased the training data for image edge processing. The convolution kernel size in the segmentation network was adjusted, and new feature representations were introduced, including local texture descriptors, to improve the recognition of small blood vessels and edge areas. After the model was adjusted, AI-Agent processed the 50 images again, and this time the average segmentation accuracy was increased to 95% and the recall rate was increased to 93%. In the segmentation task of the next 100 new images, AI-Agent maintained an average segmentation accuracy of more than 94%, adjusted the learning strategy based on the results, optimized the attention mechanism, and processed the next batch of new images.

[0084] S109. Based on user feedback, AI-Agent automatically adjusts the segmentation strategy and reports the progress and results to the user in real time.

[0085] The design interface allows users to upload images and provide ratings for the segmentation results through a form. Users use annotation tools to mark problem areas on the image and describe feedback in a text box. The text box integrates a BERT-based dialogue system. Users enter feedback through the text box, BERT parses the user's natural language, and interacts with the AI-Agent. At the same time, the AI-Agent processes the rating feedback given by the user through a support vector machine and automatically adjusts the segmentation parameters. For text feedback, BERT is used to parse the user's opinions and suggestions. For graphic annotations, a convolutional neural network is used to recognize and understand the annotation content. According to user feedback, the AI-Agent strategy is adjusted, including changing the parameters of the segmentation algorithm SAM, selecting different preprocessing methods, or adjusting the segmentation algorithm SAM. Matplotlib is used to display the completion status of the dynamically updated task, the estimated remaining time, and the segmentation results, and an interface is provided for users to confirm or request re-segmentation. The report generation tool Python's ReportLab library is integrated to automatically generate a report containing segmentation quality assessment and improvement suggestions.

[0086] For example, a doctor uploads a fundus image with a size of 512x512 pixels. The segmentation model SAM automatically processes and displays the preliminary segmentation results. The doctor uses the slider to rate the segmentation results overall, with a rating range of 1 to 5. The doctor gives a rating of 3 points. The doctor finds that the segmentation of the optic disc area is inaccurate. He uses the annotation tool to circle the area on the image and enters in the text box that the edge of the optic disc area is not clear enough and requires more refined segmentation. The text is processed by the BERT-based dialogue system, and the processing result is that the segmentation of the optic disc needs to be improved. The support vector machine processes the 3-point evaluation given by the doctor and determines that the accuracy of the segmentation needs to be improved. BERT parses the text feedback, identifies the keywords optic disc and unclear edges, and uses a convolutional neural network to process the graphic annotations to accurately identify the area marked by the doctor. Based on the user's ratings and feedback, AI-Agent decides whether to adjust the parameters of the segmentation algorithm SAM, including adjusting the edge detection sensitivity from 0.3 to 0.5, or changing the preprocessing method, including changing from histogram equalization to a more complex Gabor filter. If the user requests re-segmentation, AI-Agent will reprocess the image according to the adjustment and display the new segmentation result. Use Matplotlib to display the progress bar of re-segmentation and the estimated remaining time in the user interface. After the segmentation is completed, the new segmentation result map is displayed. The doctor's satisfaction increased after the examination and gave a 5-point evaluation. Using the ReportLab library, a detailed report is generated, including the original image, segmentation result map, segmentation quality score, doctor's text feedback and AI-Agent's adjustment record. The report shows that the segmentation accuracy of the optic disc area has increased by 25%, from 75% to 100%.

[0087] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A dynamic decision image segmentation method based on the SAM basic model, characterized in that: The method comprises: Perform denoising and sharpening preprocessing on the acquired fundus images, use SAM to identify key areas and non-key areas in the processed fundus images, and use region growing to establish the boundaries and positions of the regions; Use fundus image data to establish a fundus feature extraction model to obtain features that distinguish key areas from non-key areas and assign different weights; After obtaining the key area features of the image, a task adaptation strategy is adopted. Multiple segmentation tasks share the key area features in the AI-Agent based on the task adaptation strategy, and the features are fine-tuned according to the requirements of different tasks to achieve the segmentation goals, including: The key area features are obtained from the fundus retinal image, and the key areas include retinal blood vessels, optic disc, and macula, and the feature representation mask of the key areas is obtained; the extracted key area feature mask is input into the AI-Agent, and for each segmentation task, including segmentation of blood vessels, optic disc or macula, relevant feature subsets are selected and extracted, so that the AI-Agent selects feature subsets related to different segmentation tasks according to the current task requirements, and obtains the AI-Agent based on the task adaptation strategy; through the recursive feature elimination of the support vector machine, according to the weights assigned to the features by the support vector machine, the features are recursively eliminated, and the features that contribute most to the classification are retained, so as to ensure that the extracted feature subsets are relevant and discriminative; the feature transformation adopted for each task is fine-tuned to ensure that the feature space matches the requirements of the encoder module of SAM, and the The encoder module requires that the feature dimension, feature type and distribution are consistent with the model compatibility. If the feature space distribution of a segmentation task does not match the requirements of the encoder module of SAM, linear mapping is used to adjust the feature subset; the fine-tuned feature subset is input into the encoder module of SAM corresponding to the AI-Agent based on the task adaptation strategy; according to the calculation method of each segmentation task, the adapted features are repeatedly input until a segmentation result with a segmentation accuracy higher than the preset accuracy is obtained. For segmentation tasks with segmentation accuracy lower than the preset accuracy, the features and SAM parameters are fine-tuned iteratively for multiple times; the feature fine-tuning process is evaluated and fed back based on the segmentation results. If the feedback segmentation results do not meet the requirements, analyze whether the problem lies in feature selection or feature transformation, and adjust the AI-Agent based on the task adaptation strategy accordingly; Monitor the performance of AI-Agent based on task adaptation strategy. When the agent's performance degrades while performing a task, an incremental update mechanism is implemented to adjust the feature extraction strategy of key areas, update the attention allocation model, and retrain to optimize the single-task performance, including: Set periodic evaluation points, use accuracy, recall and F1 score indicators to evaluate the performance of AI-Agent, monitor the output of the model in real time, and pay attention to the tasks that degrade the model performance; when the performance indicator is lower than the preset threshold, or has a drop of more than the preset percentage relative to the previous evaluation point, trigger the problem identification mechanism; analyze the tasks with degraded performance and determine the problem direction, including feature extraction problems and data distribution changes; obtain the features that contribute to the performance degradation of the current task, and determine whether it is necessary to introduce new features or eliminate useless features; if the problem direction is a feature extraction problem, introduce a new feature extraction method and use an updated eye Update the fundus feature extraction model, or adjust the parameters of the existing fundus feature extraction model; readjust the attention weights based on the results of the error analysis to make the model focus on the key areas; if the problem is a change in data distribution, adapt to the new data distribution through data enhancement or resampling, update the training and validation data sets, and add the latest data or data related to performance degradation; retrain the model based on the updated features and adjusted data sets, optimize the learning rate and regularization strength hyperparameters, and improve the performance and generalization ability of the model; verify the updated model performance on an independent test set, and continuously monitor the model performance to ensure that the improvement measures are effective and no new problems are introduced; According to the adjusted key area features, a key area feature library of fundus images is established. When a new fundus image is input into the system, the sample image in the matching feature library is retrieved, the key area position information with a matching degree higher than the preset similarity with the new image is extracted, and the attention area of ​​the AI-Agent is determined; After the AI-Agent determines the attention area, it performs the fundus image segmentation task based on the shared feature learning and task adaptation strategy, obtains the segmentation results, and updates the new features and results to the fundus image key area feature library; Add a hierarchical attention mechanism to AI-Agent, focusing on the main key areas for feature extraction and processing. After the analysis of the main key areas is completed, it turns to the secondary key areas. After processing the key areas, AI-Agent obtains and analyzes the segmentation results, focusing on segmentation quality and identification issues, and performs incremental learning based on the obtained result feedback; Based on user feedback, AI-Agent automatically adjusts the segmentation strategy and reports progress and results to users in real time.

2. The method according to claim 1, wherein: The method of performing denoising and sharpening preprocessing on the acquired fundus image, using SAM to identify key areas and non-key areas in the processed fundus image, and using region growing to establish the boundaries and positions of the regions, comprises: Pre-training is performed on the acquired fundus image dataset to learn common image features through self-supervised tasks, including predicting the pixel content of randomly occluded parts and performing pixel-level contrast learning; Based on pre-training, transfer learning is performed for the segmentation task, and the performance on the target segmentation task is improved by fine-tuning the model parameters; the model parameters are optimized, the network weights are updated through the back-propagation algorithm, and the model performance is iteratively optimized on the training data until the predetermined stop condition is reached to obtain the trained SAM; the acquired fundus image is input into the image encoder of the SAM model, mapped to the image feature space, and the adaptive mean filter is used for denoising to smooth the image and reduce speckle noise; The image contrast is enhanced by histogram equalization, and the image is sharpened with the Laplace algorithm to improve the clarity of details; the pre-processed fundus image is processed using SAM to identify and locate the key areas of the fundus, including the optic disc, blood vessels, and cups; SAM is used to further segment and identify the key areas including the optic disc, blood vessels, and cups, and the lesion sites are identified and subdivided by combining the color and texture features of the original image; for lesion areas where the boundaries are difficult to determine, the region growing algorithm is used, starting from the seed point, and gradually absorbing the surrounding similar pixels to determine the scope of the lesion area. SAM provides an accurate starting seed point for the region growing algorithm to enhance the segmentation accuracy; based on the segmentation results of SAM and the results of the region growing algorithm, the boundaries of the lesion area are adjusted and confirmed, and the accurate boundary information, area, and position of the lesion area are output.

3. The method according to claim 1, wherein: The fundus image data is used to establish a fundus feature extraction model, obtain features that distinguish key areas from non-key areas, and assign different weights, including: Obtain fundus image data segmented and annotated by SAM, including normal images and various fundus disease images, and annotate the data, marking key areas and lesion types. Non-key areas are areas outside the key areas in the image. Preprocess the image, including denoising and image enhancement, generate a fundus image dataset, and divide the dataset into a training set and a test set according to a preset ratio; use ResNet to build a fundus feature extraction model based on the training set of fundus image data; the prompts input to the fundus feature extraction model, including sparse prompts and dense prompts, are mapped to the prompt feature space through the prompttencoder in SAM, with the points, target boxes or descriptive texts input by the user as the sparse prompts, the segmentation mask of the target area to be segmented is used as dense prompts; The error back propagation algorithm and Adam are used to update the network parameters, so that the fundus feature extraction model learns and extracts the global features of the fundus image, and the extracted features are expressed in vector form. During the training process, the performance of the fundus feature extraction model on the test set is regularly verified to ensure that the fundus feature extraction model has generalization ability; the support vector machine is used to evaluate the features of each layer output in the fundus feature extraction model, and different weights are assigned to the features of the key area and the non-key area according to the contribution of the features to the identification of the key area and the non-key area; it also includes: assigning different weights to the features of the key area and the non-key area to strengthen the feature expression of the key area; The method allocates different weights to the features of the key area and the non-key area and strengthens the feature expression of the key area, specifically comprising: extracting a vector representation of the global features of the fundus image data through a fundus feature extraction model; adding an attention layer to the fundus feature extraction model, weighting the pixels in the image according to the marked key area, and obtaining a new representation of the weighted features of the key area, wherein the feature weights of the key area are enhanced; determining the weight of each feature in the key area and the non-key area according to a gradient boosting decision tree, adjusting the adjusted feature representation according to the weight, and obtaining a re-weighted feature; re-training the fundus feature extraction model using the re-weighted feature to ensure that the fundus feature extraction model pays attention to the key area during the re-training process, thereby improving the recognition accuracy of the key area; evaluating the re-trained fundus feature extraction model using a test set, obtaining the accuracy, recall rate and F1 value indicators, comprehensively evaluating the model, and adjusting the fundus feature extraction model parameters according to the evaluation results.

4. The method according to claim 1, wherein: After acquiring the key area features of the image, a task adaptation strategy is adopted, and multiple segmentation tasks in the AI-Agent based on the task adaptation strategy share the key area features, and the features are fine-tuned according to the requirements of different tasks to achieve the segmentation goal, including: using a mask decoder to integrate the outputs of the image encoder and the prompt encoder, and decoding the final segmentation mask from the feature map; The mask decoder is used to integrate the output of the image encoder and the prompt encoder to decode the final segmentation mask from the feature map, specifically including: constructing the component image encoder, prompt encoder, mask decoder, Image Encoder (IE), IE (I) receives the fundus image I and outputs the feature map F I , Prompt Encoder (PE), PE (S, D) receives sparse prompts S and dense prompts D, output feature prompts F S and F D ,Mask-Decoder(MD),MD(F I , F S , F D ) receives features from Image Encoder and Prompt Encoder, and decodes them to generate the final segmentation mask M; ImageEncoder processes the input fundus image I and generates a feature map F I ; At the same time, Prompt Encoder processes sparse promptsS and dense prompts D to generate feature prompts F S and F D , the feature hint F S and F D Input Mask Decoder; MaskDecoder integrates features and uses the decoding formula to generate the final segmentation mask M; let F I , F S , F D They are image features, sparse prompt features, and dense prompt features respectively; the decoding formula is in, Represents the feature fusion operation, which is a connection or weighted sum, W f and b f are the weights and biases of the Mask Decoder, * represents the convolution operation, and σ is the activation function, sigmoid, which is used to generate binary or multi-value segmentation masks.

5. The method according to claim 1, wherein: The method of establishing a fundus image key area feature library based on the adjusted key area features, retrieving a sample image in the matching feature library when a new fundus image is input into the system, extracting key area position information with a matching degree higher than a preset similarity with the new image, and determining the attention area of ​​the AI-Agent includes: Extract features from the existing fundus image data set, store the extracted features and their corresponding images and area information in a database, and obtain a fundus image key area feature library; when a new fundus image is input, extract features from the image, and retrieve the most similar image or feature in the fundus image key area feature library; The feature vector of the new image is f new , the feature vector of the sample image in the feature library is f sample , the similarity is calculated using cosine similarity, Where · represents the dot product, and ║f║ is the Euclidean norm of the vector; N images with similarity higher than the preset similarity are obtained from the feature library, and the position information of each image is P i And the similarity score with the new image is S i , attention area P att is the average score of the key area positions weighted by similarity; the attention area of ​​the AI-Agent is adjusted according to the average score, and the processing strategy of the AI-Agent is adjusted to prioritize the analysis of P att Scores above the preset average indicate areas.

6. The method according to claim 1, wherein: After the AI-Agent determines the attention area, it performs the fundus image segmentation task according to the shared feature learning and task adaptation strategy, obtains the segmentation result, and updates the new features and results to the fundus image key area feature library, including: The fundus feature extraction model is trained using annotated images from different segmentation tasks, including blood vessels, optic discs, and macula. The fundus feature extraction model learns common features between different tasks while retaining unique information useful for each task to establish a shared feature extraction model. A task-adaptive network layer is designed for each segmentation task, including a convolutional layer or a fully connected layer. The task-adaptive network layer receives the output of the shared feature extraction model and further processes the adaptation task. For each new segmentation task, the task-adaptive network layer is fine-tuned using the annotated data, while the parameters of the shared feature extraction model remain unchanged or are only fine-tuned to ensure that the shared feature extraction model is consistent with the original image. The model can quickly adapt to new tasks while maintaining the learned common features; by implementing the spatial attention mechanism in the shared feature extraction model, the attention area determined by the AI-Agent is integrated into the shared feature extraction model as additional input information, and the shared feature extraction model focuses on the features of the key areas and ignores other areas; for the newly input fundus image, the shared feature extractor and the adapted task-adaptive network layer are used to perform image segmentation to obtain accurate segmentation of the key areas; the Dice coefficient is used to evaluate the segmentation results of each task, and the task-adaptive network layer is further optimized based on the evaluation results, and the shared feature extractor is updated.

7. The method according to claim 1, wherein: The above mentioned AI-Agent adds a hierarchical attention mechanism to focus on the main key areas for feature extraction and processing. After the analysis of the main key areas is completed, it turns to the secondary key areas, including: Define the key area hierarchy in the fundus image, with the top layer focusing on the global structure of the entire retina, the middle layer focusing on the main key areas of retinal blood vessels, optic disc and macula, and the bottom layer focusing on detail features of blood vessel bifurcation points and tiny lesions; design an attention mechanism to integrate multi-scale features from AI-Agent, with the top layer attention based on overall features, while the bottom layer attention focuses on local features; at the top layer, AI-Agent uses its visual feature extraction capabilities to identify the overall retinal shape, size and edges, and locate the main key areas of retinal blood vessels, optic disc and macula; at the middle layer, the attention mechanism is refined to focus on the main key areas, including the direction of blood vessels and optic disc. The boundary of the neural disc connects the global view and the detailed features through the middle-level attention. At the bottom level, the AI-Agent focuses on the details, including the microscopic features of tiny blood vessels and small lesions. The information obtained from each level is comprehensively analyzed to ensure that the AI-Agent not only focuses on a single area, but also integrates the features of each level. According to the task requirements and real-time feedback during the processing, the resource allocation of each level of attention is dynamically adjusted. If the analysis of the main key area is completed, the AI-Agent reallocates resources to focus on the secondary key area. It also includes: after the AI-Agent completes the analysis of the main key area, it adjusts the focus of attention to the secondary key area. After the AI-Agent completes the analysis of the main key area, it adjusts its focus and turns to the secondary key area, specifically including: when the segmentation accuracy of the area reaches a preset threshold, the AI-Agent determines that the analysis of the main key area is completed; after the analysis of the main key area is completed, the AI-Agent evaluates the current resource usage, including computing resources, time and task priority; according to the resource evaluation results, the resources and attention are transferred to the secondary key area, reducing the resource allocation to the analyzed area and increasing the resource investment in the unanalyzed area; the AI-Agent identifies the secondary key area in the image, including the small branches of the blood vessels and tiny lesions, and performs a detailed analysis of the secondary key area; the AI-Agent continuously monitors the processing effect on all areas to ensure the quality and efficiency of the overall analysis, and based on continuous performance monitoring and feedback, iteratively improves and optimizes the attention mechanism and analysis strategy.

8. The method according to claim 1, wherein: After processing the key areas, the AI-Agent obtains and analyzes the segmentation results, focusing on segmentation quality and recognition issues, and performs incremental learning based on the obtained result feedback, including: After completing the segmentation of a preset number of fundus images, AI-Agent obtains all segmentation results, including the segmentation map of each area and the segmentation accuracy and recall rate; AI-Agent performs preliminary analysis, compares the segmentation results with the true labels and calculates the segmentation quality index, and identifies images with segmentation accuracy higher than the preset accuracy and images with problems; For images with segmentation accuracy lower than the preset accuracy, AI-Agent further analyzes to determine the nature of the problem, including mis-segmented areas, unrecognized key structures, and unclear segmentation boundaries; based on the analysis results, AI-Agent performs incremental learning, adjusts SAM model parameters, updates training data, and introduces new feature representations to adjust the SAM segmentation model and solve the identified problems; AI-Agent reapplies the results of incremental learning to the image segmentation task, and obtains and analyzes the results again, continuing the feedback loop to improve the segmentation quality; AI-Agent continuously monitors the segmentation performance, regularly evaluates the overall and individual area segmentation quality, and makes iterative improvements based on the results of performance monitoring.

9. The method according to claim 1, wherein: According to user feedback, AI-Agent automatically adjusts the segmentation strategy and reports progress and results to the user in real time, including: Design an interface that allows users to upload images and provide ratings for segmentation results through a form; The user uses the annotation tool to mark the problem area on the image and describes the feedback in the text box. The text box integrates the BERT-based dialogue system; the user enters feedback through the text box, BERT parses the user's natural language and interacts with the AI-Agent. At the same time, the AI-Agent processes the rating feedback given by the user through the support vector machine and automatically adjusts the segmentation parameters; for text feedback, BERT is used to parse the user's opinions and suggestions, and for graphic annotations, a convolutional neural network is used to recognize and understand the annotation content; according to user feedback, the AI-Agent strategy is adjusted, including changing the segmentation algorithm SAM parameters and selecting different preprocessing methods or adjusting the segmentation algorithm SAM; Matplotlib is used to display the completion status and estimated remaining time of the dynamically updated task as well as the segmentation results, and an interface is provided for users to confirm or request re-segmentation; the report generation tool Python's ReportLab library is integrated to automatically generate a report containing segmentation quality evaluation and improvement suggestions.