-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add YOLOv8x Segmentation #196
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
epochs: 300 # total train epochs | ||
|
||
optimizer: | ||
optimizer: momentum | ||
lr_init: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3) | ||
momentum: 0.937 # SGD momentum/Adam beta1 | ||
nesterov: True # update gradients with NAG(Nesterov Accelerated Gradient) algorithm | ||
loss_scale: 1.0 # loss scale for optimizer | ||
warmup_epochs: 3 # warmup epochs (fractions ok) | ||
warmup_momentum: 0.8 # warmup initial momentum | ||
warmup_bias_lr: 0.1 # warmup initial bias lr | ||
min_warmup_step: 1000 # minimum warmup step | ||
group_param: yolov8 # group param strategy | ||
gp_weight_decay: 0.0010078125 # group param weight decay 5e-4 | ||
start_factor: 1.0 | ||
end_factor: 0.01 | ||
|
||
loss: | ||
name: YOLOv8SegLoss | ||
box: 7.5 # box loss gain | ||
cls: 0.5 # cls loss gain | ||
dfl: 1.5 # dfl loss gain | ||
reg_max: 16 | ||
nm: 32 | ||
overlap: True | ||
max_object_num: 600 | ||
|
||
data: | ||
num_parallel_workers: 4 | ||
|
||
train_transforms: { | ||
stage_epochs: [ 290, 10 ], | ||
trans_list: [ | ||
[ | ||
{func_name: resample_segments}, | ||
{func_name: mosaic, prob: 1.0}, | ||
{func_name: copy_paste, prob: 0.3}, | ||
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0}, | ||
{func_name: mixup, alpha: 32.0, beta: 32.0, prob: 0.15, pre_transform: [ | ||
{ func_name: resample_segments }, | ||
{ func_name: mosaic, prob: 1.0 }, | ||
{ func_name: copy_paste, prob: 0.3 }, | ||
{ func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 },] | ||
}, | ||
{func_name: albumentations, random_resized_crop: False}, # random_resized_crop not support seg task | ||
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4 }, | ||
{func_name: fliplr, prob: 0.5 }, | ||
{func_name: segment_poly2mask, mask_overlap: True, mask_ratio: 4 }, | ||
{func_name: label_norm, xyxy2xywh_: True }, | ||
{func_name: label_pad, padding_size: 160, padding_value: -1 }, | ||
{func_name: image_norm, scale: 255. }, | ||
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True } | ||
], | ||
[ | ||
{func_name: resample_segments}, | ||
{func_name: letterbox, scaleup: True }, | ||
{func_name: random_perspective, prob: 1.0, degrees: 0.0, translate: 0.1, scale: 0.9, shear: 0.0 }, | ||
{func_name: albumentations, random_resized_crop: False}, # random_resized_crop not support seg task | ||
{func_name: hsv_augment, prob: 1.0, hgain: 0.015, sgain: 0.7, vgain: 0.4 }, | ||
{func_name: fliplr, prob: 0.5 }, | ||
{func_name: segment_poly2mask, mask_overlap: True, mask_ratio: 4 }, | ||
{func_name: label_norm, xyxy2xywh_: True }, | ||
{func_name: label_pad, padding_size: 160, padding_value: -1 }, | ||
{func_name: image_norm, scale: 255. }, | ||
{func_name: image_transpose, bgr2rgb: True, hwc2chw: True } | ||
]] | ||
} | ||
|
||
test_transforms: [ | ||
{ func_name: letterbox, scaleup: False }, | ||
{ func_name: image_norm, scale: 255. }, | ||
{ func_name: image_transpose, bgr2rgb: True, hwc2chw: True } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
task: segment | ||
epochs: 500 # total train epochs | ||
per_batch_size: 16 # 16 * 8 = 128 | ||
img_size: 640 | ||
iou_thres: 0.7 | ||
conf_free: True | ||
sync_bn: True | ||
opencv_threads_num: 0 # opencv: disable threading optimizations | ||
|
||
network: | ||
model_name: yolov8 | ||
nc: 80 # number of classes | ||
reg_max: 16 | ||
|
||
stride: [8, 16, 32] | ||
|
||
# YOLOv8.0n backbone | ||
backbone: | ||
# [from, repeats, module, args] | ||
- [-1, 1, ConvNormAct, [64, 3, 2]] # 0-P1/2 | ||
- [-1, 1, ConvNormAct, [128, 3, 2]] # 1-P2/4 | ||
- [-1, 3, C2f, [128, True]] | ||
- [-1, 1, ConvNormAct, [256, 3, 2]] # 3-P3/8 | ||
- [-1, 6, C2f, [256, True]] | ||
- [-1, 1, ConvNormAct, [512, 3, 2]] # 5-P4/16 | ||
- [-1, 6, C2f, [512, True]] | ||
- [-1, 1, ConvNormAct, [1024, 3, 2]] # 7-P5/32 | ||
- [-1, 3, C2f, [1024, True]] | ||
- [-1, 1, SPPF, [1024, 5]] # 9 | ||
|
||
# YOLOv8.0n head | ||
head: | ||
- [-1, 1, Upsample, [None, 2, 'nearest']] | ||
- [[-1, 6], 1, Concat, [1]] # cat backbone P4 | ||
- [-1, 3, C2f, [512]] # 12 | ||
|
||
- [-1, 1, Upsample, [None, 2, 'nearest']] | ||
- [[-1, 4], 1, Concat, [1] ] # cat backbone P3 | ||
- [-1, 3, C2f, [256]] # 15 (P3/8-small) | ||
|
||
- [-1, 1, ConvNormAct, [256, 3, 2]] | ||
- [[ -1, 12], 1, Concat, [1]] # cat head P4 | ||
- [-1, 3, C2f, [512]] # 18 (P4/16-medium) | ||
|
||
- [-1, 1, ConvNormAct, [512, 3, 2]] | ||
- [[-1, 9], 1, Concat, [1]] # cat head P5 | ||
- [-1, 3, C2f, [1024]] # 21 (P5/32-large) | ||
|
||
- [[15, 18, 21], 1, YOLOv8Head, [nc, reg_max, stride]] # Detect(P3, P4, P5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
__BASE__: [ | ||
'../../coco.yaml', | ||
'./hyp.scratch.high.seg.yaml', | ||
'./yolov8-seg-base.yaml' | ||
] | ||
|
||
recompute: True | ||
recompute_layers: 2 | ||
|
||
network: | ||
depth_multiple: 1.00 # scales module repeats | ||
width_multiple: 1.25 # scales convolution channels | ||
max_channels: 512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick start里也加下segment的说明
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seg task兼容原有启动方式,用户通过指定不同.yaml文件来选择不同的task