A few-shot pathological image out-of-distribution detection method based on a base model

CN122492707BActive Publication Date: 2026-08-28QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202610978286.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-02
Publication Date
2026-08-28
Estimated Expiration
2046-07-02

AI Technical Summary

Technical Problem

[0005]本发明旨在克服上述现有技术的至少一种缺陷,提供一种基于基础模型的少样本病理图像分布外检测方法,在病理图像标注数据极度稀缺的实际场景下,利用现有的病理基础模型(如CONCH),提升分布外时,解决现有方法要么依赖大量标注数据,要么直接用原始少样本特征做检测,导致决策边界模糊、对OOD样本判别不准,难以满足临床对AI系统可靠性要求的问题

Benefits of technology

本发明提供的一种基于基础模型的少样本病理图像分布外检测方法,通过构建虚拟ID特征集以扩充分布内表征,并创新性地设计边界感知的虚拟OOD特征合成与优化机制以显式建模决策边界,再结合多源信息融合的评分策略,解决了在少样本病理图像分析中因数据分布偏移导致的分布外(OOD)检测性能不稳定、可靠性差,以及现有方法难以有效利用基础模型先验知识等问题,为临床部署安全、可信的AI辅助诊断系统提供了一种高效、实用的技术方案。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492707B_ABST
    Figure CN122492707B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of out-of-distribution detection, and more particularly relates to a few-shot pathological image out-of-distribution detection method based on a base model. The method comprises: acquiring a data set covering different types of distribution offset scenarios; acquiring corresponding candidate virtual ID features and performing feature screening to form a virtual ID feature set; boundary-aware virtual OOD feature synthesis; and scoring a test image to be detected based on the distance from the query feature to the original ID feature set, the distance from the query feature to the virtual ID feature set and the distance from the query feature to the virtual OOD feature set. The present application solves the problems of unstable out-of-distribution detection performance, poor reliability caused by data distribution offset in few-shot pathological image analysis, and the difficulty of effectively utilizing the prior knowledge of the base model by the existing method.
Need to check novelty before this filing date? Find Prior Art

Claims

1. A method for detecting out-of-distribution patterns in few-sample pathological images based on a basic model, characterized in that, The method includes: S1. Obtain publicly available pathological image data of different types of distribution offset scenes to form the original dataset, and divide it into the original training set and the original test set; S2. Generate enhanced views from the original samples in the original training set using a strong augmentation strategy. Then, input them into the visual base model to extract high-dimensional feature vectors and perform L2 normalization. After obtaining the corresponding candidate virtual ID features, perform feature filtering to form a virtual ID feature set. S3. Input the original samples from the original training set into the visual base model and perform L2 normalization to obtain the original ID feature set; calculate the k nearest neighbor distance of each feature in the original ID feature set to the original ID feature set, and select the Top-K features with the largest distance values ​​as the boundary sample set. For each boundary sample, an isotropic Gaussian perturbation is applied in its local neighborhood to generate multiple virtual OOD candidate features. The virtual OOD candidate features are iteratively optimized using the gradient descent method to obtain the optimized virtual OOD features, which constitute the virtual OOD feature set. S4. Based on the original test set, input the test image to be detected into the visual base model, extract its original feature vector, and perform L2 normalization to obtain the normalized query features. Then, the test image to be detected is scored based on the distance from the query features to the original ID feature set, the distance to the virtual ID feature set, and the distance to the virtual OOD feature set; S3 specifically includes: S31. For the original ID feature set Each feature in Calculate its to k-nearest neighbor distance Defined as: (5) In formula (5), Indicates in Zhongyu Recent Of the neighbors, the one furthest away is... The Euclidean distance; S32, Select all The top-K features with the largest values ​​are used as the boundary sample set. ; Secondly, for each boundary sample An isotropic Gaussian perturbation is applied within its local neighborhood to generate virtual OOD candidate features: For the boundary samples ,generate The candidate features, of which the first one is the 1st candidate feature. Virtual OOD candidate features ,in =1, 2, ..., : (6) In formula (6), To control the hyperparameters of the disturbance amplitude, This is a noise vector sampled from a standard normal distribution. for The identity matrix, and all generated virtual OOD candidate features constitute the initial set. ; S33, Introducing Diversity Loss Minimize the feature matrix composed of the virtual OOD candidate features. Average similarity of diagonal elements between China and Africa: (7) In formula (7), Its similarity matrix, elements Corresponding to the The and the first A virtual Cosine similarity of features; S34. Introducing Contrast Loss This loss ensures that the generated virtual OOD features can be accurately located near the decision boundary of the ID data. It forces the similarity between any virtual OOD feature and any ID feature to fall within a preset target range. Inside, among which An adjustable lower bound is defined, and the contrast loss is defined in the form of hinge loss: (8) In formula (8), For the number of categories, The number of training samples for each class, The number of virtual OOD features, and the loss term. Defined as: (9) In formula (9): (10) The ID feature matrix With virtual OOD feature matrix The similarity matrix between them; in this matrix, Representing the The ID feature and the first Cosine similarity between virtual OOD features For ID features, Transpose the virtual OOD feature; Constructing a set of virtual OOD features Optimization objective function It consists of diversity loss and contrast loss: (11) Virtual OOD feature set is analyzed using gradient descent method. Perform iterative optimization to minimize .

