Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
commit
  • Loading branch information
TomatoAndCucumber committed Jun 13, 2022
commit bc4386c8edd189e14d8a9ead7a0673b46f207242
1 change: 0 additions & 1 deletion VOCdevkit/VOC2007/Annotations/README.md

This file was deleted.

1 change: 0 additions & 1 deletion VOCdevkit/VOC2007/JPEGImages/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion get_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#-------------------------------------------------------#
map_out_path = 'map_out'

image_ids = open(os.path.join(VOCdevkit_path, "VOC2007/ImageSets/Main/test.txt")).read().strip().split()
image_ids = open(os.path.join(VOCdevkit_path, "VOC2007/ImageSets/Main/train.txt")).read().strip().split()

if not os.path.exists(map_out_path):
os.makedirs(map_out_path)
Expand Down
1 change: 0 additions & 1 deletion logs/README.md

This file was deleted.

9 changes: 5 additions & 4 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
# 判断当前batch_size,自适应调整学习率
#-------------------------------------------------------------------#
nbs = 64
lr_limit_max = 1e-3 if optimizer_type == 'adam' else 5e-2
lr_limit_min = 3e-4 if optimizer_type == 'adam' else 5e-4
lr_limit_max = 1e-3 if optimizer_type == ['adam','adamw'] else 5e-2
lr_limit_min = 3e-4 if optimizer_type == ['adam','adamw'] else 5e-4
Init_lr_fit = min(max(batch_size / nbs * Init_lr, lr_limit_min), lr_limit_max)
Min_lr_fit = min(max(batch_size / nbs * Min_lr, lr_limit_min * 1e-2), lr_limit_max * 1e-2)

Expand All @@ -434,6 +434,7 @@
pg1.append(v.weight)
optimizer = {
'adam' : optim.Adam(pg0, Init_lr_fit, betas = (momentum, 0.999)),
'adamw': optim.AdamW(pg0, Init_lr_fit, betas=(momentum, 0.999)),
'sgd' : optim.SGD(pg0, Init_lr_fit, momentum = momentum, nesterov=True)
}[optimizer_type]
optimizer.add_param_group({"params": pg1, "weight_decay": weight_decay})
Expand Down Expand Up @@ -501,8 +502,8 @@
# 判断当前batch_size,自适应调整学习率
#-------------------------------------------------------------------#
nbs = 64
lr_limit_max = 1e-3 if optimizer_type == 'adam' else 5e-2
lr_limit_min = 3e-4 if optimizer_type == 'adam' else 5e-4
lr_limit_max = 1e-3 if optimizer_type == ['adam', 'adamw'] else 5e-2
lr_limit_min = 3e-4 if optimizer_type == ['adam', 'adamw'] else 5e-4
Init_lr_fit = min(max(batch_size / nbs * Init_lr, lr_limit_min), lr_limit_max)
Min_lr_fit = min(max(batch_size / nbs * Min_lr, lr_limit_min * 1e-2), lr_limit_max * 1e-2)
#---------------------------------------#
Expand Down
8 changes: 4 additions & 4 deletions yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class YOLO(object):
# 验证集损失较低不代表mAP较高,仅代表该权值在验证集上泛化性能较好。
# 如果出现shape不匹配,同时要注意训练时的model_path和classes_path参数的修改
#--------------------------------------------------------------------------#
"model_path" : 'model_data/yolov5_s.pth',
"classes_path" : 'model_data/coco_classes.txt',
"model_path" : 'logs\ep1000-loss0.136-val_loss0.149.pth',
"classes_path" : 'model_data/voc_classes.txt',
#---------------------------------------------------------------------#
# anchors_path代表先验框对应的txt文件,一般不修改。
# anchors_mask用于帮助代码找到对应的先验框,一般不修改。
Expand All @@ -36,7 +36,7 @@ class YOLO(object):
#---------------------------------------------------------------------#
# 输入图片的大小,必须为32的倍数。
#---------------------------------------------------------------------#
"input_shape" : [640, 640],
"input_shape" : [224, 224],
#------------------------------------------------------#
# backbone cspdarknet(默认)
# convnext_tiny
Expand All @@ -48,7 +48,7 @@ class YOLO(object):
# 所使用的YoloV5的版本。s、m、l、x
# 在除cspdarknet的其它主干中仅影响panet的大小
#------------------------------------------------------#
"phi" : 's',
"phi" : 'l',
#---------------------------------------------------------------------#
# 只有得分大于置信度的预测框会被保留下来
#---------------------------------------------------------------------#
Expand Down