Skip to content

Commit ecdfa7e

Browse files
committed
add yolo11
1 parent b3be2d6 commit ecdfa7e

25 files changed

+827
-35
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The following is the corresponding `mindyolo` versions and supported `mindspore`
3131
See [Benchmark Results](benchmark_results.md).
3232

3333
## supported model list
34+
- [x] [YOLOv11](configs/yolov11)
3435
- [x] [YOLOv10](configs/yolov10)
3536
- [x] [YOLOv9](configs/yolov9)
3637
- [x] [YOLOv8](configs/yolov8)

configs/yolov11/README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# YOLOv11
2+
3+
## Abstract
4+
Ultralytics YOLO11 is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility. YOLO11 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection and tracking, instance segmentation, image classification and pose estimation tasks.
5+
6+
<div align=center>
7+
<img src="https://github.com/user-attachments/assets/10b2a1f7-b75c-40fe-8cc2-59e21c2d4d08"/>
8+
</div>
9+
10+
## Requirements
11+
12+
| mindspore | ascend driver | firmware | cann toolkit/kernel |
13+
| :-------: | :-----------: | :----------: |:-------------------:|
14+
| 2.5.0 | 24.1.0 | 7.5.0.3.220 | 8.0.0.beta1 |
15+
16+
## Quick Start
17+
18+
Please refer to the [GETTING_STARTED](https://github.com/mindspore-lab/mindyolo/blob/master/GETTING_STARTED.md) in MindYOLO for details.
19+
20+
### Training
21+
22+
<details open>
23+
<summary><b>View More</b></summary>
24+
25+
#### - Distributed Training
26+
27+
It is easy to reproduce the reported results with the pre-defined training recipe. For distributed training on multiple Ascend 910 devices, please run
28+
```shell
29+
# distributed training on multiple Ascend devices
30+
msrun --worker_num=3 --local_worker_num=3 --bind_core=True --log_dir=./yolov11_log python train.py --config ./configs/yolov11/yolov11-n.yaml --device_target Ascend --is_parallel True
31+
```
32+
33+
**Note:** For more information about msrun configuration, please refer to [here](https://www.mindspore.cn/tutorials/experts/zh-CN/r2.3.1/parallel/msrun_launcher.html).
34+
35+
For detailed illustration of all hyper-parameters, please refer to [config.py](https://github.com/mindspore-lab/mindyolo/blob/master/mindyolo/utils/config.py).
36+
37+
**Note:** As the global batch size (batch_size x num_devices) is an important hyper-parameter, it is recommended to keep the global batch size unchanged for reproduction or adjust the learning rate linearly to a new global batch size.
38+
39+
#### - Standalone Training
40+
41+
If you want to train or finetune the model on a smaller dataset without distributed training, please run:
42+
43+
```shell
44+
# standalone training on a CPU/Ascend device
45+
python train.py --config ./configs/yolov11/yolov11-n.yaml --device_target Ascend
46+
```
47+
48+
</details>
49+
50+
### Validation and Test
51+
52+
To validate the accuracy of the trained model, you can use `test.py` and parse the checkpoint path with `--weight`.
53+
54+
```
55+
python test.py --config ./configs/yolov11/yolov11-n.yaml --device_target Ascend --weight /PATH/TO/WEIGHT.ckpt
56+
```
57+
58+
## Performance
59+
60+
61+
### Detection
62+
63+
Experiments are tested on Ascend 910* with mindspore 2.5.0 graph mode.
64+
65+
| model name | scale | cards | batch size | resolution | jit level | ms/step | img/s | map | recipe | weight |
66+
| :--------: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |:-----:| :---: |:----------------------------------------------------------------------------------------------------:|
67+
| YOLOv11 | N | 1 | 128 | 640x640 | O2 | 383.78 | 333.52 | 39.2% | [yaml](./yolov11-n.yaml) | [weights](https://download.mindspore.cn/toolkits/mindyolo/yolov11/yolov11n_600e_MAP392-78fd292c.ckpt) |
68+
| YOLOv11 | S | 1 | 128 | 640x640 | O2 | 488.65 | 261.95 | 46.4% | [yaml](./yolov11-s.yaml) | [weights](https://download.mindspore.cn/toolkits/mindyolo/yolov11/yolov11s_600e_MAP464-26f6efa4.ckpt) |
69+
| YOLOv11 | M | 1 | 108 | 640x640 | O2 | 721.72 | 149.64 | 51.1% | [yaml](./yolov11-m.yaml) | [weights](https://download.mindspore.cn/toolkits/mindyolo/yolov11/yolov11m_600e_MAP511-94a7cf04.ckpt) |
70+
| YOLOv11 | L | 2 | 64 | 640x640 | O2 | 637.84 | 200.68 | 52.6% | [yaml](./yolov11-l.yaml) | [weights](https://download.mindspore.cn/toolkits/mindyolo/yolov11/yolov11l_600e_MAP526-48494760.ckpt) |
71+
| YOLOv11 | X | 3 | 43 | 640x640 | O2 | 622.68 | 207.17 | 54.2% | [yaml](./yolov11-x.yaml) | [weights](https://download.mindspore.cn/toolkits/mindyolo/yolov11/yolov11x_600e_MAP542-19131881.ckpt) |
72+
73+
### Notes
74+
75+
- map: Accuracy reported on the validation set.
76+
- When using 8 cards and 16 batch size for training, the total training time will be significantly reduced, but the accuracy may slightly decrease. Based on testing, the accuracy for both the n and x specifications has dropped by 0.3%.
77+
- We refer to the official [YOLOV11](https://github.com/ultralytics/ultralytics) to reproduce the P5 series model.
78+
79+
## References
80+
81+
<!--- Guideline: Citation format should follow GB/T 7714. -->
82+
[1] Jocher Glenn. Ultralytics YOLOv11. https://github.com/ultralytics/ultralytics, 2024.

configs/yolov11/hyp.scratch.l.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
data:
2+
num_parallel_workers: 16
3+
4+
# multi-stage data augment
5+
train_transforms: {
6+
stage_epochs: [ 590, 10 ],
7+
trans_list: [
8+
[
9+
{ func_name: mosaic, prob: 1.0 },
10+
{ func_name: copy_paste, prob: 0.5, sorted: True },
11+
{func_name: resample_segments},
12+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 },
13+
{ func_name: mixup, alpha: 32.0, beta: 32.0, prob: 0.15, pre_transform: [
14+
{ func_name: mosaic, prob: 1.0 },
15+
{ func_name: copy_paste, prob: 0.5, sorted: True },
16+
{ func_name: resample_segments },
17+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 }, ]
18+
},
19+
{func_name: albumentations},
20+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
21+
{func_name: fliplr, prob: 0.5},
22+
{func_name: label_norm, xyxy2xywh_: True},
23+
{func_name: label_pad, padding_size: 160, padding_value: -1},
24+
{func_name: image_norm, scale: 255.},
25+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
26+
],
27+
[
28+
{func_name: letterbox, scaleup: True},
29+
{func_name: resample_segments},
30+
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0},
31+
{func_name: albumentations},
32+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
33+
{func_name: fliplr, prob: 0.5},
34+
{func_name: label_norm, xyxy2xywh_: True},
35+
{func_name: label_pad, padding_size: 160, padding_value: -1},
36+
{func_name: image_norm, scale: 255.},
37+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
38+
]]
39+
}
40+
41+
test_transforms: [
42+
{func_name: letterbox, scaleup: False, only_image: True},
43+
{func_name: image_norm, scale: 255.},
44+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
45+
]

configs/yolov11/hyp.scratch.m.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
data:
2+
num_parallel_workers: 16
3+
4+
# multi-stage data augment
5+
train_transforms: {
6+
stage_epochs: [ 590, 10 ],
7+
trans_list: [
8+
[
9+
{ func_name: mosaic, prob: 1.0 },
10+
{ func_name: copy_paste, prob: 0.4, sorted: True },
11+
{func_name: resample_segments},
12+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 },
13+
{ func_name: mixup, alpha: 32.0, beta: 32.0, prob: 0.15, pre_transform: [
14+
{ func_name: mosaic, prob: 1.0 },
15+
{ func_name: copy_paste, prob: 0.4, sorted: True },
16+
{ func_name: resample_segments },
17+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 }, ]
18+
},
19+
{func_name: albumentations},
20+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
21+
{func_name: fliplr, prob: 0.5},
22+
{func_name: label_norm, xyxy2xywh_: True},
23+
{func_name: label_pad, padding_size: 160, padding_value: -1},
24+
{func_name: image_norm, scale: 255.},
25+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
26+
],
27+
[
28+
{func_name: letterbox, scaleup: True},
29+
{func_name: resample_segments},
30+
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0},
31+
{func_name: albumentations},
32+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
33+
{func_name: fliplr, prob: 0.5},
34+
{func_name: label_norm, xyxy2xywh_: True},
35+
{func_name: label_pad, padding_size: 160, padding_value: -1},
36+
{func_name: image_norm, scale: 255.},
37+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
38+
]]
39+
}
40+
41+
test_transforms: [
42+
{func_name: letterbox, scaleup: False, only_image: True},
43+
{func_name: image_norm, scale: 255.},
44+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
45+
]

configs/yolov11/hyp.scratch.n.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
data:
2+
num_parallel_workers: 16
3+
4+
# multi-stage data augment
5+
train_transforms: {
6+
stage_epochs: [ 590, 10 ],
7+
trans_list: [
8+
[
9+
{ func_name: mosaic, prob: 1.0 },
10+
{ func_name: copy_paste, prob: 0.1, sorted: True },
11+
{func_name: resample_segments},
12+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.5, shear: 0.0 },
13+
{func_name: albumentations},
14+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
15+
{func_name: fliplr, prob: 0.5},
16+
{func_name: label_norm, xyxy2xywh_: True},
17+
{func_name: label_pad, padding_size: 160, padding_value: -1},
18+
{func_name: image_norm, scale: 255.},
19+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
20+
],
21+
[
22+
{func_name: letterbox, scaleup: True},
23+
{func_name: resample_segments},
24+
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.5, shear: 0.0},
25+
{func_name: albumentations},
26+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
27+
{func_name: fliplr, prob: 0.5},
28+
{func_name: label_norm, xyxy2xywh_: True},
29+
{func_name: label_pad, padding_size: 160, padding_value: -1},
30+
{func_name: image_norm, scale: 255.},
31+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
32+
]]
33+
}
34+
35+
test_transforms: [
36+
{func_name: letterbox, scaleup: False, only_image: True},
37+
{func_name: image_norm, scale: 255.},
38+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
39+
]

configs/yolov11/hyp.scratch.s.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
data:
2+
num_parallel_workers: 16
3+
4+
# multi-stage data augment
5+
train_transforms: {
6+
stage_epochs: [ 590, 10 ],
7+
trans_list: [
8+
[
9+
{ func_name: mosaic, prob: 1.0 },
10+
{ func_name: copy_paste, prob: 0.15, sorted: True },
11+
{func_name: resample_segments},
12+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 },
13+
{ func_name: mixup, alpha: 32.0, beta: 32.0, prob: 0.05, pre_transform: [
14+
{ func_name: mosaic, prob: 1.0 },
15+
{ func_name: copy_paste, prob: 0.15, sorted: True },
16+
{ func_name: resample_segments },
17+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 }, ]
18+
},
19+
{func_name: albumentations},
20+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
21+
{func_name: fliplr, prob: 0.5},
22+
{func_name: label_norm, xyxy2xywh_: True},
23+
{func_name: label_pad, padding_size: 160, padding_value: -1},
24+
{func_name: image_norm, scale: 255.},
25+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
26+
],
27+
[
28+
{func_name: letterbox, scaleup: True},
29+
{func_name: resample_segments},
30+
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0},
31+
{func_name: albumentations},
32+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
33+
{func_name: fliplr, prob: 0.5},
34+
{func_name: label_norm, xyxy2xywh_: True},
35+
{func_name: label_pad, padding_size: 160, padding_value: -1},
36+
{func_name: image_norm, scale: 255.},
37+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
38+
]]
39+
}
40+
41+
test_transforms: [
42+
{func_name: letterbox, scaleup: False, only_image: True},
43+
{func_name: image_norm, scale: 255.},
44+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
45+
]

