A WSI image continuous retrieval method based on distance consistency replay
By adopting a WSI image continuous retrieval method based on distance consistency replay, the catastrophic forgetting problem in pathological image retrieval is solved, achieving high efficiency, stability and accuracy in pathological image retrieval, and ensuring consistency between the return queues of old and new tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2024-08-28
- Publication Date
- 2026-05-19
AI Technical Summary
The existing CBHIR technology suffers from a catastrophic forgetting problem in pathological image retrieval, which leads to inconsistencies in the return queue of old tasks after learning new tasks, affecting the reliability of the system and its practical application.
A WSI image continuous retrieval method based on distance consistency replay is adopted. By continuously acquiring data streams, a local buffer is constructed using a reservoir random sampling algorithm and a WSI encoder. The encoder parameters are optimized by combining pairwise loss function, cross-entropy loss function and distance consistency loss function to ensure the consistency of the return queues of old and new tasks.
It effectively reduces the risk of catastrophic amnesia, improves the accuracy and stability of WSI image retrieval, ensures the consistency of old tasks returning to the queue after learning new tasks, and improves the efficiency and accuracy of pathological image retrieval.
Smart Images

Figure CN119106152B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital image processing, and more specifically to a WSI image persistent retrieval method based on distance consistency replay. Background Technology
[0002] With the rapid development of computational pathology and artificial intelligence, content-based histopathology image retrieval (CBHIR) technology has become an important tool in pathological diagnosis and research. CBHIR can return whole-slide images (WSI) from an established database that are similar in content to the queried pathological image.
[0003] However, while current CBHIR technology performs well on static databases, it suffers from catastrophic forgetting when learning new data, a phenomenon known in artificial intelligence systems as forgetting previously learned knowledge. Catastrophic forgetting manifests as inconsistencies in the return queues of old tasks before and after learning a new task. This is particularly serious for image retrieval systems in medical settings. These inconsistencies over time can severely compromise system reliability, inevitably limiting the practical application of CBHIR systems in incremental clinical data scenarios.
[0004] Currently, continuous learning has been proposed to mitigate the catastrophic forgetting that occurs during continuous learning in non-static data streams. It can be broadly categorized into three types: replay methods, regularization-based methods, and parameter isolation methods. However, research on continuous learning for retrieval tasks in natural scenes is scarce; most studies focus on tasks such as image classification and semantic segmentation. However, image retrieval is a more fine-grained task compared to classification, and directly applying continuous learning methods from classification tasks to retrieval tasks does not yield satisfactory results.
[0005] Furthermore, in the field of digital pathology, there exists a continuous learning method for classifying pathological images. This method establishes a buffer of image regions and replays the data using a "separation-reconstruction" approach, thus achieving data augmentation to some extent. However, this method cannot be applied to pathological image retrieval tasks, as segmenting pathological images into small tissue regions fails to obtain fine features at the whole-slice level.
[0006] Therefore, how to design a WSI image continuous retrieval method based on distance consistency replay, reduce the risk of catastrophic forgetting, and ensure the consistency of the return queue of old tasks before and after learning new tasks is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention provides a WSI image continuous retrieval method based on distance consistency replay, which processes pathological image datasets at multiple different times by continuously acquiring data streams, and utilizes the reservoir random sampling algorithm to effectively reduce the burden of high-dimensional data processing, thereby improving the accuracy, stability and efficiency of WSI image retrieval.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A WSI image persistent retrieval method based on distance consistency replay includes:
[0010] S1. Obtain the data stream E; where E = {E1, ..., E...} t}, Let x be the dataset at time t. i For a full slice image, y i N represents the category label for the whole slice image. t The number of label pairs in the full slice image;
[0011] S2. Extract features from the WSI image dataset at different time points to obtain feature block sets H at different time points; where H = {H1, ..., H2} t}, H t The feature block at time t;
[0012] S3. Combined with the WSI encoder, the feature blocks in the feature block set H at each time step are processed to obtain the full slice representation at all time steps, and the WSI encoder parameters are updated and the local buffer is constructed.
[0013] S4. Based on the full slice representation at all time points, construct an index structure and combine it with the WSI encoder with updated parameters to perform continuous WSI image retrieval.
[0014] Furthermore, in S3, the feature block at the initial time is processed, including:
[0015] Based on the feature block set H1, the batch size is set, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the initial time.
[0016] Among them, the data in batch b Input the full-slice encoder to obtain data. The full-slice characterization is represented as:
[0017]
[0018] In the formula, f1 is the full slice encoder at the initial time.
[0019] Further, local buffer construction includes:
[0020] Random sampling of the reservoir was performed on the feature block set H1 to obtain samples. And store it in the local buffer M2;
[0021] Sample Input the full-slice encoder to obtain samples Full-slice characterization:
[0022]
[0023] Based on samples Full-slice characterization, calculating samples The distance matrix D1 between each sample is stored in the local buffer M2;
[0024] Among them, the calculation sample The distance matrix D1 between each sample is:
[0025]
[0026] in, and Let be the i-th and j-th representations in C1, and d(·) be the Euclidean distance.
[0027] Further updates to the WSI encoder parameters include:
[0028] Calculate the composite loss function value:
[0029]
[0030] in, To represent the corresponding true category label, To represent the corresponding predicted category label, L p (·) is the pairwise loss function, L CE (·) represents the cross-entropy loss function;
[0031] The pairwise loss function:
[0032]
[0033] in, and They are respectively The m-th sample and the n-th sample in the sample, The true label is S, the total number of samples is d. h For the feature dimension, y mn Let y be the correlation between the m-th sample and the n-th sample. mn =1 indicates correlation, y mn=0 indicates no correlation.
[0034] Furthermore, in S3, the feature block at the intermediate time point is processed, including:
[0035] Based on the feature block set H e and local buffer M e The replay samples are used to set the batch size, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the intermediate time step.
[0036] Among them, the data in batch b Input the full-slice encoder to obtain data. The full-slice characterization is represented as:
[0037]
[0038] In the formula, f e Let e be the full slice encoder at time e, where e∈(1,t).
[0039] Further, local buffer construction includes:
[0040] For the feature block set H at time e e and local buffer M e The replay samples were randomly sampled from the reservoir to obtain samples. and
[0041] The sample and Merge to obtain samples And store it in the local buffer M e+1 ;
[0042] Sample Input the full-slice encoder to obtain samples Full-slice characterization:
[0043]
[0044] Based on samples Full-slice characterization, calculating samples The distance matrix D between each sample e And store it in the local buffer M e+1 ;
[0045] Among them, the calculation sample The distance matrix D between each sample e for:
[0046]
[0047] in, and C e The i-th and j-th representations are d(·) Euclidean distance.
[0048] Further updates to the WSI encoder parameters include:
[0049] Calculate the composite loss function value:
[0050]
[0051] Among them, L p (·) is the pairwise loss function, L CE (·) represents the cross-entropy loss function, L DC (·) is the distance consistency loss function, and α is the weighting factor;
[0052] The distance consistency loss function:
[0053]
[0054] Among them, D e-1 For local buffer M e The replay matrix.
[0055] Furthermore, in S3, the feature block at the final time step is processed, including:
[0056] Based on the feature block set H t and local buffer M t The replay samples are used to set the batch size, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the final time.
[0057] Among them, the data in batch b Input the full-slice encoder to obtain data. The full-slice characterization is represented as:
[0058]
[0059] In the formula, f t This is the full-slice encoder at the final moment.
[0060] Further updates to the WSI encoder parameters include:
[0061] Calculate the composite loss function value:
[0062]
[0063] Among them, L p (·) is the pairwise loss function, L CE(·) represents the cross-entropy loss function, L DC (·) is the distance consistency loss function, and α is the weighting factor;
[0064] The distance consistency loss function:
[0065]
[0066] Among them, D t-1 For local buffer M t The replay matrix.
[0067] Furthermore, S4 also includes:
[0068] Statistical indicators were constructed using Spearman's rank correlation coefficient (SRC) or Kendall's rank correlation coefficient (KRC) to evaluate the consistency of WSI image continuous retrieval.
[0069] Calculate the complete SRC or KRC value:
[0070]
[0071] in, To ensure average return queue consistency across all tasks, where n is the total number of tasks. For task g to have average return queue consistency after all subsequent tasks, p g,k This indicates the SRC or KRC value of the test set retrieval return queue of task g after task k has ended, compared with the value immediately after task g has ended.
[0072] As can be seen from the above technical solutions, compared with the prior art, the technical solutions of the present invention have the following advantages:
[0073] Beneficial effects:
[0074] 1. Process pathological image datasets from multiple different time points by continuously acquiring data streams.
[0075] It allows the system to dynamically adapt to the changing characteristics of data over time, maximizing learning efficiency and effectiveness at different stages by adjusting processing strategies.
[0076] 2. The encoder parameters are continuously updated at each time step, and the loss function is constructed differently at different time steps. This allows the model to continuously evolve to cope with new data patterns. The customized loss function ensures that the model can be optimized for specific tasks at each stage, thereby improving the overall accuracy and generalization ability.
[0077] 3. By replaying historical samples, the problem of "catastrophic forgetting" can be mitigated, meaning that the model does not forget the features of old data while learning new data, maintaining long-term memory. This ensures good performance and stability even when the data distribution changes. Attached Figure Description
[0078] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0079] Figure 1 A flowchart of the WSI image continuous retrieval method based on distance consistency replay provided in an embodiment of the present invention;
[0080] Figure 2 This diagram illustrates the specific steps of the WSI image continuous retrieval method based on distance consistency replay provided in this embodiment of the invention. Detailed Implementation
[0081] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0082] like Figure 1 As shown, this embodiment provides a WSI image persistent retrieval method based on distance consistency replay, including:
[0083] S1. Obtain the data stream E; where E = {E1, ..., E...} t}, Let x be the dataset at time t. i For a full slice image, y i N represents the category label for the whole slice image. t The number of label pairs in the full slice image;
[0084] S2. Extract features from the WSI image dataset at different time points to obtain feature block sets H at different time points; where H = {H1, ..., H2} t}, H t The feature block at time t;
[0085] S3. Combined with the WSI encoder, the feature blocks in the feature block set H at each time step are processed to obtain the full slice representation at all time steps, and the WSI encoder parameters are updated and the local buffer is constructed.
[0086] S4. Based on the full slice representation at all time points, construct an index structure and combine it with the WSI encoder with updated parameters to perform continuous WSI image retrieval.
[0087] This method enables continuous retrieval of pathological images, reduces the risk of catastrophic forgetting, ensures the consistency of the return queue of old tasks before and after learning new tasks, and further improves the efficiency and accuracy of pathological image retrieval.
[0088] like Figure 2 As shown, the following provides a further detailed explanation of each of the above steps and related features;
[0089] In this embodiment S1, new data from various sources are continuously acquired, such as pathological images from hospitals, laboratories, or research institutions. These images are preprocessed to form a data stream containing multiple moments.
[0090] Dataset E at each time step t The data stream contains all whole-slice images at that moment and their corresponding category labels, which may represent various disease types or other related pathological features. It reflects the latest developments and research trends in pathology, covering various types of lesions and pathogens, providing pathologists with comprehensive information support.
[0091] In this embodiment S2, multiple steps are involved, including image preprocessing, feature selection, feature quantization, feature fusion, and feature storage, with the aim of efficiently extracting key information from the image.
[0092] First, preprocessing operations such as scaling, denoising, and color correction are performed on the raw WSI image data at different times to improve the accuracy of feature extraction. Specifically, this includes: Scaling: Using methods such as bicubic interpolation to reduce large WSI images to a suitable size, reducing computational burden while maintaining sufficient resolution. Denoising: Using methods such as Gaussian filtering and median filtering to remove noise from the images, such as artifacts during scanning and mechanical errors of the scanner, improving the accuracy of feature extraction. Color Correction: Using techniques such as color equalization and white balance to correct color deviations caused by different scanning conditions, ensuring that all images are compared in the same color space.
[0093] Next, a pre-trained convolutional neural network (CNN) is used to automatically learn and extract key features from the image, such as texture, shape, and color. In this embodiment, different network layers are selected as feature extraction layers. If the focus is on low-level features, such as texture and edges, a shallower network layer can be selected; if the focus is on high-level features, such as object recognition, a deeper network layer can be selected.
[0094] Subsequently, the extracted features are transformed into numerical vectors. Features are then subjected to dimensionality reduction and normalization to reduce computational complexity and improve retrieval efficiency. Principal Component Analysis (PCA) and Linear Discriminant Analysis (LDA) are used for feature dimensionality reduction to compress the feature dimensions and reduce computational overhead. In normalization, the features are standardized to meet certain statistical assumptions, such as zero mean and unit variance.
[0095] Simultaneously, if there are feature extraction results at multiple levels, the features from different levels are fused to obtain a more comprehensive and accurate feature representation. Finally, the extracted features are saved to form a feature block set H for subsequent retrieval and comparison operations.
[0096] In this embodiment S3, the WSI encoder is combined to process the feature blocks in the feature block set H at each time step to obtain the full slice representation at all time steps, and the WSI encoder parameters are updated and the local buffer is constructed.
[0097] The following provides a more detailed explanation of S3 from the initial time, intermediate time, and final time, to clarify the differences and connections between the processing of feature blocks at different times in the technical solution of this embodiment;
[0098] The feature blocks at the initial time step are processed, including:
[0099] Based on the feature block set H1, the batch size is set, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the initial time.
[0100] Among them, the data in batch b Input the full-slice encoder to obtain data. The full-slice characterization is represented as:
[0101]
[0102] In the formula, f1 is the full slice encoder at the initial time.
[0103] Local buffer construction includes:
[0104] Random sampling of the reservoir was performed on the feature block set H1 to obtain samples. And store it in the local buffer M2;
[0105] Sample Input the full-slice encoder to obtain samples Full-slice characterization:
[0106]
[0107] Based on samples Full-slice characterization, calculating samples The distance matrix D1 between each sample is stored in the local buffer M2;
[0108] Among them, the calculation sample The distance matrix D1 between each sample is:
[0109]
[0110] in, and Let be the i-th and j-th representations in C1, and d(·) be the Euclidean distance.
[0111] WSI encoder parameter updates include:
[0112] Calculate the composite loss function value:
[0113]
[0114] in, To represent the corresponding true category label, To represent the corresponding predicted category label, L p (·) is the pairwise loss function, L CE (·) represents the cross-entropy loss function;
[0115] The pairwise loss function:
[0116]
[0117] in, and They are respectively The m-th sample and the n-th sample in the sample, The true label is S, the total number of samples is d. h For the feature dimension, y mn Let y be the correlation between the m-th sample and the n-th sample. mn =1 indicates correlation, y mn =0 indicates no correlation.
[0118] Processing the feature blocks at intermediate time points includes:
[0119] Based on the feature block set He and local buffer M e The replay samples are used to set the batch size, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the intermediate time step.
[0120] Among them, the data in batch b Input the full-slice encoder to obtain data. The full-slice characterization is represented as:
[0121]
[0122] In the formula, f e Let e be the full slice encoder at time e, where e∈(1,t).
[0123] Local buffer construction includes:
[0124] For the feature block set H at time e e and local buffer M e The replay samples were randomly sampled from the reservoir to obtain samples. and
[0125] The sample and Merge to obtain samples And store it in the local buffer M e+1 ;
[0126] Sample Input the full-slice encoder to obtain samples Full-slice characterization:
[0127]
[0128] Based on samples Full-slice characterization, calculating samples The distance matrix D between each sample e And store it in the local buffer M e+1 ;
[0129] Among them, the calculation sample The distance matrix D between each sample e for:
[0130]
[0131] in, and C e The i-th and j-th representations are d(·) Euclidean distance.
[0132] WSI encoder parameter updates include:
[0133] Calculate the composite loss function value:
[0134]
[0135] Among them, L p (·) is the pairwise loss function, L CE (·) represents the cross-entropy loss function, L DC (·) is the distance consistency loss function, and α is the weighting factor;
[0136] The distance consistency loss function:
[0137]
[0138] Among them, D e-1 For local buffer M e The replay matrix.
[0139] The feature blocks at the final time step are processed, including:
[0140] Based on the feature block set H t and local buffer M t The replay samples are used to set the batch size, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the final time.
[0141] Among them, the data in batch b Input the full-slice encoder to obtain data. The full-slice characterization is represented as:
[0142]
[0143] In the formula, f t This is the full-slice encoder at the final moment.
[0144] WSI encoder parameter updates include:
[0145] Calculate the composite loss function value:
[0146]
[0147] Among them, L p (·) is the pairwise loss function, L CE (·) represents the cross-entropy loss function, L DC (·) is the distance consistency loss function, and α is the weighting factor;
[0148] The distance consistency loss function:
[0149]
[0150] Among them, D t-1 For local buffer M t The replay matrix.
[0151] In the above steps, at the initial moment, samples are obtained through random sampling from the reservoir and stored in the local buffer. At the intermediate and final moments, in addition to random sampling from the reservoir, the replay samples in the feature block set and the local buffer are merged to obtain samples. This differentiated local buffer construction method allows for flexible adjustment of sample selection and combination according to the needs at different times, enhancing sample diversity and helping to improve retrieval performance.
[0152] Furthermore, the WSI encoder parameters are continuously updated at the initial, intermediate, and final moments to adapt to the task requirements at different times.
[0153] Especially in the initial stage, pairwise loss functions and cross-entropy loss functions are used to optimize the WSI encoder. In the intermediate and final stages, in addition to the above two loss functions, a distance consistency loss function is also introduced to further improve the performance of the WSI encoder. By comprehensively using pairwise loss functions, cross-entropy loss functions, and distance consistency loss functions, the parameters of the WSI encoder are continuously adjusted so that it can better cope with the task requirements at different times, thereby improving the robustness and generalization ability of the system.
[0154] In this embodiment S4, an index structure is constructed based on the full slice representation at all time points, and WSI image continuous retrieval is performed in conjunction with the WSI encoder with updated parameters.
[0155] Furthermore, to measure the consistency of the full-slice encoder in retrieving the return queue on old tasks after learning new tasks, a statistical metric is constructed using Spearman's rank correlation coefficient (SRC) or Kendall's rank correlation coefficient (KRC), with details as follows:
[0156] The Spearman Rank Correlation Coefficient (SRC) is a nonparametric statistical method based on ranking, used to measure the correlation between two variables. Its calculation formula is as follows:
[0157]
[0158] Where, d i Let represent the ranking difference of the i-th pair of data, and n be the number of samples. The value of SRC ranges between -1 and 1. The closer the value is to 1, the stronger the positive correlation between the two variables; the closer it is to -1, the stronger the negative correlation; and the closer it is to 0, the less correlation there is.
[0159] Kendall's Rank Correlation Coefficient (KRC) is a nonparametric statistical method based on ranking, used to measure the correlation between two variables. Its calculation formula is as follows:
[0160]
[0161] Where C is the number of consistent pairs, D is the number of inconsistent pairs, and n is the number of samples. The KRC value ranges between -1 and 1. The closer the value is to 1, the stronger the positive correlation between the two variables; the closer it is to -1, the stronger the negative correlation; and the closer it is to 0, the less correlation there is.
[0162] In practical applications, calculate the complete SRC or KRC value:
[0163]
[0164] in, To ensure average return queue consistency across all tasks, where n is the total number of tasks. For task g to have average return queue consistency after all subsequent tasks, p g,k This indicates the SRC or KRC value of the test set retrieval return queue of task g after task k has ended, compared with the value immediately after task g has ended.
[0165] Furthermore, this embodiment provides the results of comparing the technical solution of this application with other technical solutions based on metrics such as mean precision (mAP), K-recall, and K-precision.
[0166] Table 1 shows the results of comparing fully supervised training and fine-tuning training:
[0167] Table 1
[0168]
[0169] Tables 2-4 show the results compared to other continuous learning methods:
[0170] Table 2 shows the comparison results when the buffer contains 5 pathological images:
[0171] Table 2
[0172]
[0173] Table 3 shows the comparison results when the buffer contains 10 pathological images:
[0174] Table 3
[0175]
[0176]
[0177] Table 4 shows the comparison results when the buffer contains 15 pathological images:
[0178] Table 4
[0179]
[0180] This method enables continuous retrieval of pathological images. Table 1 compares the results of this method with those of fully supervised training and fine-tuning training, representing the upper and lower limits of the performance of the continuous learning method, respectively. The results show that this method has initially achieved continuous retrieval of pathological images.
[0181] Tables 2-4 compare our method with other types of continuous learning methods. The results show that our method achieves better continuous learning performance compared to other methods. In addition, the SRC and KRC metrics in the above tables measure the ability of different continuous learning methods to maintain the consistency of the past task queue, which shows that our method achieves better queue consistency.
[0182] Based on the above embodiments, the image continuous retrieval method in this application integrates technologies such as reservoir random sampling, full-slice encoding, and distributed computing to achieve effective management and retrieval of large-scale pathological image data streams. It utilizes a distance-consistent replay strategy to continuously incorporate new datasets while maintaining efficient maintenance of historical data memory, ensuring the stability and adaptability of the retrieval system.
[0183] In terms of specific operation, features are extracted from WSI images at different times and a reservoir random sampling strategy is adopted. Combined with full-slice encoding, high-order representations are generated. Then, a merging strategy is used to integrate the features of old and new data, forming a unified representation set. A distance matrix is further generated and stored, laying the foundation for building an efficient index structure. Ultimately, the system can continuously perform image retrieval, significantly improving retrieval efficiency and accuracy. It also successfully solves the knowledge forgetting problem in continuous learning, ensuring consistency between retrieval results and existing knowledge when new data is introduced, achieving a balance between stability and adaptability.
[0184] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0185] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A WSI image persistent retrieval method based on distance consistency replay, characterized in that, include: S1. Obtain data stream ;in, , for Data set at time 1, This is a full slice image. Category labels for the whole slice image. The number of label pairs in the full slice image; S2. Extract features from the WSI image dataset at different time points to obtain feature block sets H at different time points; where... , for Feature blocks at time t; S3. Combined with the WSI encoder, the feature block set is processed respectively. The feature blocks at each time step are processed to obtain the full slice representation at all time steps, and WSI encoder parameters are updated and local buffers are constructed. The processing of feature blocks at intermediate time steps includes: Based on feature block set and local buffer The replay samples are used to set the batch size, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the intermediate time step. Among them, the batch is Data Input the full-slice encoder to obtain data. The full-slice characterization is represented as: In the formula, for The full-slice encoder at the given time. ; Local buffer construction includes: right Feature block set at time 1 and local buffer The replay samples were randomly sampled from the reservoir to obtain samples. and ; The sample and Merge to obtain samples And store it in the local buffer. ; Sample Input the full-slice encoder to obtain samples Full-slice characterization: Based on samples Full-slice characterization, calculating samples Distance matrix between each sample And store to local buffer ; Among them, the calculation sample Distance matrix between each sample for: in, and They are respectively The Middle The and the first One characteristic, Euclidean distance; S4. Based on the full slice representation at all time points, construct an index structure and combine it with the WSI encoder with updated parameters to perform continuous WSI image retrieval.
2. The WSI image persistent retrieval method based on distance consistency replay according to claim 1, characterized in that, In step S3, the feature block at the initial time is processed, including: Based on feature block set Set the batch size and input the data of each batch into the full slice encoder to obtain the full slice representation at the initial time. Among them, the batch is Data Input the full-slice encoder to obtain data. The full-slice characterization is represented as: In the formula, This is the full-slice encoder at the initial time step.
3. The WSI image persistent retrieval method based on distance consistency replay according to claim 2, characterized in that, Local buffer construction includes: For the set of feature blocks Random sampling was conducted in the reservoir to obtain samples. And store to local buffer ; Sample Input the full-slice encoder to obtain samples Full-slice characterization: Based on samples Full-slice characterization, calculating samples Distance matrix between each sample And store to local buffer ; Among them, the calculation sample Distance matrix between each sample for: in, and They are respectively The Middle The and the first One characteristic, Euclidean distance.
4. The WSI image persistent retrieval method based on distance consistency replay according to claim 2, characterized in that, WSI encoder parameter updates include: Calculate the composite loss function value: in, To represent the corresponding true category label, To characterize the corresponding predicted category label, Pairwise loss function Cross-entropy loss function; The pairwise loss function: in, and They are respectively The first in The first sample and the first One sample, For real labels, The total number of samples, For feature dimension, For the first The first sample and the first The correlation of individual samples Indicates relevance. Indicates that it is irrelevant.
5. The WSI image persistent retrieval method based on distance consistency replay according to claim 1, characterized in that, WSI encoder parameter updates include: Calculate the composite loss function value: in, For pairwise loss functions, Let cross-entropy be the loss function. It is the distance consistency loss function. It is a weighting factor; The distance consistency loss function: in, For local buffer The replay matrix.
6. The WSI image persistent retrieval method based on distance consistency replay according to claim 1, characterized in that, In step S3, the feature block at the final time step is processed, including: Based on feature block set and local buffer The replay samples are used to set the batch size, and the data of each batch is input into the full slice encoder to obtain the full slice representation at the final time. Among them, the batch is Data Input the full-slice encoder to obtain data. The full-slice characterization is represented as: In the formula, This is the full-slice encoder at the final moment.
7. A continuous retrieval of pathological images based on distance consistency replay according to claim 6. The method, characterized in that, WSI encoder parameter updates include: Calculate the composite loss function value: in, For pairwise loss functions, Let cross-entropy be the loss function. It is the distance consistency loss function. It is a weighting factor; The distance consistency loss function: in, For local buffer The replay matrix.
8. The WSI image persistent retrieval method based on distance consistency replay according to claim 1, characterized in that, S4 also includes: Statistical indicators were constructed using Spearman's rank correlation coefficient (SRC) or Kendall's rank correlation coefficient (KRC) to evaluate the consistency of WSI image continuous retrieval. Calculate the complete SRC or KRC value: in, For average return queue consistency across all tasks, The total number of tasks. For the task Average return queue consistency after all subsequent tasks, p g,k express After the mission is completed, the mission The test set retrieval return queue and task The SRC or KRC values compared immediately after the end.