A rating method for ankylosing spondylitis based on visual state space model
The deep learning method based on the visual state space model solves the problem of insufficient objectivity and accuracy in CT image rating, provides a more accurate and reliable automated rating tool, and improves the diagnostic efficiency and accuracy of ankylosing spondylitis.
Patent Information
- Application Number
- CN202411045101.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-08-01
AI Technical Summary
In the existing technology, the classification of ankylosing spondylitis based on CT images has poor objectivity and reliability, inconsistent standards, and poor accuracy, which can easily lead to missed diagnosis and misdiagnosis, as well as slow processing speed and low efficiency.
Ankylosing spondylitis rating method based on visual state space model is adopted, and the VMamba-AS model is trained through data preprocessing, supervised contrastive learning loss function and cross-entropy loss function, and CT images are classified into AS disease levels, using deep learning and computer vision. Technology builds neural network models to provide more accurate and reliable automated rating tools.
It improves the efficiency and accuracy of AS diagnosis, improves patients' diagnosis and treatment experience and treatment effects, reduces subjectivity, realizes automated assessment, improves the objectivity and accuracy of ratings, and achieves higher rating accuracy and lower Error indicator.
Smart Images

Figure CN118570202B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of medical image analysis, and in particular relates to an ankylosing spondylitis rating method based on a visual state space model. Background Art
[0002] Ankylosing Spondylitis (AS) is a chronic inflammatory arthritis characterized by inflammation and ossification of spinal joints and ligaments, and can also affect the hip joint and other peripheral joints. The cause of AS is hidden and has the potential risk of disability. In the early stages of the disease, patients may experience mild symptoms such as lower back pain and morning stiffness, but as the disease progresses, the patient's spine will gradually become stiff and fibrotic, resulting in limited activities such as bending and walking. In addition, AS can also have adverse effects on the patient's eyes, lungs, bones, muscles, etc. At present, with the help of medical imaging technologies such as magnetic resonance imaging (MRI) or computed tomography (CT), sacroiliitis in AS patients can be detected early, especially when patients have inflammatory low back pain and other typical characteristics (such as tendinitis and uveitis). Early diagnosis and intervention treatment can effectively prevent the disease from worsening.
[0003] CT has significant advantages in diagnosing AS. Its relatively high sensitivity compared to X-rays enables it to clearly show subtle changes in the vertebral body and sacroiliitis of AS patients, which helps to improve the detection rate of lesions. Compared with MRI, CT examinations are cheaper and are also available in community hospitals. They are also shorter and more convenient for follow-up of sacroiliitis disease changes. CT can accurately capture subtle signs of joint lesions, such as mild bone sclerosis, blurring, erosion, and mild narrowing of the joint space, and even asymmetric displays, which helps to diagnose AS early in the clinic and more accurately track the treatment effect. Therefore, the application of CT in the diagnosis of AS can provide reliable diagnostic information and provide important support for early intervention and treatment of AS.
[0004] However, it is difficult to evaluate and grade AS based on CT images in clinical practice. The basis for CT image classification is mainly: Grade 0, such as Figure 1a As shown: the joint is normal or the joint surface is slightly blurred; Grade I, such as Figure 1b As shown: osteoporosis around the joint, mild erosion of the subchondral bone, blurred joint surface, normal joint space; Grade II, such as Figure 1c As shown: the joint surface is blurred, subchondral bone destruction, osteoporosis and sclerosis, and the joint space is basically normal. Figure 1dAs shown: Subchondral bone is obviously destroyed, diffuse sclerosis, the joint surface is brush-like, the joint space is narrow or uneven, and there is partial ankylosis; Grade IV, such as Figure 1e Shown: bone destruction, sclerosis and osteoporosis in all joints, and complete ankylosis of the joints.
[0005] Therefore, CT image processing requires comprehensive processing and judgment of multiple features. On the one hand, CT image processing in the existing technology relies on the experience and subjective judgment of different radiologists, with inconsistent standards, poor objectivity and reliability, and is prone to missed diagnosis. On the other hand, different AS lesion grades present different characteristics on CT images. Due to the large workload and lack of radiologists, the CT image grading of ankylosing spondylitis cannot be reflected and explained in clinical imaging reports in many cases, which is not conducive to judging drug efficacy and disease progression.
[0006] In recent years, the rapid development of deep learning and computer vision technology has been widely used in many tasks in the field of medical image analysis, such as classification, segmentation, denoising, and reconstruction. In computer vision representation learning, convolutional neural networks (CNNs) and vision transformers (ViTs) are two mainstream basic models. The existing technology of AS rating based on CT images has poor objectivity and reliability, inconsistent standards, poor accuracy, and is prone to missed diagnosis and misdiagnosis, as well as slow processing speed and low efficiency. Summary of the invention
[0007] In view of the above analysis, the present invention provides an ankylosing spondylitis rating method based on a visual state space model to solve at least one of the problems in the prior art of AS rating based on CT images, namely, poor objectivity and reliability, inconsistent standards, poor accuracy, easy to cause missed diagnosis and misdiagnosis, slow processing speed and low efficiency.
[0008] The purpose of the present invention is mainly achieved through the following technical solutions:
[0009] A rating method for ankylosing spondylitis based on a visual state space model, comprising:
[0010] S1. Data preprocessing:
[0011] Based on contour detection algorithm and threshold truncation, the extra-tissue noise and interference in the sacroiliac joint area are removed;
[0012] S2. Model training:
[0013] The VMamba-AS model with VMamba as the core is trained based on the supervised contrastive learning loss function and the cross entropy loss function;
[0014] S3. Model Reasoning:
[0015] Based on the trained VMamba-AS model, AS disease grade classification is performed on the CT images to be detected.
[0016] Preferably, the VMamba-AS model comprises: an encoder module and a classification head connected in sequence;
[0017] The input end of the encoder module is connected to the output end of the data preprocessing module, and can process the CT image data to generate a feature map. The classification head can process the feature map data to obtain a corresponding score.
[0018] Preferably, the encoder in the encoder module is a VMamba backbone network.
[0019] Preferably, the VMamba backbone network includes a Stem module, and the Stem module satisfies:
[0020] The input shape is After being processed by the Stem module, the image data is transformed into , where H is the length of the input image, W is the width of the input image, and C1 is the number of feature map channels.
[0021] Preferably, the image data with two-dimensional structural features output by the Stem module undergoes multiple stages of visual state processing, each stage of which is processed using a visual state space block VSS block.
[0022] Preferably, the VSS block includes 2-dimensional selective scanning;
[0023] The 2-dimensional selective scanning includes an expansion scanning operation and an S6 block;
[0024] The S6 block adopts the selective scanning mechanism in Mamba to complete the selective interaction function between the hidden states of the current data and the previous data, and can process the scanning results of the expansion scanning operation with linear complexity.
[0025] Preferably, the supervised contrastive learning loss function L supcon satisfy:
[0026] (1);
[0027] (2);
[0028] Where N is the number of samples, l(•) is the judgment function, τ is the temperature coefficient, and s i,j Denotes the sample representation z iand sample representation z j The standardized cosine similarity between, k represents the traversal index, s i,k Denotes the sample representation z i and z k The standardized cosine similarity between , i represents the sample representation z i The index of j represents the sample representation z j The index of y i Indicates the sample label value corresponding to i, y j represents the sample label value corresponding to j, Represents y j The corresponding sample size.
[0029] Preferably, the cross entropy loss L ce satisfy:
[0030] (3);
[0031] (4);
[0032] Among them, N represents the number of samples, Represents the model for x n The predicted value of x n The slice number, y n Represents model x n The corresponding sample label value; It represents the cross entropy loss calculation function.
[0033] Preferably, the loss function L used in the final model training process is total satisfy:
[0034] (5).
[0035] A rating model for ankylosing spondylitis based on a visual state space model uses the above-mentioned rating method and includes: a data preprocessing module, an encoder module and a classification head which are sequentially connected according to a data stream.
[0036] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0037] (1) The present invention proposes a method for rating ankylosing spondylitis based on a visual state space model. The method uses deep learning and computer vision technology to construct a neural network model based on a visual state space model, providing doctors with a more accurate, reliable, and automated AS rating tool, which can improve the efficiency and accuracy of AS diagnosis, improve patients' diagnosis and treatment experience and treatment effects, and provide useful inspiration for the further development of medical image analysis. The present invention has the advantages of reducing subjectivity, improving prediction accuracy, and realizing automation, providing doctors with a more accurate and reliable evaluation tool.
[0038] (2) The present invention is the first to apply the latest and most efficient visual representation model that can capture global context features, the visual state space model VMamba, to the AS rating task, and achieves the best results in terms of REC, ACC, and F1, which are 0.005, 0.0446, and 0.0087 higher than the second place, respectively. In terms of indicators involving errors, the MAE error index of VMamba-AS is the smallest, which is 0.558 smaller than VGGNet, which has the second smallest MAE error. The scoring performance is better than that of commonly used classification models, and can achieve better rating results and higher accuracy. It greatly improves the poor objectivity and reliability of AS rating, inconsistent standards, poor accuracy, and easy missed diagnosis and misdiagnosis. At the same time, the AI diagnosis and rating of AS diseases based on the VMamba-AS model is more efficient and faster than manual judgment.
[0039] (3) The present invention uses supervised contrastive learning technology, which combines the label information of supervised learning and the non-label information of contrastive learning. It can effectively learn the representation of data when the label data is limited, and can make the representation of the same AS lesion grade data closer in the embedding space, and make the representation of different AS lesion grade data farther apart in the embedding space.
[0040] (4) The present invention uses the cross entropy loss function for the ordered loss, which can encourage the existence of an ordered progressive relationship between the representations of different lesion levels learned by the model, thereby improving the prediction accuracy and robustness of the model.
[0041] (5) Taking into account the progressive and orderly development of AS, the present invention encodes labels of different lesion levels in a different way, as follows: the label of lesion level 0 is represented as [1,0,0,0,0], the label of lesion level I is represented as [1,1,0,0,0], and the label of lesion level II is represented as [1,1,1,0,0]. This encoding method is equivalent to summing up the one-hot encoded label vectors that are less than or equal to the lesion level.
[0042] (6) The VSS block used in this invention avoids embedding bias at the position used by VMamba, which deviates from the typical visual transformer structure. It applies the following operation order in the block: normalization > attention -> normalization, and discards the MLP operation compared to the typical visual transformer structure. Therefore, the VSS block is shallower than the typical ViT block in the prior art, allowing more blocks to be stacked at the same model depth, improving resolution and processing performance.
[0043] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be achieved and obtained through the contents particularly pointed out in the description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are only used to illustrate specific embodiments and are not to be considered as limiting the present invention.
[0045] Figures 1a to 1e CT images of different AS lesion grades;
[0046] Figure 2a is the CT image before data preprocessing;
[0047] Figure 2b is the CT image after data preprocessing;
[0048] Figure 3 A structural diagram of a VMamba-AS neural network model constructed based on the present invention;
[0049] Figure 4 is a diagram of the backbone network structure of the VMamba model;
[0050] Figure 5 is a diagram of the VSS block structure. DETAILED DESCRIPTION
[0051] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of the present invention and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0052] In order to accurately describe the embodiments of the present invention, the relevant professional terms are further explained:
[0053] For the convenience of description, the VMamba-based Ankylosing Spondylitis Classification Neural Network model constructed based on the method of the present invention is referred to as VMamba-AS model.
[0054] The present invention proposes an ankylosing spondylitis rating method based on a visual state space model, comprising:
[0055] S1. Data preprocessing:
[0056] Based on contour detection algorithm and threshold truncation, the extra-tissue noise and interference in the sacroiliac joint area are removed;
[0057] S2. Model training:
[0058] The VMamba-AS model with VMamba as the core is trained based on the supervised contrastive learning loss function and the cross entropy loss function;
[0059] S3. Model Reasoning:
[0060] Based on the trained VMamba-AS model, AS disease grade classification is performed on the CT images to be detected.
[0061] It should be noted that, on the one hand, the original CT images are affected by the equipment and the surrounding environment during acquisition and may contain noise and irrelevant objects, which will reduce the performance of the deep learning model; on the other hand, CT images may also contain a large amount of structural and tissue information that is not related to AS disease, which is redundant for the model's discrimination task.
[0062] Compared with the existing technology, Figure 3 As shown, the VMamba-AS model of the present invention includes a data preprocessing module, which can process the original CT image to provide a clearer input image with higher information quality.
[0063] Specifically, S1 includes:
[0064] S101: performing threshold truncation on pixels of the image according to the CT window level (for example, 450 HU) and window width (for example, 1500 HU) of the region of interest (sacroiliac joint area);
[0065] S102: using a contour detection algorithm to draw the contours of the closed objects in the image after the threshold truncation, and obtaining the contour area of each closed object;
[0066] S103: Screening out objects whose areas are smaller than the contour area threshold according to the set contour area threshold, thereby achieving CT image denoising and irrelevant object removal;
[0067] S104: performing contour extraction on the CT image after image denoising and irrelevant object removal to complete preprocessing.
[0068] Specifically, the threshold truncation in S101 includes: limiting the grayscale value of the image grayscale value to [Hmin ,H max ], for pixel values higher than H max The pixel value is set to H max , the pixel value is lower than H min The pixel value is set to H min .
[0069] It can be understood that the above settings are helpful to suppress information in other density ranges and highlight tissues or structures in a specific density range.
[0070] It should be noted that CT images are grayscale images, and adjacent areas with the same grayscale values are identified as the same area. Based on the different grayscale values, the computer program can recognize different areas.
[0071] Specifically, the implementation of S102 includes but is not limited to: using the findContours function in the OpenCV function library to extract the contours of closed objects in the image, and using the contourArea function to calculate the area of the shape enclosed by each contour.
[0072] Specifically, the implementation of S103 includes:
[0073] S1031: Setting a contour area threshold based on the contour area of the target area;
[0074] S1032: Filter out regions whose contour areas are larger than a contour area threshold as candidate regions.
[0075] During implementation, a contour area threshold may be set according to the contour area of the target area in the CT image obtained in S102, so that the contour area threshold ≤ the contour area of the target area. The contour area threshold is obtained based on statistical rules. Usually, the contour area of the target area is greater than or equal to the contour area threshold, while the area of other irrelevant areas (such as noise points, metal partitions) is less than the contour area threshold, so they are screened out.
[0076] Specifically, the implementation of S104 includes but is not limited to: using drawContours to draw a contour extraction template for the CT image after noise removal and irrelevant object removal, and multiplying the template with the original pixel to obtain an image after data preprocessing.
[0077] Preferably, S1 also includes S105: scaling the pixel values of the image to the interval [0, 1] through an image normalization operation, so as to further improve the model's ability to recognize image features.
[0078] Specifically, the Supervised Contrastive Learning method was used in S2 during the VMamba-AS model training process.
[0079] VMamba-AS model Figure 3 As shown, it also includes: an encoder module and a classification head connected in sequence;
[0080] Among them, the input end of the encoder module is connected to the output end of the data preprocessing module, which can process the CT image data to generate a feature map, and the classification head can process the feature map data to obtain a corresponding score.
[0081] Specifically, the encoder module can use the VMamba backbone network as an encoder, and the VMamba backbone network includes a Stem module, a VSS module, and a downsampling module.
[0082] Specifically, the Stem module can use the Stem module in the Transformer model to cut the input image into image blocks; the difference is that the Stem module of the present invention uses a two-dimensional convolution kernel to perform convolution operations on the cut image blocks one by one, so that the Stem module does not convert the image blocks into a one-dimensional sequence, but retains the two-dimensional structural characteristics of the image.
[0083] For example, VMamba's Stem module does not convert image blocks into a one-dimensional sequence, but retains the dimensional structure of the image. The original input shape is , after being processed by the Stem module, the shape is transformed into , where H is the length of the input image, W is the width of the input image, and C1 is the number of feature map channels.
[0084] Furthermore, the image data with two-dimensional structural features output by the Stem module undergoes multiple stages of visual state processing, each of which is processed using a visual state space block (VSS block).
[0085] As an example, Figure 4 As shown in the figure, the image data with two-dimensional structural features output by the Stem module undergoes four stages of visual state processing, and each stage uses a visual state space block VSS block. After stages 1, 2, and 3, the feature map is downsampled by image merging, reducing the length and width of the feature map by half.
[0086] Specifically, Figure 5As shown in the figure, the VSS block includes 2D selective scanning, depthwise separable convolution, layer normalization, and linear layer; the role of 2D selective scanning is to enable the model to dynamically perceive the input data and selectively remember important content; the depthwise separable convolution decomposes the standard convolution operation into channel-by-channel convolution and point-by-point convolution, which can reduce the amount of calculation and the number of parameters while improving the efficiency and accuracy of the model; the purpose of the layer normalization operation is to reduce the problems of gradient vanishing and gradient exploding, and to improve the generalization performance of the network; the linear layer linearly combines the extracted features to improve the quality of the features.
[0087] As an example, Figure 5 As shown in the figure, the input of the VSS block passes through an initial linear embedding layer, and its output is divided into two information flows; one passes through a deep convolutional layer and passes through a Silu activation function before entering the core 2D selective scanning module, and the output of the 2D selective scanning module is normalized by a layer; the other information flow of the initial linear embedding layer passes through another linear layer and then merges with the output of the 2D selective scanning module after a layer of normalization to form the final output of the VSS block.
[0088] It is understandable that, unlike vision transformers, the VSS block avoids embedding bias in the position used by VMamba, deviating from the typical visual transformer structure, which applies the following order of operations in the block: normalization > attention -> normalization, and discards the MLP operation compared to the typical visual transformer structure. Therefore, the VSS block is shallower than the typical ViT block in the prior art, allowing more blocks to be stacked at the same model depth, improving resolution and processing performance.
[0089] Among them, the 2D selective scanning consists of three parts: expansion scanning operation, S6 block, and merge scanning operation.
[0090] Specifically, the dilation scan operation scans the image block in four directions (top left to bottom right, bottom right to top left, top right to bottom left, bottom left to top right), while the attention mechanism in the visual transformer scans the image block in different directions (top left to bottom right, bottom right to top left, top right to bottom left, bottom left to top right); compared to the attention mechanism in the visual transformer, The computational complexity of the expansion scan operation is O(N). Therefore, the computational complexity of the expansion scan operation is relatively lower than that of the attention mechanism in that it can significantly reduce the cost of computing resources, making the model have better computing speed and evaluation efficiency.
[0091] Specifically, the S6 block can adopt the selective scanning mechanism in Mamba to complete the selective interaction function between the hidden state of the current data and the previous data, and can process the scanning results of the expansion scanning operation with linear complexity; therefore, it can have the linear complexity in Mamba and at the same time retain the global receptive field, so that the model can learn better image representation.
[0092] Specifically, the merge scan operation merges the image blocks processed by the S6 block again to form a feature map of the same size as the input of this stage. The merge scan operation can be a direct splicing at the image block level in the prior art.
[0093] Specifically, the input of the classification head of VMamba-AS is the feature map processed by the Vmamba-AS encoder. The classification head of Vmamba-AS uses a global pooling operation to map the feature map into a visual representation with a fixed dimension, and then uses a linear fully connected layer to classify the visual representation.
[0094] When implemented, in the present invention, x is defined as i ∈Х,x i represents the two-dimensional CT slice image obtained by the image preprocessing module, i represents x i The slice number, Х represents the image space;
[0095] The corresponding rating label is y i ,y i ∈Y={0,1,2,3,4};
[0096] definition , z i represents x generated by the encoder f(·) i The embedded representation of , Z is the embedding space, and then the classification head is used to obtain the AS lesion grade score;
[0097] It can be understood that the VMamba-AS model training process of the present invention is to learn x→z→y, that is, the mapping from image space to embedding space and then to label, to achieve the rating of AS lesion level.
[0098] It should be noted that supervised contrastive learning combines supervised learning and contrastive learning. The model is required to map the representations of samples of the same category to closer positions and map the representations of samples of different categories to positions farther away from each other, which enables the model to learn more discriminative feature representations.
[0099] In the AS rating task, the present invention uses supervised contrast learning technology to make the representations of the same AS lesion grade data closer in the embedding space, and to make the representations of different AS lesion grade data farther apart in the embedding space.
[0100] Compared with existing technologies, the advantage of supervised contrastive learning is that it combines the label information of supervised learning and the unlabel information of contrastive learning, which can effectively learn the representation of data when the labeled data is limited.
[0101] During the training process, the supervised contrast loss function L corresponding to supervised contrast learning is supcon As shown in formula (1). Where N represents the number of samples, l(•) represents the judgment function, l(•)=1 means the formula is valid, l(•)=0 means the formula is not valid; τ is the temperature coefficient, s i,j Denotes the sample representation z i and sample representation z j The cosine similarity between them, k represents the traversal index, s i,k Denotes the sample representation z i and sample representation z k The cosine similarity between them, i represents the sample representation z i The index of j represents the sample representation z j The index of y i Indicates the sample label value corresponding to i, y j represents the sample label value corresponding to j, Represents y j The corresponding sample size is calculated as shown in formula (2).
[0102] (1);
[0103] (2);
[0104] The cross entropy loss used in the present invention is defined as shown in formula (3). Where N represents the number of samples, Represents the model for x i The predicted value of x i The slice number, Represents model x i The corresponding sample label value; It represents the cross entropy loss calculation function; L ce It represents the cross entropy loss:
[0105] (3);
[0106] (4).
[0107] It should be noted that the cross entropy describes the distance between two probability distributions. The smaller the cross entropy, the closer the two are. Entropy is used to measure the uncertainty of a system (that is, all events). Entropy is the expected value of the amount of information. It is a measure of the certainty of a random variable. The larger the entropy, the more uncertain the value of the variable. Conversely, the smaller the entropy, the more certain the value of the variable.
[0108] It can be seen from formulas (3)-(4) that when calculating the loss, the cross entropy loss directly acts on each component of the predicted value; for AS diseases with higher lesion levels, their predicted values should cover AS diseases with low lesion levels, and AS diseases with high lesion levels that meet the AS disease requirements of the present invention should have the pathological characteristics of AS diseases with low lesion levels.
[0109] Compared with the prior art, the present invention uses the cross entropy loss function for loss, which can encourage the existence of an orderly and progressive relationship between the representations of different lesion levels learned by the model, thereby improving the prediction accuracy and robustness of the model.
[0110] The loss function used in the final model training process is shown in formula (5):
[0111] (5).
[0112] Specifically, S2 includes:
[0113] S201: Substitute the normalized operation image data into the VMamba-AS initial model and calculate the output prediction value;
[0114] S202: Calculate prediction error based on the loss function;
[0115] S203: According to the derivative of the loss function, the prediction error is transmitted back along the direction of the minimum gradient to correct each weight value in the forward loss function;
[0116] S204: The iteration is stopped until the loss function value reaches a preset value or the set number of iterations is completed.
[0117] Specifically, L supcon middle , L ce middle Represents weight.
[0118] During implementation, the classification head uses nn.AdaptiveAvgPool2d in PyTorch as the global pooling layer, and nn.Linear in PyTorch as the classification layer, with an input dimension of 256 and an output dimension of 5 (the number of rating categories). The input dimension of the classification head is 256, and the output dimension is 5, which is consistent with the number of AS disease rating categories.
[0119] As an example, the VMamba-AS training settings meet the following requirements: the batch size is set to 32, Adam is used as the optimizer, the learning rate is 0.0001, the training cycle is 200 rounds, and the early stopping mechanism (patience=3) is introduced. The temperature coefficient τ is set to 0.07.
[0120] Example 1
[0121] This embodiment discloses an ankylosing spondylitis rating model and rating method.
[0122] The rating model is the VMamba-AS model, which includes: a data preprocessing module, an encoder module, and a classification head connected in sequence according to the data flow;
[0123] like Figure 5 As shown, the encoder module is the VMamba backbone network including the Stem module, VSS module, and downsampling module;
[0124] The Stem module makes the following improvements based on the Stem module in the Transformer model: the cropped image blocks are convolved one by one using a two-dimensional convolution kernel, so that the output of the Stem module can retain the two-dimensional structural characteristics of the image.
[0125] like Figure 4 As shown in the figure, the image data with two-dimensional structural features output by the Stem module undergoes four stages of sequential visual state processing, in which the first stage only has a visual state space block VSS block, and its input end is connected to the output end of the Stem module; the structures of the second, third, and fourth stages are the same, the input end is a downsampling block, and the output end is a visual state space block VSS block, and the downsampling block and the other two blocks are connected sequentially according to the data flow.
[0126] like Figure 5 As shown, the visual state space block VSS block adopts a typical VSS block in the prior art, and the number of VSS blocks contained in each stage is set to [1,1,2,1]; the image block size is set to 4×4, and the number of feature map channels C1, C2, C3, and C4 in each stage are set to 96, 192, 384, and 768 respectively.
[0127] The rating method includes:
[0128] S1. Data preprocessing:
[0129] Based on contour detection algorithm and threshold truncation, the extra-tissue noise and interference in the sacroiliac joint area are removed;
[0130] S2. Model training:
[0131] The VMamba-AS model with VMamba as the core is trained based on the supervised contrastive learning loss function and the cross entropy loss function;
[0132] S3. Model Reasoning:
[0133] Based on the trained VMamba-AS model, AS disease grade classification is performed on the CT images to be detected.
[0134] S101: threshold truncation of image pixels is performed based on the CT window level (450HU) and window width (1500HU) of the region of interest (sacroiliac joint);
[0135] S102: using a contour detection algorithm to draw the contour of the closed object in the image after the threshold truncation, and calculating its area;
[0136] S103: Screening out objects whose areas are smaller than the contour area threshold according to the set contour area threshold, thereby achieving CT image denoising and irrelevant object removal;
[0137] S104: performing contour extraction on the CT image after image denoising and irrelevant object removal to complete preprocessing;
[0138] S105: Through the image normalization operation, the pixel values of the image are scaled to the interval [0, 1] to further improve the model's ability to recognize image features.
[0139] Threshold truncation in S101: The grayscale value of the image is limited to [H min ,H max ], for pixel values higher than H max The pixel value is set to H max , the pixel value is lower than H min The pixel value is set to H min .
[0140] S102 implementation method: Use the findContours function in the OpenCV function library to extract the contours of closed objects in the image, and use the contourArea function to calculate the area of the shape enclosed by each contour.
[0141] Specifically, S103 is implemented as follows:
[0142] S1031: Setting the target area contour area threshold;
[0143] S1032: Filter out regions whose contour areas are larger than a contour area threshold as candidate regions.
[0144] S104 is implemented by using drawContours to draw a contour extraction template for the CT image after noise removal and irrelevant object removal, and multiplying the template with the original pixel to obtain an image after data preprocessing.
[0145] S1 is implemented as follows:
[0146] First, according to the CT window level (450HU) and window width (1500HU) of the target region of interest (e.g., sacroiliac joint), the image is thresholded and the grayscale value of the image is limited to [-300, 1200]. For pixels with a pixel value higher than 1200, its pixel value is set to 1200, and for pixels with a pixel value lower than -300, its pixel value is set to -300.
[0147] Furthermore, the findContours function in the OpenCV function library is used to extract the contours of closed objects in the image, and the contourArea function is used to calculate the area of the shape enclosed by each contour;
[0148] Furthermore, the area threshold is set to 20000 (when the input CT image size is 512×512), and only the area above the area threshold (sacroiliac joint area) is retained. This operation can remove noise points and isolated irrelevant objects (metal partitions) in the image.
[0149] Finally, use drawContours to draw the contour extraction template and multiply it with the original pixel to obtain the image after data preprocessing.
[0150] The sample results before and after data preprocessing are as follows Figure 2a , Figure 2b As shown: After preprocessing, the extra-tissue information of the metal partition and sacroiliac joint in the original CT image was removed.
[0151] The VMamba-AS training settings meet the following requirements: the batch size is set to 32, Adam is used as the optimizer, the learning rate is 0.0001, the training cycle is 200 rounds, and the early stopping mechanism (patience=3) is introduced. The temperature coefficient Set to 0.07.
[0152] VMamba-AS model loss function L total satisfy:
[0153] (1);
[0154] (2);
[0155] (3);
[0156] (4);
[0157] (5).
[0158] In the classification head, nn.AdaptiveAvgPool2d in PyTorch is used as the global pooling layer, and nn.Linear in PyTorch is used as the classification layer. The input dimension of the classification head is 256, and the output dimension is 5 (the number of rating categories). The input dimension of the classification head is 256, and the output dimension is 5, which is consistent with the number of AS disease rating categories.
[0159] Experimental Example 1 (Comparative Experiment)
[0160] In order to verify the effectiveness of the method proposed in the present invention, a comparative experiment between VMamba-AS and other commonly used classification models is carried out.
[0161] The experimental data set contains CT image data of the sacroiliac joint from 14 patients, with a total of 800 CT image slices. The data set is divided into patients, and the training set (including data from 11 patients) has a total of 643 CT image slices, of which the number of each AS lesion level is as follows: 147 at level 0, 134 at level Ⅰ, 110 at level Ⅱ, 121 at level Ⅲ, and 131 at level Ⅳ. The test set (including data from 3 patients) has a total of 157 CT image slices, and the number of each AS lesion level is as follows: 49 at level 0, 16 at level Ⅰ, 29 at level Ⅱ, 31 at level Ⅲ, and 32 at level Ⅳ.
[0162] The classification models involved in the comparative experiment are: (1) VMamba-AS (the method proposed by the present invention), (2) ResNet (using the ResNet-34 structure), (3) DenseNet (using the DenseNet-121 structure), (4) VGG (using the VGG-13 structure), and (5) ViT: using the ViT-Small structure.
[0163] Except for VMamba-AS, other classification models participating in the experiment use cross entropy loss as the training loss function and have the same experimental configuration as VMamba-AS.
[0164] The evaluation indicators used in the comparative experiment are as follows:
[0165] (1) Recall (REC): The ratio of the number of samples correctly predicted as positive to the number of samples of the true positive category. The higher this indicator is, the closer the model rating result is to the true result.
[0166] (2) Precision (PRE): The ratio of the number of samples correctly predicted as positive to the number of all samples predicted as positive. The higher this indicator is, the more accurate the model rating is.
[0167] (3) Accuracy (ACC): The ratio of the number of correctly classified samples to the total number of samples. The higher the score of this indicator, the more accurate the model rating.
[0168] (4) F1 Score (F1): The harmonic mean of precision and recall, which comprehensively considers the performance of precision and recall. The higher the index, the better the overall performance of the model rating.
[0169] (5) Mean Absolute Error (MAE): used to measure the error between the predicted value and the sample label value (true value). The lower the index, the smaller the model rating error. The results of the AS rating task comparison experiment are shown in Table 1.
[0170] Table 1: AS rating task comparison experiment results
[0171]
[0172] As can be seen from Table 1, the proposed method VMamba-AS achieves the best results in terms of REC, ACC, and F1, which are 0.005, 0.0446, and 0.0087 higher than the second place respectively. In terms of error indicators, VMamba-AS has the smallest MAE error indicator, which is 0.558 smaller than VGGNet, which has the second smallest MAE error.
[0173] In summary, the scoring performance of the VMamba-AS proposed in the present invention is better than that of the commonly used classification models.
[0174] Experimental Example 2 (Ablation Experiment)
[0175] In order to explore the rationality of each module proposed in the present invention, an ablation experiment is carried out here to specifically analyze the rationality of the supervised contrastive learning technology and the ordered classification technology used in VMamba-AS. The specific experimental results are shown in Table 2.
[0176] Configuration description:
[0177] Configuration 1: VMamba-AS model proposed by this invention, see "Implementation Details" for configuration details
[0178] Configuration 2: VMamba-AS-big, the number of VSS blocks in each phase is [2,2,4,2].
[0179] Configuration 3: VMamba-AS-thin, the number of VSS blocks in each phase is [1,1,1,1].
[0180] Configuration 4: VMamba-AS’s loss function removes the supervised contrast loss function and only uses the cross loss function.
[0181] Table 2: Ablation experiment results
[0182]
[0183] As can be seen from Table 2, the method Vmamba-AS proposed in the present invention corresponding to configuration 1 achieved the best effect in the ablation experiment. Regarding the model structure, configuration 1 is compared with configurations 2 and 3, which shows that the structure set by the present invention has a certain rationality. Regarding the loss function, the corresponding test result of configuration 1 is better than that of configuration 4, which shows that the addition of the supervised contrast loss function improves the model's ability to learn visual representations, so that the model has better AS rating performance. The above is only a preferred specific implementation of the present invention, but the protection scope of the present invention is not limited to this. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
[0184] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A rating method for ankylosing spondylitis based on a visual state space model, characterized in that: include: S1. Data preprocessing: Based on contour detection algorithm and threshold truncation, the extra-tissue noise and interference in the sacroiliac joint area are removed; S2. Model training: The VMamba-AS model with VMamba as the core is trained based on the supervised contrastive learning loss function and the cross entropy loss function; The VMamba-AS model includes: an encoder module and a classification head connected in sequence; The input end of the encoder module is connected to the output end of the data preprocessing module, and can process the CT image data to generate a feature map, and the classification head can process the feature map data to obtain a corresponding score; The encoder in the encoder module is a VMamba backbone network; The VMamba backbone network includes a Stem module, a VSS module, and a downsampling module; Supervised Contrastive Learning Loss Function L supcon satisfy: (1); (2); Where N is the number of samples, l(•) is the judgment function, τ is the temperature coefficient, and s i,j Denotes the sample representation z i and sample representation z j The cosine similarity between them, k represents the traversal index, s i,k Denotes the sample representation z i and sample representation z k The cosine similarity between them, i represents the sample representation z i The index of j represents the sample representation z j The index of y i represents the sample label value corresponding to i, y j represents the sample label value corresponding to j, Represents y j The corresponding sample size; Cross entropy loss L ce satisfy: (3); (4); Where N represents the number of samples, Represents the model for x n The predicted value of x n The slice number, y n Represents model x n The corresponding sample label value; It represents the cross entropy loss calculation function; The loss function L used in the final model training process total satisfy: (5); S3. Model Reasoning: Based on the trained VMamba-AS model, AS disease grade classification is performed on the CT images to be detected.
2. The rating method according to claim 1, characterized in that: The Stem module meets the following requirements: The input shape is After being processed by the Stem module, the image data is transformed into , where H is the length of the input image, W is the width of the input image, and C1 is the number of feature map channels.
3. The rating method according to claim 2, characterized in that: The image data with two-dimensional structural features output by the Stem module undergoes multiple stages of visual state processing, each stage of which is processed using a visual state space block VSS block.
4. The rating method according to claim 3, characterized in that: The VSS block includes 2-dimensional selective scanning; The 2D selective scanning includes an expansion scanning operation and an S6 block; The S6 block adopts the selective scanning mechanism in Mamba to complete the selective interaction function between the hidden states of the current data and the previous data, and can process the scanning results of the expansion scanning operation with linear complexity.
5. A rating model for ankylosing spondylitis based on a visual state space model, characterized in that: The rating method according to any one of claims 1 to 4 comprises: a data preprocessing module, an encoder module and a classification head connected in sequence according to a data stream.
Citation Information
Patent Citations
Automatic grading method for ankylosing spondylitis based on multi-task deep learning
CN113763340A
Head and neck cancer local recurrence information acquisition method based on multi-modal supervised contrast learning
CN115272230A