configs/yolov11/hyp.scratch.x.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
data:
2+
num_parallel_workers: 16
3+
4+
# multi-stage data augment
5+
train_transforms: {
6+
stage_epochs: [ 590, 10 ],
7+
trans_list: [
8+
[
9+
{ func_name: mosaic, prob: 1.0 },
10+
{ func_name: copy_paste, prob: 0.6, sorted: True },
11+
{func_name: resample_segments},
12+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 },
13+
{ func_name: mixup, alpha: 32.0, beta: 32.0, prob: 0.2, pre_transform: [
14+
{ func_name: mosaic, prob: 1.0 },
15+
{ func_name: copy_paste, prob: 0.6, sorted: True },
16+
{ func_name: resample_segments },
17+
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 }, ]
18+
},
19+
{func_name: albumentations},
20+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
21+
{func_name: fliplr, prob: 0.5},
22+
{func_name: label_norm, xyxy2xywh_: True},
23+
{func_name: label_pad, padding_size: 160, padding_value: -1},
24+
{func_name: image_norm, scale: 255.},
25+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
26+
],
27+
[
28+
{func_name: letterbox, scaleup: True},
29+
{func_name: resample_segments},
30+
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0},
31+
{func_name: albumentations},
32+
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4},
33+
{func_name: fliplr, prob: 0.5},
34+
{func_name: label_norm, xyxy2xywh_: True},
35+
{func_name: label_pad, padding_size: 160, padding_value: -1},
36+
{func_name: image_norm, scale: 255.},
37+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
38+
]]
39+
}
40+
41+
test_transforms: [
42+
{func_name: letterbox, scaleup: False, only_image: True},
43+
{func_name: image_norm, scale: 255.},
44+
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True}
45+
]

