# YOLOv9 for Fracture Detection
## Comparison
<p align="left">
<img src="img/figure_comparison.jpg" width="480" title="details">
</p>
## Performance
| Model | Test Size | Param. | FLOPs | F1 Score | AP<sub>50</sub><sup>val</sup> | AP<sub>50-95</sub><sup>val</sup> | Speed |
| :--: | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
| YOLOv8 | 640 | 43.61M | 164.9G | 0.59 | 62.44% | 40.32% | 3.6ms |
| YOLOv8+SA | 640 | 43.64M | 165.4G | 0.62 | 63.99% | 41.49% | 3.9ms |
| YOLOv8+ECA | 640 | 43.64M | 165.5G | 0.61 | 62.64% | 40.21% | 3.6ms |
| YOLOv8+GAM | 640 | 49.29M | 183.5G | 0.60 | 63.32% | 40.74% | 8.7ms |
| YOLOv8+ResGAM | 640 | 49.29M | 183.5G | 0.62 | 63.97% | 41.18% | 9.4ms |
| YOLOv8+ResCBAM | 640 | 53.87M | 196.2G | 0.62 | 62.95% | 40.10% | 4.1ms |
| **YOLOv9-C** | 640 | **51.02M** | **239.0G** | **0.64** | **65.31%** | **42.66%** | **5.2ms** |
| **YOLOv9-E** | 640 | **69.42M** | **244.9G** | **0.64** | **65.46%** | **43.32%** | **6.4ms** |
## Requirements
* Linux (Ubuntu)
* Python = 3.9
* Pytorch = 1.13.1
* NVIDIA GPU + CUDA CuDNN
## Environment
```
pip install -r requirements.txt
```
## Overall Flowchart
<p align="left">
<img src="img/figure_flowchart.jpg" width="1024" title="details">
</p>
## Dataset Split
* GRAZPEDWRI-DX Dataset [(Download Link)](https://figshare.com/articles/dataset/GRAZPEDWRI-DX/14825193)
* Download dataset and put images and annotatation into `./GRAZPEDWRI-DX_dataset/data/images`, `./GRAZPEDWRI-DX_dataset/data/labels`.
```
python split.py
```
* The dataset is divided into training, validation, and testing set (70-20-10 %) according to the key `patient_id` stored in `dataset.csv`.
* 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
│ │ └── ...
│ ├── valid
│ │ ├── valid_img1.png
│ │ └── ...
│ └── test
│ ├── test_img1.png
│ └── ...
└── labels
├── train
│ ├── train_annotation1.txt
│ └── ...
├── valid
│ ├── valid_annotation1.txt
│ └── ...
└── test
├── test_annotation1.txt
└── ...
The script will create 3 files: `train_data.csv`, `valid_data.csv`, and `test_data.csv` with the same structure of `dataset.csv`.
## Data Augmentation
* Data augmentation of the training set using the addWeighted function doubles the size of the training set.
```
python imgaug.py --input_img /path/to/input/train/ --output_img /path/to/output/train/ --input_label /path/to/input/labels/ --output_label /path/to/output/labels/
```
For example:
```
python imgaug.py --input_img ./GRAZPEDWRI-DX/data/images/train/ --output_img ./GRAZPEDWRI-DX/data/images/train_aug/ --input_label ./GRAZPEDWRI-DX/data/labels/train/ --output_label ./GRAZPEDWRI-DX/data/labels/train_aug/
```
* The path of the processed file is shown below:
GRAZPEDWRI-DX_dataset
└── data
├── images
│ ├── train
│ │ ├── train_img1.png
│ │ └── ...
│ ├── train_aug
│ │ ├── train_aug_img1.png
│ │ └── ...
│ ├── valid
│ │ ├── valid_img1.png
│ │ └── ...
│ └── test
│ ├── test_img1.png
│ └── ...
└── labels
├── train
│ ├── train_annotation1.txt
│ └── ...
├── train_aug
│ ├── train_aug_annotation1.txt
│ └── ...
├── valid
│ ├── valid_annotation1.txt
│ └── ...
└── test
├── test_annotation1.txt
└── ...
## Weights
If you plan to use pretrained models to train, you need put them into `./weights/`.
* You can get the YOLOv9 pretained models on the MS COCO 2017 Dataset through [YOLOv9 official GitHub](https://github.com/WongKinYiu/yolov9).
* Use gdown to download the trained model from our GitHub:
```
gdown https://github.com/RuiyangJu/YOLOv9-Fracture-Detection/releases/download/Trained/weights.zip
```
## Train & Validate
Before training the model, make sure the path to the data in the `./data/meta.yaml` file is correct.
* meta.yaml
```
# patch: /path/to/GRAZPEDWRI-DX/data
path: 'E:/GRAZPEDWRI-DX/data'
train: 'images/train_aug'
val: 'images/valid'
test: 'images/test'
```
* Arguments
| Key | Value | Description |
| :---: | :---: | :---: |
| workers | 8 | number of worker threads for data loading (per RANK if DDP) |
| device | None | device to run on, i.e. device=0,1,2,3 or device=cpu |
| model | None | path to model file, i.e. yolov8n.pt, yolov8n.yaml |
| batch | 16 | number of images per batch (-1 for AutoBatch) |
| data | None | path to data file, i.e. coco128.yaml |
| img | 640 | size of input images as integer, i.e. 640, 1024 |
| cfg | yolo.yaml | path to model.yaml, i.e. yolov9-c.yaml |
| weights | None | initial weights path |
| name | exp | save to project/name |
| hyp | data/hyps/hyp.scratch-high.yaml | hyperparameters path |
| epochs | 100 | number of epochs to train for |
* Example
```
python train_dual.py --workers 8 --device 0 --batch 16 --data data/meta.yaml --img 640 --cfg models/detect/yolov9-c.yaml --weights weights/yolov9-c.pt --name yolov9-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 100 --close-mosaic 15
```
没有合适的资源?快使用搜索试试~ 我知道了~
骨折检测-基于YOLOv9实现的X光图像中的手臂骨折检测算法-附项目源码-优质项目实战.zip
共89个文件
py:63个
yaml:7个
txt:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 179 浏览量
2024-05-08
16:19:28
上传
评论 1
收藏 4.61MB ZIP 举报
温馨提示
骨折检测_基于YOLOv9实现的X光图像中的手臂骨折检测算法_附项目源码_优质项目实战
资源推荐
资源详情
资源评论
收起资源包目录
骨折检测_基于YOLOv9实现的X光图像中的手臂骨折检测算法_附项目源码_优质项目实战.zip (89个子文件)
骨折检测_基于YOLOv9实现的X光图像中的手臂骨折检测算法_附项目源码_优质项目实战
train_triple.py 33KB
GRAZPEDWRI-DX
dataset.csv 1.76MB
valid_data.csv 380KB
train_data.csv 1.28MB
data
labels
train
0001_1297860395_01_WRI-L1_M014.txt 36B
valid
0004_0542630449_01_WRI-L1_M003.txt 36B
test
0020_0163123912_01_WRI-L1_M015.txt 35B
train_aug
aug_0001_1297860395_01_WRI-L1_M014.txt 36B
0001_1297860395_01_WRI-L1_M014.txt 36B
images
train
0001_1297860395_01_WRI-L1_M014.png 581KB
valid
0004_0542630449_01_WRI-L1_M003.png 572KB
test
0020_0163123912_01_WRI-L1_M015.png 997KB
train_aug
0001_1297860395_01_WRI-L1_M014.png 502KB
aug_0001_1297860395_01_WRI-L1_M014.png 534KB
test_data.csv 187KB
val_dual.py 19KB
split.py 3KB
data
meta.yaml 307B
coco.yaml 2KB
hyps
hyp.scratch-high.yaml 1KB
export.py 32KB
hubconf.py 5KB
utils
__init__.py 2KB
segment
__init__.py 6B
loss.py 9KB
augmentations.py 4KB
metrics.py 5KB
loss_tal_dual.py 35KB
general.py 5KB
tal
__init__.py 6B
assigner.py 8KB
anchor_generator.py 2KB
plots.py 6KB
loss_tal.py 12KB
dataloaders.py 14KB
loss.py 16KB
loggers
__init__.py 17KB
comet
__init__.py 18KB
optimizer_config.json 3KB
comet_utils.py 5KB
hpo.py 6KB
wandb
__init__.py 6B
sweep.yaml 2KB
log_dataset.py 1KB
sweep.py 1KB
wandb_utils.py 28KB
clearml
__init__.py 6B
clearml_utils.py 7KB
hpo.py 5KB
augmentations.py 17KB
metrics.py 16KB
lion.py 2KB
autoanchor.py 7KB
loss_tal_dual.py 18KB
general.py 46KB
tal
__init__.py 6B
assigner.py 8KB
anchor_generator.py 2KB
activations.py 3KB
downloads.py 4KB
plots.py 25KB
loss_tal_triple.py 13KB
loss_tal.py 9KB
callbacks.py 3KB
dataloaders.py 54KB
coco_utils.py 3KB
torch_utils.py 23KB
triton.py 3KB
autobatch.py 3KB
val_triple.py 19KB
val.py 19KB
train_dual.py 34KB
img
figure_flowchart.jpg 554KB
figure_comparison.jpg 478KB
imgaug.py 2KB
requirements.txt 1KB
models
__init__.py 6B
tf.py 26KB
common.py 53KB
detect
yolov9-e.yaml 3KB
yolov9-c.yaml 3KB
yolov9.yaml 3KB
experimental.py 11KB
yolo.py 38KB
detect.py 12KB
benchmarks.py 6KB
detect_dual.py 12KB
train.py 33KB
README.md 6KB
共 89 条
- 1
资源评论
极智视界
- 粉丝: 2w+
- 资源: 1562
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功