ammarlodhi255/yolov10-fracture-detection

This repository contains code the official code for the paper "Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System"

12

stars

33

commits

Python

primary language

Aug 23, 2024

updated

arxiv.org/abs/2407.15689
bone-fracture-detection
deep-learning
fracture
fracture-detection
medical-imaging
object-detection
yolov10
yolov9

README

Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System

PWC

PWC

Paper URL: Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System

Wrist fractures are highly prevalent among children and can significantly impact their daily activities, such as attending school, participating in sports, and performing basic self-care tasks. If not treated properly, these fractures can result in chronic pain, reduced wrist functionality, and other long-term complications. Recently, advancements in object detection have shown promise in enhancing fracture detection, with systems achieving accuracy comparable to, or even surpassing, that of human radiologists. The YOLO series, in particular, has demonstrated notable success in this domain. This study is the first to provide a thorough evaluation of various YOLOv10 variants to assess their performance in detecting pediatric wrist fractures using the GRAZPEDWRI-DX dataset. It investigates how changes in model complexity, scaling the architecture, and implementing a dual-label assignment strategy can enhance detection performance. Experimental results indicate that our trained model achieved mean average precision (mAP@50-95) of 51.9% surpassing the current YOLOv9 benchmark of 43.3% on this dataset. This represents an improvement of 8.6%.

Overall Model Architecture

Performance Comparison YOLOv9 vs YOLOv10

VariantmAP@50 (%)mAP@50-95 (%)F1 (%)Params (M)FLOPs (G)
YOLOv9-C65.342.764.051.0239.0
YOLOv9-E65.543.364.069.4244.9
YOLOv9-C'66.245.266.725.3102.4
YOLOv9-E'67.044.970.957.4189.2
YOLOv10-N59.539.163.02.78.2
YOLOv10-S76.151.767.58.024.5
YOLOv10-M75.951.967.816.563.5
YOLOv10-L70.946.668.725.7126.4
YOLOv10-X76.248.269.831.6169.9

Requirements

  • Linux (Ubuntu)
  • Python = 3.12
  • Pytorch = 2.3
  • NVIDIA GPU + CUDA CuDNN

Environment

  pip install -r requirements.txt

Dataset Split

  • GRAZPEDWRI-DX Dataset (Download Link)

  • Download dataset and put images and annotatation into ./GRAZPEDWRI-DX_dataset/data/images, ./GRAZPEDWRI-DX_dataset/data/labels.

  • Since the authors of the dataset did not provide a split, we randomly partitioned the dataset into a training set of 15,245 images (75%), a validation set of 4,066 images (20%), and a testing set of 1,016 images (5%).

      python split.py
    
  • The dataset is divided into training, validation, and testing set (75-20-5%).

  • The script then will move the files into the relative folder as it is represented here below.

     GRAZPEDWRI-DX_dataset
        └── data
             ├── images
             │    ├── train
             │    │    ├── train_img1.png
             │    │    ├── train_img2.png
             │    │    └── ...
             │    ├── val
             │    │    ├── val_img1.png
             │    │    ├── val_img2.png
             │    │    └── ...
             │    └── test
             │         ├── test_img1.png
             │         ├── test_img2.png
             │         └── ...
             └── labels
                  ├── train
                  │    ├── train_annotation1.txt
                  │    ├── train_annotation2.txt
                  │    └── ...
                  ├── val
                  │    ├── val_annotation1.txt
                  │    ├── val_annotation2.txt
                  │    └── ...
                  └── test
                       ├── test_annotation1.txt
                       ├── test_annotation2.txt
                       └── ...
    

Weights

You can download the trained weights of YOLOv10 and YOLOv9 on the GRAZPEDWRI-DX dataset from the following link and use them directly in your applications.

Train & Validate

Before training the model, make sure the path to the data in the ./data/meta.yaml file is correct.

  • meta.yaml
names:
- boneanomaly
- bonelesion
- foreignbody
- fracture
- metal
- periostealreaction
- pronatorsign
- softtissue
- text
nc: 9
path: data/GRAZPEDWRI-DX/data/images
train: data/GRAZPEDWRI-DX/data/images/train
val: data/GRAZPEDWRI-DX/data/images/valid
test: data/GRAZPEDWRI-DX/data/images/test
  • Arguments
KeyValueDescription
workers8number of worker threads for data loading (per RANK if DDP)
device0device to run on, i.e. device=0,1,2,3 or device=cpu
modelNonepath to model file, i.e. yolov10n.pt, yolov10n.yaml
batch32number of images per batch (-1 for AutoBatch)
datadata.yamlpath to data file, i.e. coco128.yaml
img640size of input images as integer, i.e. 640, 1024
cfgyolo.yamlpath to model.yaml, i.e. yolov10n.yaml
weightsNoneinitial weights path
nameexpsave to project/name
epochs100number of epochs to train for
  • Example
  from ultralytics import YOLO

  model = YOLO("yolov10x.pt")
  results=model.train(data='dataset/meta.yaml', epochs=100, imgsz=640, batch=32, name='x')

Citation

