An unsupervised medical image anomaly detection method based on local linear embedding
Patent Information
- Application Number
- CN202410321581.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-20
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2044-03-20
AI Technical Summary
[0005]针对现有技术中的上述不足,本发明提供的一种基于局部线性嵌入的无监督医学图像异常检测方法解决了现有医学图像异常检测的高维数据特征的快速提取问题,并能够避免样本类别不平衡造成的模型预测偏差,快速、有效地实现医学图像的无监督异常检测
[0045] The beneficial effects of the above-mentioned further scheme are: by combining reverse inaccessibility and local outlier factor to calculate the outlier degree of the sample, the accuracy of outlier screening under imbalanced sample conditions is improved.
Smart Images

Figure CN118212201B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical image analysis, and in particular relates to an unsupervised method for detecting anomalies in medical images based on local linear embedding. Background Technology
[0002] Medical image analysis plays a crucial role in medical diagnosis, assisting doctors in quickly and accurately identifying diseases and playing an indispensable role in the early diagnosis and treatment of many illnesses. Especially in the area of medical image anomaly detection, it has significant research value and practical application value in promoting the development of smarter, more reliable, and more efficient medical services. Currently, machine learning-based methods have made considerable progress and are widely used in the field of medical image analysis.
[0003] Convolutional Neural Networks (CNNs) in deep learning are a typical method that automatically learns and recognizes patterns and features in images, thereby enabling disease identification and classification. This method has demonstrated powerful capabilities when processing complex image data. Another common method is Support Vector Machines (SVMs), a traditional machine learning approach. SVMs require manually selected features, which are then used to train the model. In specific application scenarios, they can achieve good performance.
[0004] However, despite the increasing application of machine learning techniques in medical image analysis, existing technologies still have some shortcomings and limitations. For example, traditional medical image analysis methods rely on large amounts of manually labeled data, which is not only time-consuming and labor-intensive, but also often fails to quickly extract intrinsic and valuable features when processing high-dimensional image data. Furthermore, due to class imbalance, model predictions tend to favor the more numerous classes, which affects the detection accuracy of rare diseases. This bias is particularly detrimental to the diagnosis of rare diseases, as they typically constitute only a small proportion of the dataset, while the model needs to have a high degree of sensitivity and accurate identification ability for these few disease categories. Summary of the Invention
[0005] To address the aforementioned shortcomings in existing technologies, this invention provides an unsupervised medical image anomaly detection method based on local linear embedding. This method solves the problem of rapid extraction of high-dimensional data features in existing medical image anomaly detection methods and avoids model prediction bias caused by sample class imbalance, thereby enabling rapid and effective unsupervised anomaly detection of medical images.
[0006] To achieve the aforementioned objectives, the present invention employs the following technical solution: an unsupervised medical image anomaly detection method based on local linear embedding, comprising the following steps:
[0007] S1. Calculate the representation matrix based on the normalized medical image data;
[0008] S2. Based on the representation matrix, calculate the neighborhood and neighborhood distance of all samples;
[0009] S3. Calculate the reachability distance and local reachability density based on the neighborhood distance;
[0010] S4. Based on the representation matrix, calculate the reverse unreachability of all samples;
[0011] S5. Calculate the local outlier factor as the outlier degree for all samples based on local reachability density and reverse unreachability.
[0012] S6. Determine whether the outlier of each sample in the normalized data is greater than the threshold. If so, output the abnormal medical image and repeat step S6 until all samples are judged. Otherwise, treat it as normal data and proceed to the next sample until all samples are judged.
[0013] The beneficial effects of this invention are as follows: by constructing a representation matrix through local linear embedding, the problem of rapid extraction of features from high-dimensional data is solved; by combining the method of reverse inaccessibility and local outlier factor to calculate the outlier degree of the sample, the problem of inaccurate anomaly detection caused by sample imbalance is avoided; this invention does not require labeled data for model training, and can effectively realize unsupervised anomaly detection of medical images.
[0014] Further, step S1 specifically includes:
[0015] S11. Scale all images to w×h pixels, then merge the RGB values of each pixel in the scaled images into a one-dimensional array as a sample. Perform the same operation on n images, resulting in an n-row, w×h×3-column matrix. Use the min-max method to normalize the data, adjusting the range of all values to the real number interval of 0 to 1. The expression is:
[0016]
[0017] Where f(·) represents the normalization process; Let x be the value of a sample x in the image data on attribute m; Mm is the set of all samples in the image data on attribute m; x is a sample in the medical image; min is the minimum value function; max is the maximum value function.
[0018] S12. Based on the normalized data, find each sample x. i k nearest neighbors;
[0019] S13. Based on the k nearest neighbor pairs xi Perform linear reconstruction and calculate the nearest neighbor sample x. j Reconstruction weights W ij W ij This is obtained by minimizing the following reconstruction error:
[0020]
[0021] Where, x i Represents the sample data of the i-th image; min is the minimum value function; W ij Indicates sample x j Reconstruct sample point x i Weighting of time.
[0022] S14. The weights W for linear reconstruction calculated based on each sample. ij We obtain the representation matrix W.
[0023] The beneficial effect of the above-mentioned further scheme is that it can quickly extract the relationship features between high-dimensional image data by constructing a representation matrix.
[0024] Further, step S2 specifically includes:
[0025] S21. Based on the representation matrix obtained in step S1, calculate all sample x. i The set of neighbors is expressed as:
[0026]
[0027] Where, x i This represents the sample data of the i-th image; Indicates sample x i The set of neighbors; W ij Indicates sample x j Reconstruct sample x i Weighting of time.
[0028] S22, Based on sample x i The collection of neighbors Calculate x i The neighborhood distance is expressed as:
[0029]
[0030] Where, x i For the i-th image sample data; n-distance(x i ) is the sample x i The neighborhood distance; max is the maximum value function; For sample x i The set of neighbors of x; j For sample x iThe neighbor; d(x) i x j ) is the sample x i With sample x j The distance between them.
[0031] Further, step S3 specifically includes:
[0032] S31. Further calculate the reachability distance using the neighborhood distance, as shown in the following expression:
[0033] reach-dist(x i x j )=max{n-distance(x j ), d(x i x j )}
[0034] Where, x i and x j These are the sample data for the i-th and j-th images, respectively; reach-dist(x i x j ) is the sample x i To sample x j The reachable distance; max is the maximum value function; n-distance(x) i ) is the sample x i The neighborhood distance; d(x) i x j ) is the sample x i With sample x j The distance between them.
[0035] S32. Calculate the local reachability density based on the reachability distance, as shown in the following expression:
[0036]
[0037] Where, x i Let lrd(x) be the sample data for the i-th image. i ) is the sample x i Locally accessible density; x j For sample x i The neighbors; For sample x i The set of neighbors; reach-dist(x) i x j ) is the sample x i To sample x j The reachability distance; |□| is the number of samples in the set.
[0038] Furthermore, the expression for reverse unreachability in step S4 is:
[0039]
[0040] Where, x i This is the sample data for the i-th image; For sample x i Reverse unreachability; To convert the real number W ji A function to convert to integers; W ji To represent sample x i Reconstruct sample x j The weight at time is the weight of the j-th row and i-th column of matrix W; where is the condition that the following conditions are met.
[0041] The beneficial effect of the above-mentioned further scheme is that it can characterize the outlier characteristics of data by using reverse unreachability as a screening factor for outliers, thereby improving the accuracy of outlier screening.
[0042] Furthermore, the expression for outlier degree in step S5 is:
[0043]
[0044] Among them, LLEOF(x i ) is the outlier calculation function; x i and x j These are the sample data for the i-th and j-th images, respectively; For sample x i The set of neighbors; lrd(x) i ) is the sample x i Locally achievable density; For sample x i Reverse unreachability; For sample x i The set of neighbors; n is the total number of image samples.
[0045] The beneficial effects of the above-mentioned further scheme are: by combining reverse inaccessibility and local outlier factor to calculate the outlier degree of the sample, the accuracy of outlier screening under imbalanced sample conditions is improved. Attached Figure Description
[0046] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0047] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0048] like Figure 1 As shown, in one embodiment of the present invention, an unsupervised medical image anomaly detection method based on local linear embedding includes the following steps:
[0049] S1. Calculate the representation matrix based on the normalized medical image data;
[0050] S2. Based on the representation matrix, calculate the neighborhood and neighborhood distance of all samples;
[0051] S3. Calculate the reachability distance and local reachability density based on the neighborhood distance;
[0052] S4. Based on the representation matrix, calculate the reverse unreachability of all samples;
[0053] S5. Calculate the local outlier factor as the outlier degree for all samples based on local reachability density and reverse unreachability.
[0054] S6. Determine whether the outlier of each sample in the normalized data is greater than the threshold. If so, output the abnormal medical image and repeat step S6 until all samples are judged. Otherwise, treat it as normal data and proceed to the next sample until all samples are judged.
[0055] Step S1 specifically involves:
[0056] S11. Scale all images to w×h pixels, then merge the RGB values of each pixel in the scaled images into a one-dimensional array as a sample. Perform the same operation on n images, resulting in an n-row, w×h×3-column matrix. Use the min-max method to normalize the data, adjusting the range of all values to the real number interval of 0 to 1. The expression is:
[0057]
[0058] Where f(·) represents the normalization process; M represents the value of a sample x in the image data on attribute m; m Let be the set of values of all samples in the image data on attribute m; x be the samples in the medical image; min is the minimum value function; max is the maximum value function.
[0059] In this embodiment, a data table comprising 6 samples and 3 attributes is provided, assumed to be a matrix obtained by digitizing 6 images, as shown on the left side of Table 1 (the right side shows the result after normalization). The min-max normalization operation adjusts the data value range to the real number interval of 0 to 1, eliminating the influence of differences in units and orders of magnitude on the analysis results. The processing results are shown on the right side of Table 1.
[0060] Table 1. Original data and normalization results
[0061]
[0062]
[0063] S12. Based on the normalized data, find each sample x. i k nearest neighbors;
[0064] In this embodiment, this step is performed on each sample x. i Finding its k nearest neighbors is achieved by calculating the Euclidean distance and selecting the k nearest samples.
[0065] S13. Based on the k nearest neighbor pairs x i Perform linear reconstruction and calculate the nearest neighbor sample x. j Reconstruction weights W ij W ij This is obtained by minimizing the following reconstruction error:
[0066]
[0067] Where, x i Represents the sample data of the i-th image; min is the minimum value function; W ij Indicates sample x j Reconstruct sample point x i Weighting of time.
[0068] In this embodiment, local linear embedding is the core of calculating the representation matrix. This step uses the above formula for each sample x. i To calculate a reconstruction weight W using its nearest neighbors. ij , making x i It can be linearly reconstructed by its nearest neighbors.
[0069] S14. The weights W for linear reconstruction calculated based on each sample. ij We obtain the representation matrix W.
[0070] In this embodiment, the weights W of n×n linear reconstructions can be calculated through the above steps. ijThey form an n×n representation matrix W, where W ij That is, the i-th row and j-th column of matrix W represents the sample x. j Reconstruct sample x i The weight.
[0071] Let the nearest neighbor parameter be k = 3, and the following representation matrix is obtained:
[0072]
[0073] Step S2 specifically involves:
[0074] S21. Based on the representation matrix obtained in step S1, calculate all sample x. i The set of neighbors is expressed as:
[0075]
[0076] Where, x i This represents the sample data of the i-th image; Indicates sample x i The set of neighbors; W ij Indicates sample x j Reconstruct sample x i Weighting of time.
[0077] In this embodiment, the representation matrix W obtained in step S1 can reveal the data structure between samples. ij If x > 0, then x is considered to be... j It is x i The neighbor, conversely, when W ij If x ≤ 0, then x is considered to be j Not x i The neighbors of sample x. Based on this, we can calculate the sample x. i The neighbor set, using express.
[0078] Based on the representation matrix generated in step S1, calculate x for each sample. i The set of all neighbors within the neighborhood If we use "1" to represent a neighbor and "0" to represent a non-neighbor, then the neighbors of each sample can be determined as shown in the table below:
[0079]
[0080] S22, Based on sample x i The collection of neighbors Calculate x i The neighborhood distance is expressed as:
[0081]
[0082] Where, x i For the i-th image sample data; n-distance(x i ) is the sample x i The neighborhood distance; max is the maximum value function; For sample x i The set of neighbors of x; j For sample x i The neighbor; d(x) i x j ) is the sample x i With sample x j The distance between them.
[0083] In this embodiment, sample x i Centered on sample x i The smallest circle enclosed by all its neighbors is x. i The neighborhood of the circle is the radius of the sample x. i The neighborhood distance. The neighborhood distance can be directly calculated by measuring the distance of sample x. i The distance to the farthest neighbor is obtained and denoted as n-distance(x). i ).
[0084] After determining the neighbor relationships, the neighborhood distance for each sample can be calculated as follows:
[0085] <![CDATA[n-distance(x i )]]> 0.8570 0.5905 1.1715 1.1715 0.8120 0.8570
[0086] Step S3 specifically involves:
[0087] S31. Further calculate the reachability distance using the neighborhood distance, as shown in the following expression:
[0088] reach-dist(x i x j )=max{n-distance(x j ), d(x i x j )}
[0089] Where, x i and x j These are the sample data for the i-th and j-th images, respectively; reach-dist(x i x j ) is the sample x i To sample x j The reachable distance; max is the maximum value function; n-distance(x) i ) is the sample x i The neighborhood distance; d(x) i xj ) is the sample x i With sample x j The distance between them.
[0090] In this embodiment, the reachability distance between each sample and its neighbors is further calculated using neighborhood distance. i To sample x j The reachability distance is defined as the distance to sample x. j neighborhood distance and sample x i To sample x j The maximum actual distance is denoted as reach-dist(x). i x j ).
[0091] The reachability distance between each sample and its neighbors can be calculated. For example, reach-dist(x1, x3) = max(1.1715, 0.5905) = 1.1715. All the calculation results are as follows:
[0092] reach-dist(x1,x3)=1.1715 reach-dist(x1,x6)=0.8570
[0093] reach-dist(x2,x4)=1.1715 reach-dist(x2,x5)=0.8120
[0094] reach-dist(x3,x1)=0.8570 reach-dist(x3,x4)=1.1715
[0095] reach-dist(x4,x2)=0.5905 reach-dist(x4,x3)=1.1715
[0096] reach-dist(x5,x2)=0.5905 reach-dist(x5,x6)=0.8570
[0097] reach-dist(x6,x1)=0,8570 reach-dist(x6,x5)=0.8120
[0098] S32. Calculate the local reachability density based on the reachability distance, as shown in the following expression:
[0099]
[0100] Where, x i Let lrd(x) be the sample data for the i-th image. i ) is the sample x i Locally accessible density; xj For sample x i The neighbors; For sample x i The set of neighbors; reach-dist(x) i x j ) is the sample x i To sample x j The reachability distance; |□| is the number of samples in the set.
[0101] In this embodiment, the local reachability density of each sample is calculated based on the reachability distance. For sample x i Locally achievable density lrd(x) i ) is the reciprocal of the average distance of all samples in its neighborhood.
[0102] The calculated local reach density for each sample is shown in the table below:
[0103] <![CDATA[lrd(x i )]]> 0.9860 1.0083 0.9860 1.1351 1.3817 1.1983
[0104] The expression for reverse unreachability in step S4 is:
[0105]
[0106] Where, x i This is the sample data for the i-th image; For sample x i Reverse unreachability; To convert the real number W ji A function to convert to integers; W ji To represent sample x i Reconstruct sample x j The weight at time is the weight of the j-th row and i-th column of matrix W; where is the condition that the following conditions are met.
[0107] In this embodiment, W is utilized in step S3. ij For samples where the value is greater than 0, the neighborhood of the sample is calculated, while W... ij The portion ≤0 can also reveal relationships between samples. If sample x i For many samples that are not neighbors, then x i This is very likely an outlier. Here, we need to calculate the reverse unreachability of each sample as a factor for the final outlier score.
[0108] The reverse unreachability of each sample can be calculated, and the specific results are as follows:
[0109]
[0110] The expression for outlier degree in step S5 is:
[0111]
[0112] Among them, LLEOF(x i ) is the outlier calculation function; x i and x j These are the sample data for the i-th and j-th images, respectively; For sample x i The set of neighbors; lrd(x) i ) is the sample x i Locally achievable density; For sample x i Reverse unreachability; For sample x i The set of neighbors; n is the total number of image samples.
[0113] In this embodiment, the sample outlier score is used to measure the probability that a sample is an outlier. The core of this step is to compare the density of a sample with the density of its neighbors. If its density is significantly lower than that of its neighbors, then this sample is very likely an outlier. The inclusion of reverse unreachability is to provide more global information and improve the accuracy of the outlier score.
[0114] The outlier rate of the entire sample can be calculated by combining the results from the previous steps. Example: Similarly, we can conclude that:
[0115] <![CDATA[LLEOF(x i )]]> 0.7385 0.8320 0.7171 0.5856 0.5323 0.6586
[0116] Step S6 specifically involves:
[0117] Anomaly detection is performed using threshold comparison. In this embodiment, the outlier threshold for anomalies is set to θ. If sample x... i Outlier LLEOF(x) i If x > θ, then x i These are identified as outliers. The outliers in the system can be calculated by comparing the outlier of each sample with a threshold θ.
[0118] Comparing the outliers of all objects, it is clear that the outlier of sample x2 is significantly higher than that of other samples. If the outlier threshold θ is set to 0.8, and the outliers of all samples are compared with the threshold θ, then sample x2 is determined to be an anomalous image.
Claims
1. An unsupervised medical image anomaly detection method based on local linear embedding, characterized in that, Includes the following steps: S1. Calculate the representation matrix based on the normalized medical image data; S2. Based on the representation matrix, calculate the neighborhood and neighborhood distance of all samples; S3. Calculate the reachability distance and local reachability density based on the neighborhood distance; S4. Based on the representation matrix, calculate the reverse unreachability of all samples. The expression for the reverse unreachability is: wherein, is the th image sample data; is the inverse inaccessibility of a sample is a function that converts real numbers to integers; is a weight when reconstructing a sample , i.e. the th row, the th column of the matrix is the case where the following conditions are met; S5. Based on local reachability density and reverse unreachability, calculate the local outlier factor of all samples as the outlier degree. The expression for the outlier degree is: in, This is the function for calculating outlier degree; and The first Zhang Hedi Zhang's image sample data; For the sample The set of neighbors; For the sample Locally achievable density; For the sample Reverse unreachability; For the sample The set of neighbors; The total number of image samples; S6. Determine whether the outlier of each sample in the normalized data is greater than the threshold. If so, output the abnormal medical image and repeat step S6 until all samples are judged. Otherwise, treat it as normal data and proceed to the next sample until all samples are judged.
2. The unsupervised medical image anomaly detection method based on local linear embedding according to claim 1, characterized in that, Step S1 specifically involves: S11, Scale all images to The image is processed pixel by pixel, and then the RGB values of each pixel in the scaled image are merged into a one-dimensional array as a sample; Perform the same operation on each image to obtain a... OK, The matrix consists of columns; the data is normalized using the min-max method, adjusting the range of all values to the real number interval between 0 and 1. The expression is: in, For standardization purposes; Samples in image data In attributes The value on; For all samples in the image data, in terms of attributes The set of values on; Samples from medical images; It is a minimum value function; It is a function for maximizing the value; S12. Based on the normalized data, find each sample of The nearest neighbor; S13, according to nearest neighbor pairs of samples Perform linear reconstruction and calculate nearest neighbor samples. Reconstruction weights , This is obtained by minimizing the following reconstruction error: in, Indicates the first Zhang's image sample data; It is a minimum value function; Indicates sample Reconstruct sample points Weight of time; S14. Weights of linear reconstruction calculated based on each sample. The representation matrix is obtained. .
3. The unsupervised medical image anomaly detection method based on local linear embedding according to claim 1, characterized in that, Step S2 specifically involves: S21. Based on the representation matrix obtained in step S1, calculate all samples. The set of neighbors is expressed as: in, Indicates the first Zhang's image sample data; Indicates sample The set of neighbors; Indicates sample Reconstructed Samples Weight of time; S22, Based on the sample The collection of neighbors ,calculate The neighborhood distance is expressed as: in, For the first Zhang's image sample data; For the sample The neighborhood distance; It is a function for maximizing the value; For the sample The set of neighbors; For the sample The neighbors; For the sample With sample The distance between them.
4. The unsupervised medical image anomaly detection method based on local linear embedding according to claim 1, characterized in that, Step S3 specifically involves: S31. Further calculate the reachability distance using the neighborhood distance, as shown in the following expression: in, and The first Zhang Hedi Zhang's image sample data; For the sample to sample The reachable distance; It is a function for maximizing the value; For the sample The neighborhood distance; For the sample With sample The distance between them; S32. Calculate the local reachability density based on the reachability distance, as shown in the following expression: in, For the first Zhang's image sample data; For the sample Locally achievable density; For the sample The neighbors; For the sample The set of neighbors; For the sample to sample The reachable distance; This represents the number of samples in the set.
Citation Information
Patent Citations
Method for detecting outliers and boundary points based on joint density
CN107341514A
Liquid hazardous chemical substance volatilization concentration abnormity discovery method based on outlier data mining
CN112949735A