Transform-based femoral head necrosis prediction system and method
By using a Transformer-based femoral head necrosis prediction system and employing directional data augmentation and a Video Swin Transformer backbone network for multi-scale spatial modeling, the data imbalance problem in the prediction of femoral head necrosis after internal fixation of femoral neck fractures was solved, achieving efficient and accurate preoperative prediction and improving the stability and accuracy of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies for predicting femoral head necrosis after internal fixation for femoral neck fractures suffer from issues such as high subjectivity, poor repeatability, reliance on postoperative data leading to lag, and dataset imbalance, which affect model training stability and prediction accuracy.
A Transformer-based femoral head necrosis prediction system was adopted. Through data acquisition, preprocessing, targeted data augmentation, and Video Swin Transformer backbone network, combined with volume block merging technology, multi-scale spatial modeling and feature extraction were achieved to solve the data imbalance problem. Preoperative CT image data was used for prediction.
It significantly improves the accuracy and robustness of femoral head necrosis prediction, avoids the lag of postoperative data, enhances the ability to identify femoral head necrosis cases, and improves the stability and generalization performance of the model.
Smart Images

Figure CN121862364A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and in particular relates to a Transformer-based system and method for predicting femoral head necrosis. Background Technology
[0002] Avascular necrosis of the femoral head is a major complication following internal fixation of femoral neck fractures and a key reason for repeat surgery. It often leads to severe hip joint dysfunction, significantly impacting patients' quality of life. In clinical practice, physicians typically rely on preoperative hip X-rays or CT scans for empirical assessment to infer the probability of postoperative avascular necrosis of the femoral head. However, due to significant differences in clinical experience among physicians and the difficulty in standardizing the interpretation of imaging details, the prediction of avascular necrosis of the femoral head is highly subjective, lacks repeatability, and cannot provide a reliable basis for clinical treatment decisions.
[0003] With the rapid integration and development of medical imaging and computer technology, some studies have attempted to apply deep learning models to predict femoral head necrosis after internal fixation in patients with femoral neck fractures. These models, by learning deep features from large amounts of imaging data, provide more objective prediction results compared to traditional empirical assessment methods. However, existing technologies still have significant drawbacks: First, most studies rely on postoperative hip joint imaging data for prediction, which has a serious time lag and cannot provide a reference for preoperative treatment planning, missing the critical opportunity to optimize treatment; Second, in real clinical settings, the proportion of patients developing femoral head necrosis after internal fixation for femoral neck fractures is relatively low, resulting in a significant class imbalance in the case dataset. This causes deep learning models to favor the majority class (non-necrosis cases) during training, significantly reducing their ability to identify the minority class (necrosis cases), affecting the overall prediction accuracy and generalization performance of the model. Therefore, there is an urgent need for a technical solution that can achieve accurate preoperative prediction and effectively solve the data imbalance problem to meet actual clinical needs. Summary of the Invention
[0004] The purpose of this invention is to provide a Transformer-based system and method for predicting avascular necrosis of the femoral head, which solves the problems of strong subjectivity, poor repeatability, reliance on postoperative data and lag in prediction of avascular necrosis of the femoral head, as well as unstable model training and low prediction accuracy caused by imbalanced datasets.
[0005] To achieve the above objectives, this invention provides a Transformer-based system for predicting femoral head necrosis, comprising: Data acquisition module: used to collect preoperative hip CT scan data of patients with femoral neck fractures; Data preprocessing module: used to perform resolution unification and normalization on CT scan data; Data balancing module: Employs targeted data augmentation techniques to address the class imbalance problem in the femoral head necrosis dataset; Feature extraction module: Based on Video Swin Transformer backbone network encoding CT image features; Feature merging module: used to perform volume block merging operations on the extracted features; specifically, the input feature map has a dimension of X. After splicing, the Y channel count is 8C, and after linear projection, the Z channel count is 2C. The output dimension is... D, H, and W represent depth, height, and width, respectively, and C represents the number of channels; Necrosis classification module: used to output the encoded features as the femoral head necrosis category.
[0006] Preferably, the data preprocessing module adjusts the thickness of CT data slices by downsampling, identifies the region of interest covering the femoral head and its underlying cortical region, and normalizes the data resolution to a preset size.
[0007] Preferably, targeted data augmentation techniques include random rotation, translation, brightness and contrast adjustment, affine shearing, and Gaussian noise injection.
[0008] Preferably, the Video Swin Transformer backbone network adopts a hierarchical window self-attention mechanism, which calculates self-attention to enhance the interaction between windows after translating the feature map along the depth, height and width axes, thereby realizing multi-scale spatial modeling.
[0009] This invention also provides a Transformer-based method for predicting femoral head necrosis, comprising the following steps: Step 1: Collect preoperative CT image data of patients with femoral neck fractures from the hospital database; Step 2: Preprocess CT data, unify resolution and slice thickness, identify regions of interest and normalize them; Step 3: Use targeted data augmentation strategies and oversampling methods to solve the class imbalance problem; Step 4: Extract CT image features using the Video Swin Transformer backbone network. ; Step 5: Perform volume block merging on the extracted features, as follows: S51. Input feature map The tensor is divided into non-overlapping 2×2×2 blocks in three spatial dimensions, where D, H, and W represent depth (number of slices), height, and width, respectively. S52. For each small block, embed the features of 8 voxels into the Y channel dimension and concatenate them, as shown in the following expression: ; in, This indicates a splicing operation along the channel dimension. Indicates the location At this point, a local cube of size 2×2×2 containing all channels is extracted from the input tensor; S53. The number of channels is reduced from 8C to 2C through a linear projection to obtain the output, as shown in the following expression: ; in, This represents a learnable linear transformation applied to each concatenated feature vector to compress its channel dimension; Step 6: Map the features to predicted probabilities using a linear layer and a Sigmoid function, and then determine the category based on the probability value.
[0010] Preferably, in step 4, CT image features are extracted using the Video Swin Transformer backbone network. The process is as follows: S41. Record the preprocessed femoral head CT volume data as... Where D, H, and W represent depth, height, and width, respectively, and the channel dimension is 1; S42. Use 3D convolutional patch embedding to divide the CT volume into voxel blocks and perform feature mapping to extract CT image features. Specifically, the kernel size and step size are both [missing information]. 3D convolution pairs volume Perform downsampling, and transfer each Local voxel blocks mapped to From the dimensional feature space, we obtain the volume token representation, expressed as follows: ; in, , , , This indicates a 3D patchembedding operation; S43. The volumetric image features obtained in step S42 are... The input to the Video Swin Transformer backbone network is represented by multiple Video Swin Transformer blocks formed by stacking window multi-head self-attention (W-MSA) and translation window multi-head self-attention (SW-MSA) modules for hierarchical feature encoding. The feature maps are downsampled by the feature merging module in step 5 between each stage to obtain multi-scale high-dimensional feature maps. The feature map output from the last stage is used as the input to the subsequent risk scoring module.
[0011] Preferably, step 6 is performed as follows: S61. Perform global pooling and flattening operations on the merged feature map obtained in step 5 to obtain a one-dimensional feature vector. The feature vector is then mapped through a linear layer to obtain intermediate variables. The expression is as follows: ; In the formula, This represents the weight vector of the linear layer. For the bias term of the linear layer, and All are learnable parameters; S62. Using the Sigmoid function to convert scalars The predicted probability of a sample belonging to the avascular necrosis of the femoral head is mapped as follows: ; in, This represents the model's confidence level in the event that "the sample has avascular necrosis of the femoral head." A threshold is then applied based on this probability value. The binary classification decision is expressed as follows: ; in, This indicates a diagnosis of avascular necrosis of the femoral head. This indicates a diagnosis of non-avascular necrosis of the femoral head.
[0012] Preferably, the error between the predicted value and the true value is calculated using the binary cross-entropy loss function, and the model parameters are updated using the AdamW optimizer until convergence.
[0013] Preferably, the binary cross-entropy loss function The expression is as follows: ; In the formula, Output the necrosis risk probability for the model of the nth sample. This represents the true label of the nth sample.
[0014] Preferably, the model parameters are updated through backpropagation using the AdamW optimizer, as shown in the following expression: ; In the formula, This represents the gradient of the loss function. Represents the set of model parameters. Indicates the number of iterations.
[0015] Therefore, the present invention employs the above-mentioned Transformer-based femoral head necrosis prediction system and method, which has the following beneficial effects: (1) By adopting a targeted data augmentation strategy combined with oversampling, the problem of data imbalance can be effectively solved, the instability of minority class samples on model training can be alleviated, the stability and efficiency of the model when processing different class samples can be guaranteed, and the ability to identify necrotic cases can be improved. (2) Based on Transformer feature extraction technology, the traditional two-dimensional slice block fusion is extended to volume block fusion, which effectively models the spatial relationship between CT slices, maintains the continuity of the three-dimensional anatomical structure of the femoral head, and significantly enhances the accuracy and robustness of classification. (3) Preoperative CT image data is used for prediction to avoid the lag of postoperative data in existing technologies and reduce the risk of postoperative femoral head necrosis complications. (4) By leveraging the hierarchical window self-attention mechanism of Video Swin Transformer, self-attention is calculated within the local window, reducing the high computational cost of global self-attention while preserving important local anatomical information, thus achieving efficient multi-scale spatial modeling.
[0016] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the overall process of the Transformer-based method for predicting femoral head necrosis according to the present invention. Figure 2 This is a diagram illustrating the feature extraction process according to an embodiment of the present invention; Figure 3 This is a diagram illustrating the volume block merging process according to an embodiment of the present invention. Detailed Implementation
[0018] The following detailed description of embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0019] A Transformer-based system for predicting avascular necrosis of the femoral head includes: Data acquisition module: used to collect preoperative hip CT scan data of patients with femoral neck fractures; Data preprocessing module: used to unify and normalize the resolution of CT scan data, adjust the thickness of CT data slices by downsampling, mark the region of interest covering the femoral head and its underlying cortical area, and unify the resolution of the normalized data to the preset size; Data balancing module: Employs targeted data augmentation techniques to address class imbalance in the femoral head necrosis dataset; targeted data augmentation techniques include random rotation, translation, brightness and contrast adjustment, affine shearing, and Gaussian noise injection operations; Feature extraction module: Encodes CT image features based on VideoSwin Transformer backbone network; VideoSwin Transformer backbone network adopts a hierarchical window self-attention mechanism, calculates self-attention to enhance the interaction between windows after translating feature maps along the depth, height and width axes, and realizes multi-scale spatial modeling; Feature merging module: used to perform volume block merging operations on the extracted features; specifically, the input feature map has a dimension of X. After splicing, the Y channel count is 8C, and after linear projection, the Z channel count is 2C. The output dimension is... D, H, and W represent depth, height, and width, respectively, and C represents the number of channels; Necrosis classification module: used to output the encoded features as the femoral head necrosis category.
[0020] Please see Figure 1 The Transformer-based method for predicting femoral head necrosis includes the following steps: Step 1: Collect preoperative CT image data of patients with femoral neck fractures from the hospital database; Step 2: Preprocess CT data, standardize resolution and slice thickness, and label and normalize regions of interest (ROIs). The ROI for each CT scan is labeled according to the anatomical structure of the femoral head, ensuring coverage of the femoral head and its underlying cortical bone. All CT data are normalized to a uniform resolution for easier model processing. Step 3: Adopt targeted data augmentation strategies and oversampling methods to solve the class imbalance problem; data augmentation operations include random rotation, translation, brightness and contrast adjustment, affine shearing and Gaussian noise injection, etc., to ensure the diversity of training data and the robustness of the model; Step 4: Extract CT image features using the Video Swin Transformer backbone network. ;like Figure 2As shown, a hierarchical window self-attention mechanism is utilized to achieve efficient multi-scale spatial modeling. This mechanism reduces the high computational cost of global self-attention calculation by calculating self-attention within a local window, while preserving important local anatomical information. Specifically, CT image features are extracted using a Video Swin Transformer backbone network. The process is as follows: S41. Record the preprocessed femoral head CT volume data as... Where D, H, and W represent depth, height, and width, respectively, and the channel dimension is 1; S42. Use 3D convolutional patch embedding to divide the CT volume into voxel blocks and perform feature mapping to extract CT image features. Specifically, the kernel size and step size are both [missing information]. 3D convolution pairs volume Perform downsampling, and transfer each Local voxel blocks mapped to From the dimensional feature space, we obtain the volume token representation, expressed as follows: ; in, , , , This indicates a 3D patchembedding operation.
[0021] S43. The volumetric image features obtained in step S42 are... This represents the input to the Video Swin Transformer backbone network, which consists of four consecutive stages. Each stage comprises multiple Video Swin Transformer blocks. The specific content within each Video Swin Transformer block is as follows: ; ; ; ; in, This indicates a window-based multi-head self-attention module. This represents a multi-head self-attention module for a translation window. Representation layer normalization, It is a two-layer feedforward neural network. This represents the input feature map of the current block. This indicates the multi-head self-attention module passing through the window. and the intermediate feature map obtained after concatenating with the residuals of the input feature map. Indicates the first Intermediate output feature map after submodule This indicates a multi-head self-attention module after translation window. and the intermediate feature map obtained after residual connection, This indicates that the Video Swin Transformer block is passed through the second... The final output feature map after processing by the submodule; In this process, the input feature map is first segmented into multiple non-overlapping fixed-size local windows, and multi-head self-attention is independently computed within each window; assuming each window contains There are 10 tokens; within each window, each token is linearly mapped to form a vector of query Q, key K, and value V; the self-attention within this window is calculated as follows: ; Where d is the feature dimension, and T represents the matrix transpose operation; To enhance interaction between windows First, translate the feature map along the depth, height, and width axes. Then, the translated feature map is segmented into non-overlapping parts. Window, and compute self-attention independently within each window; Step 5: Perform volume block merging on the extracted features, such as... Figure 3 As shown, the input feature map is divided into volumetric blocks. Each 2×2×2 block concatenates the features of 8 voxels along the channel dimension, and linear projection is used to reduce the channel dimension, achieving spatial consistency across slices and further enhancing the model's understanding of the femoral head and surrounding bone structures; specifically as follows: S51. Input feature map The tensor is divided into non-overlapping 2×2×2 blocks in three spatial dimensions, where D, H, and W represent depth (number of slices), height, and width, respectively. S52. For each small block, embed the features of 8 voxels into the Y channel dimension and concatenate them, as shown in the following expression: ; in, This indicates a splicing operation along the channel dimension. Indicates the location At this point, a local cube of size 2×2×2 containing all channels is extracted from the input tensor; S53. The number of channels is reduced from 8C to 2C through a linear projection to obtain the output, as shown in the following expression: ; in, This represents a learnable linear transformation applied to each concatenated feature vector to compress its channel dimension; Step 6: Using a linear layer and a sigmoid function, the features are mapped to predicted probabilities. The output probability value represents the confidence level that the sample belongs to the avascular necrosis of the femoral head category. Finally, the category is determined based on this probability value. The specific process is as follows: S61. Perform global pooling and flattening operations on the merged feature map obtained in step 5 to obtain a one-dimensional feature vector. The feature vector is then mapped through a linear layer to obtain intermediate variables. The expression is as follows: ; In the formula, This represents the weight vector of the linear layer. For the bias term of the linear layer, and All are learnable parameters; S62. Using the Sigmoid function to convert scalars The predicted probability of a sample belonging to the avascular necrosis of the femoral head is mapped as follows: ; in, This represents the model's confidence level in the event that "the sample has avascular necrosis of the femoral head." A threshold is then applied based on this probability value. The binary classification decision is expressed as follows: ; in, This indicates a diagnosis of avascular necrosis of the femoral head. This indicates a diagnosis of non-avascular necrosis of the femoral head.
[0022] Finally, the error between the predicted and true values is calculated using the binary cross-entropy loss function, and the model parameters are updated using the AdamW optimizer until convergence. The binary cross-entropy loss function... The expression is as follows: ; In the formula, Output the necrosis risk probability for the model of the nth sample. This represents the true label of the nth sample.
[0023] The model parameters are updated via backpropagation using the AdamW optimizer, as shown in the following expression: ; In the formula, This represents the gradient of the loss function. Represents the set of model parameters. This indicates the number of iterations; through multiple iterations of optimization, the model stops training when the validation set metrics no longer improve significantly or when the preset number of training rounds is reached.
[0024] Example This invention uses retrospective preoperative hip CT data from 441 patients with femoral neck fractures to construct an experimental dataset. This dataset includes 90 patients with avascular necrosis of the femoral head (ONFH) and 351 patients without ONFH. The data are randomly divided into a training set (309 cases), a validation set (44 cases), and a test set (88 cases) in a 7:1:2 ratio to ensure the reasonableness of the data distribution and the reliability of the experimental results. To fully verify the superiority of the technical solution of this invention, three representative three-dimensional deep learning models from volumetric data analysis are selected as benchmarks: 3D ResNet-18, representing the traditional three-dimensional convolutional network paradigm; Video Vision Transformer (ViViT), representing the global self-attention mechanism paradigm; and Video Swin Transformer (abbreviated as Video Swin), representing the hierarchical local attention mechanism paradigm. All models were trained in the same hardware and software environment. Performance was compared on the test set using consistent evaluation metrics: precision, recall, F1 score, accuracy, and area under the curve (AUC), as shown in Table 1. Table 1
[0025] Experimental results show that the proposed model significantly outperforms the comparison models in all evaluation metrics: Precision reaches 0.7778, an improvement of 28.3%, 29.6%, and 22.8% compared to 3D ResNet-18 (0.6061), ViViT (0.6000), and Video Swin Transformer (0.6333), respectively; Recall is 0.7500, an improvement of 16.7% and 10.5% compared to ViViT (0.6429) and Video Swin Transformer (0.6786), respectively, slightly lower than 3D ResNet-18 (0.7143) but with a more balanced overall performance; F1-score is 0.7636, an improvement of 16.5% compared to the highest value of the three comparison models (0.6557 for 3D ResNet-18); Accuracy reaches 0.7679, an improvement of 16.5% compared to the highest value of the comparison models (0.6557 for Video Swin Transformer). The accuracy of the Transformer (0.6429) was improved by 19.4%; the AUC was 0.7742, which was 18.3% higher than the highest value of the comparison model (0.6543 for Video Swin Transformer). This fully demonstrates that the present invention effectively solves the data imbalance problem and strengthens the spatial relationship modeling by using a targeted data augmentation strategy and a volume block fusion method, which significantly improves the accuracy and robustness of femoral head necrosis prediction.
[0026] Therefore, this invention adopts the aforementioned Transformer-based femoral head necrosis prediction system and method. It collects preoperative CT image data, preprocesses it to standardize the data, and then uses targeted data augmentation to address class imbalance. Features are extracted using a Video Swin Transformer backbone network, and spatial relationships are modeled through volume block merging. Finally, classification results are output through a linear layer and a Sigmoid function, and the model is trained using a binary cross-entropy loss function and an AdamW optimizer. This approach effectively improves prediction accuracy and robustness, solving the problems of strong subjectivity, lag, and model instability caused by data imbalance in existing technologies.
[0027] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A Transformer-based system for predicting femoral head necrosis, characterized in that, include: Data acquisition module: used to collect preoperative hip CT scan data of patients with femoral neck fractures; Data preprocessing module: used to perform resolution unification and normalization on CT scan data; Data balancing module: Employs targeted data augmentation techniques to address the class imbalance problem in the femoral head necrosis dataset; Feature extraction module: Based on Video Swin Transformer backbone network encoding CT image features; Feature merging module: used to perform volume block merging operations on the extracted features; specifically, the input feature map has a dimension of X. After splicing, the Y channel count is 8C, and after linear projection, the Z channel count is 2C. The output dimension is... D, H, and W represent depth, height, and width, respectively, and C represents the number of channels; Necrosis classification module: used to output the encoded features as the femoral head necrosis category.
2. The Transformer-based femoral head necrosis prediction system according to claim 1, characterized in that: The data preprocessing module adjusts the thickness of CT data slices by downsampling, identifies the region of interest covering the femoral head and its underlying cortical bone, and normalizes the data resolution to a preset size.
3. The Transformer-based femoral head necrosis prediction system according to claim 2, characterized in that: Targeted data augmentation techniques include random rotation, translation, brightness and contrast adjustment, affine shearing, and Gaussian noise injection.
4. The Transformer-based femoral head necrosis prediction system according to claim 3, characterized in that: The VideoSwin Transformer backbone network employs a hierarchical window self-attention mechanism. By translating feature maps along the depth, height, and width axes, it calculates self-attention to enhance interactions between windows, thereby achieving multi-scale spatial modeling.
5. A Transformer-based method for predicting avascular necrosis of the femoral head, using the Transformer-based system for predicting avascular necrosis of the femoral head as described in any one of claims 1-4, characterized in that... Includes the following steps: Step 1: Collect preoperative CT image data of patients with femoral neck fractures from the hospital database; Step 2: Preprocess CT data, unify resolution and slice thickness, identify regions of interest and normalize them; Step 3: Employ targeted data augmentation strategies and oversampling methods; Step 4: Extract CT image features using the Video Swin Transformer backbone network. ; Step 5: Perform volume block merging on the extracted features, as follows: S51, Input feature map The tensor is divided into non-overlapping 2×2×2 blocks in three spatial dimensions, where D, H, and W represent depth, height, and width, respectively. S52. For each small block, embed the features of 8 voxels into the Y channel dimension and concatenate them, as shown in the following expression: ; in, This indicates a splicing operation along the channel dimension. Indicates the location At this point, a local cube of size 2×2×2 containing all channels is extracted from the input tensor; S53. The number of channels is reduced from 8C to 2C through a linear projection to obtain the output, as shown in the following expression: ; in, This represents a learnable linear transformation applied to each concatenated feature vector to compress its channel dimension; Step 6: Map the features to predicted probabilities using a linear layer and a Sigmoid function, and then determine the category based on the probability value.
6. The method for predicting femoral head necrosis based on Transformer according to claim 5, characterized in that, In step 4, CT image features are extracted using the Video Swin Transformer backbone network. The process is as follows: S41. Record the preprocessed femoral head CT volume data as... Where D, H, and W represent depth, height, and width, respectively, and the channel dimension is 1; S42. Use 3D convolutional patch embedding to divide the CT volume into voxel blocks and perform feature mapping to extract CT image features. Specifically, the kernel size and step size are both [missing information]. 3D convolution pairs volume Perform downsampling, and transfer each Local voxel blocks mapped to From the dimensional feature space, we obtain the volume token representation, expressed as follows: ; in, , , , This indicates a 3D patchembedding operation; S43. The volumetric image features obtained in step S42 are... The input to the Video Swin Transformer backbone network is represented by multiple Video Swin Transformer blocks formed by stacking window multi-head self-attention (W-MSA) and translation window multi-head self-attention (SW-MSA) modules for hierarchical feature encoding. The feature maps are downsampled by the feature merging module in step 5 between each stage to obtain multi-scale high-dimensional feature maps. The feature map output from the last stage is used as the input to the subsequent risk scoring module.
7. The method for predicting femoral head necrosis based on Transformer according to claim 6, characterized in that, Step 6 is as follows: S61. Perform global pooling and flattening operations on the merged feature map obtained in step 5 to obtain a one-dimensional feature vector. The feature vector is then mapped through a linear layer to obtain intermediate variables. The expression is as follows: ; In the formula, This represents the weight vector of the linear layer. For the bias term of the linear layer, and All are learnable parameters; S62. Using the Sigmoid function to convert scalars The predicted probability of a sample belonging to the avascular necrosis of the femoral head is mapped as follows: ; in, This represents the model's confidence level in the event that "the sample has avascular necrosis of the femoral head." A threshold is then applied based on this probability value. The binary classification decision is expressed as follows: ; in, This indicates a diagnosis of avascular necrosis of the femoral head. This indicates a diagnosis of non-avascular necrosis of the femoral head.
8. The method for predicting femoral head necrosis based on Transformer according to claim 7, characterized in that, The error between the predicted and true values is calculated using the binary cross-entropy loss function, and the model parameters are updated using the AdamW optimizer until convergence.
9. The method for predicting femoral head necrosis based on Transformer according to claim 8, characterized in that, Binary cross-entropy loss function The expression is as follows: ; In the formula, Output the necrosis risk probability for the model of the nth sample. This represents the true label of the nth sample.
10. The method for predicting femoral head necrosis based on Transformer according to claim 9, characterized in that, The model parameters are updated via backpropagation using the AdamW optimizer, as shown in the following expression: ; In the formula, This represents the gradient of the loss function. Represents the set of model parameters. Indicates the number of iterations.