configs/yolov11/yolov11-base.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
epochs: 600 # total train epochs
2+
per_batch_size: 128
3+
img_size: 640
4+
iou_thres: 0.7
5+
conf_free: True
6+
clip_grad: True
7+
ms_loss_scaler: dynamic
8+
ms_loss_scaler_value: 65536.0
9+
overflow_still_update: False
10+
ms_amp_level: O2
11+
sync_bn: False
12+
anchor_base: False
13+
opencv_threads_num: 0 # opencv: disable threading optimizations
14+
15+
optimizer:
16+
optimizer: momentum
17+
lr_init: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
18+
momentum: 0.937 # SGD momentum/Adam beta1
19+
nesterov: True # update gradients with NAG(Nesterov Accelerated Gradient) algorithm
20+
loss_scale: 1.0 # loss scale for optimizer
21+
warmup_epochs: 3 # warmup epochs (fractions ok)
22+
warmup_momentum: 0.8 # warmup initial momentum
23+
warmup_bias_lr: 0.0 # warmup initial bias lr
24+
min_warmup_step: 1000 # minimum warmup step
25+
group_param: yolov8 # group param strategy
26+
gp_weight_decay: 0.0005 # group param weight decay 5e-4
27+
start_factor: 1.0
28+
end_factor: 0.01
29+
30+
loss:
31+
name: YOLOv11Loss
32+
box: 7.5 # box loss gain
33+
cls: 0.5 # cls loss gain
34+
dfl: 1.5 # dfl loss gain
35+
reg_max: 16
36+
37+
network:
38+
model_name: yolov11
39+
nc: 80 # number of classes
40+
reg_max: 16
41+
42+
stride: [8, 16, 32]
43+
44+
# YOLOv8.0n backbone
45+
backbone:
46+
# [from, repeats, module, args]
47+
- [-1, 1, ConvNormAct, [64, 3, 2]] # 0-P1/2
48+
- [-1, 1, ConvNormAct, [128, 3, 2]] # 1-P2/4
49+
- [-1, 2, C3k2, [256, False, 0.25]]
50+
- [-1, 1, ConvNormAct, [256, 3, 2]] # 3-P3/8
51+
- [-1, 2, C3k2, [512, False, 0.25]]
52+
- [-1, 1, ConvNormAct, [512, 3, 2]] # 5-P4/16
53+
- [-1, 2, C3k2, [512, True]]
54+
- [-1, 1, ConvNormAct, [1024, 3, 2]] # 7-P5/32
55+
- [-1, 2, C3k2, [1024, True]]
56+
- [-1, 1, SPPF, [1024, 5]] # 9
57+
- [-1, 2, C2PSA, [1024]] # 10
58+
59+
# YOLO11n head
60+
head:
61+
- [-1, 1, Upsample, [None, 2, 'nearest']]
62+
- [[-1, 6], 1, Concat, [1]] # cat backbone P4
63+
- [-1, 2, C3k2, [512, False]] # 13
64+
65+
- [-1, 1, Upsample, [None, 2, 'nearest']]
66+
- [[-1, 4], 1, Concat, [1] ] # cat backbone P3
67+
- [-1, 2, C3k2, [256, False]] # 16 (P3/8-small)
68+
69+
- [-1, 1, ConvNormAct, [256, 3, 2]]
70+
- [[ -1, 13], 1, Concat, [1]] # cat head P4
71+
- [-1, 2, C3k2, [512, False]] # 19 (P4/16-medium)
72+
73+
- [-1, 1, ConvNormAct, [512, 3, 2]]
74+
- [[-1, 10], 1, Concat, [1]] # cat head P5
75+
- [-1, 2, C3k2, [1024, True]] # 22 (P5/32-large)
76+
77+
- [[16, 19, 22], 1, YOLOv11Head, [nc, reg_max, stride]] # Detect(P3, P4, P5)

0 commit comments

Comments
 (0)