2. The method for detecting out-of-distribution patterns in few-sample pathological images based on a basic model according to claim 1, characterized in that, S2 specifically includes: S21, Original Training Set Includes a small sample of pathological images in C known categories, where each category contains K labeled samples. ; Original sample The input is fed into the pre-trained visual base model VFM and processed through the built-in feature extraction function. Forward propagation is performed to extract high-dimensional feature vectors, and L2 normalization is then applied to obtain the normalized original features. This is used to construct a normalized original ID feature set. ; Then, based on the original ID feature set Calculate each category The characteristic prototype, i.e., the characteristic centroid ; S22, Regarding the original training set Each original sample in Apply a stochastic enhancement strategy consisting of random combinations of various basic image transformations. ,generate Enhanced view ; The generated enhanced view will then be Input to the visual base model Then, L2 normalization is performed to obtain the corresponding candidate virtual ID features. ; S23. Regarding the candidate virtual ID features Implement a dual filtering mechanism: One method is prototype similarity filtering, which calculates the features of candidate virtual IDs. Its class prototype The cosine similarity, or inner product, is only valid if a threshold condition is met: (1) Only items that meet the requirements will be retained; items that do not meet the requirements will be removed. S24. The second method is density filtering within the distribution. First, the input features to be judged are defined as: candidate virtual ID features generated by a strong data augmentation strategy and filtered by prototype similarity. Calculate input features Compared to the original ID feature set of Nearest neighbor distance for: (2) In formula (2), Representation of feature set Mid-range features Recent A set of eigenvectors Represents the L2 norm; Then select The distance value of the first Percentile as density threshold ; Finally, for the candidate virtual ID features that have passed the prototype similarity filtering... It will only be retained if it meets the following density determination criteria: (3) In summary, through the collaborative screening of the above dual filtering mechanisms, a virtual ID feature set is finally constructed. Its definition is as follows: (4)。 3. The method for detecting out-of-distribution patterns in few-sample pathological images based on a basic model according to claim 2, characterized in that, Specifically, S4 is: Test image to be detected The input is fed into the visual base model to extract its original feature vector. Then, L2 normalization is performed to obtain normalized query features. Then, calculate its k-nearest neighbor distances to the following three reference feature sets: Distance 1: Distance to the original ID feature set: (12) Distance 2: Distance to the virtual ID feature set: (13) Distance 3: Distance to the virtual OOD feature set: (14) Based on the three distances mentioned above, the final OOD score is defined as follows: (15) Set a rating threshold If the query sample is in the feature space when ≤ When the sample to be tested tends to be within the distribution, it is determined to belong to the normal pathological category; when > When the sample to be tested tends to be outside the distribution, it is determined to be an abnormal sample.

4. The method for detecting out-of-distribution patterns in few-sample pathological images based on a basic model according to claim 2, characterized in that, The basic image transformations include random grayscale conversion, color jitter, and horizontal flipping.

Citation Information

Patent Citations

  • Robust distribution external detection method based on adversarial virtual outliers

    CN120744746A

  • Out-of-distribution detection method based on virtual logarithm

    CN116776248A

  • Dynamic graph distribution external detection method and system based on spectrum sensing enhanced evidence learning

    CN121166773A