If you find our paper useful in your research, please consider citing:

   @article{ahmed2024pediatric,
	  title     = {Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System},
	  author    = {Ahmed, Ammar and Manaf, Abdul},
	  year      = {2024},
	  journal   = {arXiv},
	  eprint    = {2407.15689},
	  note      = {arXiv:2407.15689},
	  url       = {https://doi.org/10.48550/arXiv.2407.15689},
	  doi       = {10.48550/arXiv.2407.15689}
}

Contributors

ammarlodhi255

33 commits

ammarlodhi255/yolov10-fracture-detection

This repository contains code the official code for the paper "Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System"

12

stars

33

commits

Python

primary language

Aug 23, 2024

updated

arxiv.org/abs/2407.15689
bone-fracture-detection
deep-learning
fracture
fracture-detection
medical-imaging
object-detection
yolov10
yolov9

README

Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System

PWC

PWC

Paper URL: Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System

Wrist fractures are highly prevalent among children and can significantly impact their daily activities, such as attending school, participating in sports, and performing basic self-care tasks. If not treated properly, these fractures can result in chronic pain, reduced wrist functionality, and other long-term complications. Recently, advancements in object detection have shown promise in enhancing fracture detection, with systems achieving accuracy comparable to, or even surpassing, that of human radiologists. The YOLO series, in particular, has demonstrated notable success in this domain. This study is the first to provide a thorough evaluation of various YOLOv10 variants to assess their performance in detecting pediatric wrist fractures using the GRAZPEDWRI-DX dataset. It investigates how changes in model complexity, scaling the architecture, and implementing a dual-label assignment strategy can enhance detection performance. Experimental results indicate that our trained model achieved mean average precision (mAP@50-95) of 51.9% surpassing the current YOLOv9 benchmark of 43.3% on this dataset. This represents an improvement of 8.6%.

Overall Model Architecture

Performance Comparison YOLOv9 vs YOLOv10

VariantmAP@50 (%)mAP@50-95 (%)F1 (%)Params (M)FLOPs (G)
YOLOv9-C65.342.764.051.0239.0
YOLOv9-E65.543.364.069.4244.9
YOLOv9-C'66.245.266.725.3102.4
YOLOv9-E'67.044.970.957.4189.2
YOLOv10-N59.539.163.02.78.2
YOLOv10-S76.151.767.58.024.5
YOLOv10-M75.951.967.816.563.5
YOLOv10-L70.946.668.725.7126.4
YOLOv10-X76.248.269.831.6169.9

Requirements

  • Linux (Ubuntu)
  • Python = 3.12
  • Pytorch = 2.3
  • NVIDIA GPU + CUDA CuDNN

Environment

  pip install -r requirements.txt

Dataset Split

  • GRAZPEDWRI-DX Dataset (Download Link)

  • Download dataset and put images and annotatation into ./GRAZPEDWRI-DX_dataset/data/images, ./GRAZPEDWRI-DX_dataset/data/labels.

  • Since the authors of the dataset did not provide a split, we randomly partitioned the dataset into a training set of 15,245 images (75%), a validation set of 4,066 images (20%), and a testing set of 1,016 images (5%).

      python split.py
    
  • The dataset is divided into training, validation, and testing set (75-20-5%).

  • The script then will move the files into the relative folder as it is represented here below.

     GRAZPEDWRI-DX_dataset
        └── data
             ├── images
             │    ├── train
             │    │    ├── train_img1.png
             │    │    ├── train_img2.png
             │    │    └── ...
             │    ├── val
             │    │    ├── val_img1.png
             │    │    ├── val_img2.png
             │    │    └── ...
             │    └── test
             │         ├── test_img1.png
             │         ├── test_img2.png
             │         └── ...
             └── labels
                  ├── train
                  │    ├── train_annotation1.txt
                  │    ├── train_annotation2.txt
                  │    └── ...
                  ├── val
                  │    ├── val_annotation1.txt
                  │    ├── val_annotation2.txt
                  │    └── ...
                  └── test
                       ├── test_annotation1.txt
                       ├── test_annotation2.txt
                       └── ...
    

Weights

You can download the trained weights of YOLOv10 and YOLOv9 on the GRAZPEDWRI-DX dataset from the following link and use them directly in your applications.

Train & Validate

Before training the model, make sure the path to the data in the ./data/meta.yaml file is correct.

  • meta.yaml
names:
- boneanomaly
- bonelesion
- foreignbody
- fracture
- metal
- periostealreaction
- pronatorsign
- softtissue
- text
nc: 9
path: data/GRAZPEDWRI-DX/data/images
train: data/GRAZPEDWRI-DX/data/images/train
val: data/GRAZPEDWRI-DX/data/images/valid
test: data/GRAZPEDWRI-DX/data/images/test
  • Arguments
KeyValueDescription
workers8number of worker threads for data loading (per RANK if DDP)
device0device to run on, i.e. device=0,1,2,3 or device=cpu
modelNonepath to model file, i.e. yolov10n.pt, yolov10n.yaml
batch32number of images per batch (-1 for AutoBatch)
datadata.yamlpath to data file, i.e. coco128.yaml
img640size of input images as integer, i.e. 640, 1024
cfgyolo.yamlpath to model.yaml, i.e. yolov10n.yaml
weightsNoneinitial weights path
nameexpsave to project/name
epochs100number of epochs to train for
  • Example
  from ultralytics import YOLO

  model = YOLO("yolov10x.pt")
  results=model.train(data='dataset/meta.yaml', epochs=100, imgsz=640, batch=32, name='x')

Citation

If you find our paper useful in your research, please consider citing:

   @article{ahmed2024pediatric,
	  title     = {Pediatric Wrist Fracture Detection in X-rays via YOLOv10 Algorithm and Dual Label Assignment System},
	  author    = {Ahmed, Ammar and Manaf, Abdul},
	  year      = {2024},
	  journal   = {arXiv},
	  eprint    = {2407.15689},
	  note      = {arXiv:2407.15689},
	  url       = {https://doi.org/10.48550/arXiv.2407.15689},
	  doi       = {10.48550/arXiv.2407.15689}
}

Contributors

ammarlodhi255

33 commits

Languages

Python

64.5%

Jupyter Notebook

30.7%

Rust

2.1%

C++

1.7%