Use Faster R-CNN and YOLOv11-OBB to detect the scaphoid fracture location.
- Configuration
git clone https://github.com/Hlunlun/Fractured-Scaphoid-Detection cd Fractured-Scaphoid-Detection conda env create --file environment.yml - Run
- Training
python main.py --train 1
- Start System
python main.py
- Training
| Name | Description | path |
|---|---|---|
| ScaphoidDetector | Detects scaphoid bone in X-ray hand images using Faster R-CNN | scaphoid_detector.py |
| FractureClassifier | Classify scaphoid fractures using VGG16 pre-trained model after detection by ScaphoidDetector | fracture_classifier.py |
| HandDetector | Detects scaphoid bones and fractures region in X-ray hand image using YOLOv11-OBB | hand_detector.py |
-
ScaphoidDetector + FractureClassifier + HandDetector
First, use Faster R-CNN to detect the scaphoid bone in the full X-ray hand image. Then, use VGG16 to classify whether there is a fracture. Finally, use YOLOv11-obb to detect the fracture location. -
HandDetector
Directly use YOLOv11-obb to detect the scaphoid bone and fracture locations.
- File Structure
ip_data ├── fracture_detection │ └── annotations // Fracture locations: rectangle coordinates [[x1, y1], [x2, y2], [x3, y3], [x4, y4]] └── scaphoid_detection ├── annotations // Scaphoid locations: rectangle coordinates of the upper-left and lower-right corners [x1, y1, x2, y2] └── images // Hand X-ray images - After data preprocessing in
dataset.py,all_datas.jsonand new folders will be created under fracture_detection and scaphoid_detection:├── ip_data ├── fracture_detection │ ├── annotations │ ├── images │ └── images_rec └── scaphoid_detection ├── annotations ├── images └── images_rec ├── all_datas.jsonfracture_detection/images/: Contains the full scaphoid images cropped based on scaphoid locations.images_rec/: Contains the scaphoid images with highlighted fracture locations.
fracture_detection ├── annotations ├── images └── images_recfracture_detection/images_rec: Stores hand images with the scaphoid region framed.
-
Train ScaogiudDetector
from scahpoid_detector import ScaphoidDetector scaphoid_detector = ScaphoidDetector(args) scaphoid_detector.train()
-
Train FractureClassifier
from fracture_classifier import FractureClassifier fracture_classifier = FractureClassifier(args) fracture_classifier.train()
-
Train HandDetector
from hand_detector import HandDetector hand_detector = HandDetector(args) hand_detector.train()
Steps 1. Detect Scaphoid
-
Use
detect()functionscaphoid_detector.detect(dir_path)
-
Detected scaphoid location will be cropped and saved in
prediction/scaphoid/
Steps 2. Classify fracture
-
Use
classify()functionfracture_classifier.classify(dir_path)
-
Fracture scaphoid will be saved in
prediction/classifier/
Steps 3. Detect fracture location
- Use
detect_fracture()function - The images with marked fracture locations will be saved in
prediction/fracture/
使用 yolo_anno.py 內的函數來建構 YOLOv11-OBB的資料
- File Structure
yolo_config ├── data ├── datasets │ ├── fracture │ │ ├── images │ │ │ ├── train │ │ │ └── val │ │ └── labels │ │ ├── train │ │ └── val │ └── hand │ ├── images │ │ ├── train │ │ └── val │ └── labels │ ├── train │ └── val └── weights
- Train hand detector
from hand_detector import HandDetector hand_detector = HandDetector(args) hand_detector.train()
- Curve will be in
runs/
Detect the scaphoid bone and fractures in X-ray hand images. Choose the coordinates with the highest confidence and plot the bounding boxes.
Load a folder containing the dataset file structure. The system will then begin predicting and save the images with the scaphoid and fracture locations highlighted.


