Femoral head necrosis detection method and system
By introducing the ECA attention mechanism and data augmentation algorithm into the YOLOv7 model, the problem of insufficient training data for the femoral head necrosis detection model is solved, and the detection accuracy and generalization ability are improved, especially in medical image environments with low contrast and noise interference.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TIANJIN NORMAL UNIVERSITY
- Filing Date
- 2026-03-17
- Publication Date
- 2026-04-21
AI Technical Summary
Existing femoral head necrosis detection models rely on limited medical image data, resulting in insufficient model training, poor generalization ability, and insufficient detection accuracy of traditional algorithms under low contrast and noise interference.
We added the ECA attention mechanism to the YOLOv7 model and combined it with CLAHE and AutoAugment data augmentation algorithms to improve image quality and data diversity. We also used the GIoU loss function to improve the accuracy of bounding box regression.
The improved model significantly enhances the accuracy of femoral head necrosis detection and the model's generalization ability. The improved model can more accurately locate the necrotic area in low-contrast and noisy environments.
Smart Images

Figure CN121904035A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically, to a method and system for detecting avascular necrosis of the femoral head. Background Technology
[0002] Avascular necrosis of the femoral head is a common orthopedic disease. Early diagnosis relies on manual interpretation of features such as bone sclerosis and radiolucent bands on X-rays, but this manual interpretation is easily influenced by subjective factors. Existing femoral head necrosis detection models depend on large amounts of labeled data, but the high cost and limited quantity of medical images lead to insufficient model training and poor generalization ability. Low contrast and severe noise interference in the femoral head region on X-rays affect the model's accuracy in feature extraction and localization of necrotic areas. Traditional target detection algorithms (such as Faster R-CNN) have high computational complexity, and traditional YOLO series algorithms lack sufficient accuracy in detecting small targets and complex lesions in medical scenarios. Therefore, improving the detection accuracy of femoral head images has become a technical problem that needs to be solved. Summary of the Invention
[0003] This invention aims to solve at least one of the technical problems existing in the prior art or related technologies, and discloses a method and system for detecting avascular necrosis of the femoral head, which improves the detection accuracy of the traditional YOLO model through data augmentation algorithms and ECA attention mechanism.
[0004] The first aspect of this invention discloses a method for detecting avascular necrosis of the femoral head, comprising: an improved YOLO model: based on the YOLOv7 model, an ECA module is added to the convolutional layer of the backbone network of the YOLOv7 model to obtain an improved YOLO model; wherein, the calculation process of the ECA module includes: receiving the feature map output from the convolutional layer of the backbone network of the YOLOv7 model as the input feature map, performing global average pooling on the input feature map without reducing its dimensionality; fusing neighborhood channel information using one-dimensional convolution; obtaining the weights of each channel using the Sigmoid activation function; and balancing the weights with the input feature map. Element-wise multiplication yields the ECA output feature map, which is then input into the next convolutional layer of the backbone network for subsequent convolution operations. Data augmentation: The X-ray image of the femoral head is augmented using the CLAHE image augmentation algorithm to obtain the first augmented image. The first augmented image is then processed using the AutoAugment data augmentation algorithm to obtain the second augmented image. Model training: An improved YOLO model is trained based on the second augmented image to obtain the femoral head necrosis detection model. Image detection: The X-ray image of the femoral head to be detected is input into the femoral head necrosis detection model to obtain the detection results.
[0005] In this technical solution, CLAHE (Contrast Limited Adaptive Histogram Equalization) first sets a threshold for the histogram, which limits the contrast value. Values exceeding this threshold are cropped, and the cropped portions are then evenly distributed across the remaining values, thus reconstructing the histogram. This reconstructed histogram can then be used for subsequent equalization operations. The main function of the CLAHE algorithm is to enhance image contrast while suppressing noise. Due to the scarcity of medical images, there are relatively few images of necrotic femoral heads in the dataset. However, insufficient dataset size can lead to generalization issues during model prediction. Therefore, this invention uses an automatically searched and improved data augmentation strategy (AutoAugment) to mitigate this problem. AutoAugment designs a search space, where each strategy consists of multiple sub-strategies. For each image in each mini-batch, a sub-strategy is randomly selected. Each sub-strategy contains two operators, each an image processing function such as translation, rotation, and shearing, along with the corresponding probability and magnitude. The optimal strategy is then found through a search algorithm, enabling the model to achieve the highest validation accuracy on the target dataset. This algorithm can improve performance by increasing the quantity and diversity of data in existing training datasets.
[0006] The method for detecting femoral head necrosis disclosed in this invention preferably further includes: data annotation: classifying X-ray images to obtain normal images and lesion images, and annotating the necrotic area of the femoral head in the lesion images.
[0007] According to the femoral head necrosis detection method disclosed in this invention, preferably, the YOLO model improvement step further includes: replacing the IoU loss function of the traditional YOLOv7 with the GIoU loss function to improve the bounding box regression accuracy.
[0008] According to the femoral head necrosis detection method disclosed in this invention, preferably, the YOLOv7 model specifically includes an input module, a backbone network, a neck module, and a prediction module. The input module is used to resize the image; the backbone network is used to extract features; the neck module achieves multi-scale feature fusion by combining feature maps of different levels; and the prediction module is used to perform multi-scale target prediction and output the prediction results.
[0009] According to the femoral head necrosis detection method disclosed in this invention, preferably, the backbone network includes a CBS module, an ELAN module, and an MP-1 module. The CBS module is used for feature extraction and channel conversion, while the ELAN module stitches together feature maps through different branches, thereby promoting the effective learning and convergence of deeper networks. The MP-1 module fuses feature maps obtained through different downsampling methods, retaining more feature information without increasing the computational load.
[0010] According to the femoral head necrosis detection method disclosed in this invention, preferably, the neck module includes a CBS module, an SPPCSPC module, an E-ELAN module, an MP-2 module, and a RepConv module.
[0011] A second aspect of the present invention discloses a femoral head necrosis detection system, comprising: a memory for storing program instructions; and a processor for calling the program instructions stored in the memory to implement the femoral head necrosis detection method as described in any of the above technical solutions.
[0012] The beneficial effects of this invention include at least the following: Adding an ECA attention mechanism to the traditional YOLOv7 model. ECA is an implementation of the channel attention mechanism, an extension based on SE. This module directly uses a 1x1 convolutional layer after the pooling layer, removing the fully connected layer, thus avoiding dimensionality reduction and effectively capturing cross-channel interactions. Employing CLAHE and AutoAugment joint enhancement: Targeting the characteristics of medical images, combining local contrast enhancement and automated data augmentation significantly improves the model's generalization ability. Attached Figure Description
[0013] Figure 1 A schematic diagram of the overall network model structure of a femoral head necrosis detection method according to an embodiment of the present invention is shown.
[0014] Figure 2 A schematic diagram of the network structure of an ELAN module according to an embodiment of the present invention is shown.
[0015] Figure 3 A schematic diagram of the network structure of an E-ELAN module according to an embodiment of the present invention is shown.
[0016] Figure 4 A schematic block diagram of a femoral head necrosis detection system according to an embodiment of the present invention is shown. Detailed Implementation
[0017] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the invention is not limited to the specific embodiments disclosed below.
[0019] According to an embodiment of the present invention, a method for detecting avascular necrosis of the femoral head is disclosed, comprising:
[0020] YOLO Model Improvement: Based on the YOLOv7 model, an ECA module is added to the convolutional layers of the YOLOv7 backbone network to obtain an improved YOLO model. The calculation process of the ECA module includes: receiving the feature map output from the convolutional layer of the YOLOv7 backbone network as the input feature map, performing global average pooling on the input feature map without reducing the dimension; fusing neighborhood channel information using one-dimensional convolution; obtaining the weights of each channel using the Sigmoid activation function; multiplying the weights element-wise with the input feature map to obtain the ECA output feature map, and inputting the ECA output feature map into the next level convolutional layer of the backbone network for subsequent convolution operations.
[0021] Data augmentation: The X-ray image of the femoral head is enhanced using the CLAHE image augmentation algorithm to obtain the first enhanced image; the first enhanced image is then processed using the AutoAugment data augmentation algorithm to obtain the second enhanced image.
[0022] Model training: The improved YOLO model was trained using the second enhanced image to obtain the femoral head necrosis detection model;
[0023] Image detection: Input the X-ray image of the femoral head to be detected into the femoral head necrosis detection model to obtain the detection results.
[0024] According to the above embodiments, preferably, it further includes: data annotation: classifying X-ray images to obtain normal images and lesion images, and annotating the femoral head necrosis area in the lesion images.
[0025] According to the above embodiments, preferably, the steps of improving the YOLO model further include: replacing the IoU loss function of the traditional YOLOv7 with the GIoU loss function to improve the bounding box regression accuracy.
[0026] According to the above embodiments, preferably, the YOLOv7 model specifically includes an input module, a backbone network, a neck module, and a prediction module. The input module is used to resize the image; the backbone network is used to extract features; the neck module achieves multi-scale feature fusion by combining feature maps of different levels; and the prediction module is used to perform multi-scale target prediction and output the prediction results.
[0027] According to the above embodiments, preferably, the backbone network includes a CBS module, an ELAN module, and an MP1 module. The CBS module is used for feature extraction and channel conversion, while the ELAN module stitches together feature maps through different branches, thereby promoting the effective learning and convergence of deeper networks. The MP1 module fuses feature maps obtained through different downsampling methods, retaining more feature information without increasing the computational load.
[0028] According to the above embodiments, preferably, the neck module includes a CBS module, an SPPCSPC module, an E-ELAN module, an MP2 module, and a RepConv module. The SPPCSPC module is used to improve the efficiency and accuracy of feature extraction. The E-ELAN module has a similar function to the ELAN module. The MP2 module has a similar function to the MP1 module. The RepConv module is used to reduce the number of parameters and speed up inference.
[0029] According to the above embodiment, preferably, in the model's prediction module, after obtaining the predicted bounding box and score, and obtaining the final prediction result, it is also necessary to sort the scores and perform non-maximum suppression filtering. The IoU threshold is set to 0.5. YOLOv7 uses a loss function to measure the difference between the predicted result and the true result. The loss function evaluates the model's performance by comparing the model output with the true label. In YOLOv7, it includes three parts: IoU loss between positive samples and the target, objectness loss, and classification loss. IoU (intersection over union) is the intersection of the target bounding box and the predicted bounding box divided by their union. This value is widely used in the field of object detection. The formula is:
[0030]
[0031]
[0032] Where A is the set of target boxes and B is the set of predicted boxes, a higher IoU value indicates a greater degree of overlap between boxes A and B, representing more accurate model predictions; conversely, a lower IoU indicates poorer model performance. While this loss function better reflects the degree of overlap and has scale invariance, IoU cannot accurately reflect the magnitude of the overlap. Therefore, to address the shortcomings of using IoU as a loss function, this invention uses the Generalized IoU (GIoU) loss function as its core, with the formula:
[0033]
[0034]
[0035] Where C is the area of the minimum bounding rectangle of the two boxes, this loss function can improve the accuracy and stability of the model.
[0036] According to the above embodiments, the network structure of the femoral head necrosis detection model proposed in this invention is as follows: Figure 1 As shown: UP represents upsampling; cat represents concatenation; REP represents RepConv; Conv represents convolution; CBS represents the CBS module (convolutional layer), which specifically includes sequential convolution, batch normalization, and Silu activation functions; ELAN represents the ELAN module. Figure 2 The diagram shows the network structure of the ELAN module, where E-ELAN represents the E-ELAN module. Figure 3 The network structure diagram of the E-ELAN module is shown. concat represents the splicing operation. The E-ELAN module adds two splicing operations compared to the ELAN module.
[0037] like Figure 4 As shown, according to another embodiment of the present invention, a femoral head necrosis detection system 400 is also disclosed, including: a memory 401 for storing program instructions; and a processor 402 for calling the program instructions stored in the memory to implement the femoral head necrosis detection method as described above.
[0038] In summary, this invention aims to assist in the medical task of detecting avascular necrosis of the femoral head. Based on the main algorithm YOLOv7, it adds an ECA attention module and makes improvements in the data preprocessing stage by using the CLAHE and AutoAugment algorithms. This not only enhances the quality of femoral head images but also enriches the dataset, alleviating the difficulty of data scarcity in the medical field.
[0039] All or part of the steps in the various methods of the above embodiments can be implemented by a program controlling the relevant hardware. The program can be stored in a readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other readable medium that can be used to carry or store data.
[0040] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting avascular necrosis of the femoral head, characterized in that, include: YOLO Model Improvement: Based on the YOLOv7 model, an ECA module is added to the convolutional layers of the backbone network of the YOLOv7 model to obtain an improved YOLO model; wherein, the calculation process of the ECA module includes: The feature map output from the convolutional layer of the backbone network of the YOLOv7 model is used as the input feature map, and global average pooling is performed on the input feature map without reducing the dimension. One-dimensional convolution is used to fuse neighborhood channel information; The weights of each channel are obtained using the Sigmoid activation function; The weights are multiplied element-wise with the input feature map to obtain the ECA output feature map, which is then input into the next level convolutional layer of the backbone network for subsequent convolution operations. Data augmentation: The X-ray image of the femoral head is enhanced using the CLAHE image augmentation algorithm to obtain a first enhanced image; the first enhanced image is then processed using the AutoAugment data augmentation algorithm to obtain a second enhanced image. Model training: The improved YOLO model is trained using the second enhanced image to obtain the femoral head necrosis detection model; Image detection: Input the X-ray image of the femoral head to be detected into the femoral head necrosis detection model to obtain the detection result.
2. The method for detecting femoral head necrosis according to claim 1, characterized in that, Also includes: Data annotation: The X-ray images are classified to obtain normal images and diseased images, and the femoral head necrosis area in the diseased images is annotated.
3. The method for detecting femoral head necrosis according to claim 1, characterized in that, The steps for improving the YOLO model also include: The GIoU loss function is used instead of the traditional IoU loss function in YOLOv7 to improve the accuracy of bounding box regression.
4. The method for detecting femoral head necrosis according to any one of claims 1 to 3, characterized in that, The YOLOv7 model specifically includes an input module, a backbone network, a neck module, and a prediction module. The input module is used to resize the image; the backbone network is used to extract features. The neck module achieves multi-scale feature fusion by combining feature maps at different levels; the prediction module is used to perform multi-scale target prediction and output the prediction results.
5. The method for detecting femoral head necrosis according to claim 4, characterized in that, The backbone network includes a CBS module, an ELAN module, and an MP-1 module. The CBS module is used for feature extraction and channel conversion. The ELAN module stitches together feature maps through different branches, thereby promoting the effective learning and convergence of deeper networks. The MP-1 module fuses feature maps obtained through different downsampling methods, retaining more feature information without increasing the computational load.
6. The method for detecting femoral head necrosis according to claim 4, characterized in that, The neck module includes a CBS module, an SPPCSPC module, an E-ELAN module, an MP-2 module, and a RepConv module.
7. A system for detecting avascular necrosis of the femoral head, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke the program instructions stored in the memory to implement the femoral head necrosis detection method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Knee joint image intelligent detection method and device, electronic equipment and readable medium
CN115760770A
Improved YOLOv7 road illegal stall detection method based on ECA
CN117576631A
Pelvic bone medical image key point detection system and method based on deep learning
CN119027391A
Multi-source partial discharge intelligent identification method and system based on YOLOv7 algorithm
CN119295831A
Metalearning-based low-voltage ammeter detection method, system and device and medium
CN120673084A