锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

关于yolov7的遗传算法进化训练

时间:2022-12-11 09:00:00 三极管lrf2807

最近yolov7刚出来,打算试一波,测量速度和精度。研究了一些代码,发现大部分都延续了yolov5风格,加上yolov6的部分内容和一些才开源sota的算法。
在这里插入图片描述
论文链接:

https://arxiv.org/pdf/2207.02696.pdf 

代码链接:

https://github.com/WongKinYiu/yolov7 

据网上消息:YOLOv7相同体积下比YOLOv5精度高,速度快120%(FPS),比YOLOX快180%(FPS),比Dual-Swin-T快1200%(FPS),比ConvNext快550%(FPS),比SWIN-L快500%(FPS)。
所有的训练方法、测试方法和配置文件一般都与yolov5类似。
以下是遗传算法的超参数训练。准备好数据集后,遗传训练发现有错误,找不到。anchors这只需要加载你hyp添加一个添加一个anchors还有相应的加值。
但是改完之后就找不到了。copy_past’以及’paste_in,主训练函数需要meta做以下修改:

# Hyperparameter evolution metadata (mutation scale 0-1, lower_limit, upper_limit)     meta = {'lr0': (1, 1e-5, 1e-1),  # initial learning rate (SGD=1E-2, Adam=1E-3)             'lrf': (1, 0.01, 1.0),  # final OneCycleLR learning rate (lr0 * lrf)             'momentum': (0.3, 0.6, 0.98),  # SGD momentum/Adam beta1             'weight_decay': (1, 0.0, 0.001),  # optimizer weight decay             'warmup_epochs': (1, 0.0, 5.0),  # warmup epochs (fractions ok)             'warmup_momentum': (1, 0.0, 0.95),  # warmup initial momentum             'warmup_bias_lr': (1, 0.0, 0.2),  # warmup initial bias lr             'box': (1, 0.02, 0.2),  # box loss gain             'cls': (1, 0.2, 4.0),  # cls loss gain             'cls_pw': (1, 0.5, 2.0),  # cls BCELoss positive_weight             'obj': (1, 0.2, 4.0),  # obj loss gain (scale with pixels)             'obj_pw': (1, 0.5, 2.0),  # obj BCELoss positive_weight             'iou_t': (0, 0.1, 0.7),  # IoU training threshold             'anchor_t': (1, 2.0, 8.0),  # anchor-multiple threshold             'anchors': (2, 2.0, 10.0),  # anchors per output grid (0 to ignore)             'fl_gamma': (0, 0.0, 2.0),  # focal loss gamma (efficientDet default gamma=1.5)             'hsv_h': (1, 0.0, 0.1),  # image HSV-Hue augmentation (fraction)             'hsv_s': (1, 0.0, 0.9),  # image HSV-Saturation augmentation (fraction)             'hsv_v': (1, 0.0, 0.9),  # image HSV-Value augmentation (fraction)             'degrees': (1, 0.0, 45.0),  # image rotation ( /- deg)             'translate': (1, 0.0, 0.9),  # image translation ( /- fraction)             'scale': (1, 0.0, 0.9),  # image scale ( /- gain)             'shear': (1, 0.0, 10.0),  # image shear ( /- deg)             'perspective': (0, 0.0, 0.001),  # image perspective ( /- fraction), range 0-0.001             'flipud': (1, 0.0, 1.0),  # image flip up-down (probability)             'fliplr': (0, 0.0, 1.0),  # image flip left-right (probability)             'mosaic': (1, 0.0, 1.0),  # image mixup (probability)             'mixup': (1, 0.0, 1.0),             'copy_paste': (1, 0.0, 1.0),             'paste_in': (1, 0.15, 1.0)               }  # image mixup (probability) 

遗传进化可在修改后进行。
以下是100多轮样本的进化结果:

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章