Yolo轻量级网络,超轻算法在各硬件可实现工业级检测效果(附源代码)

2022-01-27 20:27:47 浏览数 (1)

计算机视觉研究院专栏

作者:Edison_G

目标检测是现在最热门的研究课题,也一直是工业界重点研究的对象,最近几年内,也出现了各种各样的检测框架,所属于YOLO系列是最经典也是目前被大家认可使用的检测框架。不论是PyTorch,还是Tensorflow,又或者是Keras和Caffe,可以说是全平台通用

Yolo-Fastest开源代码:https://github.com/dog-qiuqiu/Yolo-Fastest

1

前言&背景

目标检测是现在最热门的研究课题,也一直是工业界重点研究的对象,最近几年内,也出现了各种各样的检测框架,所属于YOLO系列是最经典也是目前被大家认可使用的检测框架。

今天说的这个系列模型,模型非常小、目前最快的YOLO算法——大小只有1.4MB,单核每秒148帧,在一些移动设备上部署特别容易。具体测试效果如下:

2

框架介绍

简单使用了下Yolo-Fastest,感觉不是很习惯使用了,可能好就不用darknet框架,但是上手还是比较容易,github也有简单教程:

测试Demo的方式也有:

Demo on image input

代码语言:javascript复制
# *Note: change .data , .cfg , .weights and input image file in image_yolov3.sh for Yolo-Fastest-x1, Yolov3 and Yolov4
sh image_yolov3.sh

Demo on video input

代码语言:javascript复制
# *Note: Use any input video and place in the data folder or use 0 in the video_yolov3.sh for webcam
# *Note: change .data , .cfg , .weights and input video file in video_yolov3.sh for Yolo-Fastest-x1, Yolov3 and Yolov4
sh video_yolov3.sh
  • 中文介绍:https://zhuanlan.zhihu.com/p/234506503
  • 与AlexeyAB/darknet相比,此版本darknet修复了一些老架构GPU中分组卷积推理异常耗时的问题(例如1050ti:40ms->4ms加速10倍),强烈推荐使用这个 训练模型的仓库框架
  • Darknet CPU推理效率优化不好,不推荐使用Darknet作为CPU端推理框架,推荐使用ncnn

自己尝试使用了下,确实darknet不是很友好,下次我试试NCNN的效果。下面是网络的参数:

代码语言:javascript复制
Input                    data                     0 1 data -23330=4,3,320,320,3 0=320 1=320 2=3
Convolution              0_22                     1 1 data 0_22_bn_leaky -23330=4,3,160,160,8 0=8 1=3 3=2 4=1 5=1 6=216 9=2 -23310=1,1.000000e-01
Convolution              1_31                     1 1 0_22_bn_leaky 1_31_bn_leaky -23330=4,3,160,160,8 0=8 1=1 5=1 6=64 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     2_39                     1 1 1_31_bn_leaky 2_39_bn_leaky -23330=4,3,160,160,8 0=8 1=3 4=1 5=1 6=72 7=8 9=2 -23310=1,1.000000e-01
Convolution              3_48                     1 1 2_39_bn_leaky 3_48_bn -23330=4,3,160,160,4 0=4 1=1 5=1 6=32
Split                    3_48_bn_split            1 2 3_48_bn 3_48_bn_split_0 3_48_bn_split_1 -23330=8,3,160,160,4,3,160,160,4
Convolution              4_57                     1 1 3_48_bn_split_0 4_57_bn_leaky -23330=4,3,160,160,8 0=8 1=1 5=1 6=32 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     5_65                     1 1 4_57_bn_leaky 5_65_bn_leaky -23330=4,3,160,160,8 0=8 1=3 4=1 5=1 6=72 7=8 9=2 -23310=1,1.000000e-01
Convolution              6_74                     1 1 5_65_bn_leaky 6_74_bn -23330=4,3,160,160,4 0=4 1=1 5=1 6=32
Eltwise                  8_86                     2 1 6_74_bn 3_48_bn_split_1 8_86 -23330=4,3,160,160,4 0=1
Convolution              9_90                     1 1 8_86 9_90_bn_leaky -23330=4,3,160,160,24 0=24 1=1 5=1 6=96 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     10_98                    1 1 9_90_bn_leaky 10_98_bn_leaky -23330=4,3,80,80,24 0=24 1=3 3=2 4=1 5=1 6=216 7=24 9=2 -23310=1,1.000000e-01
Convolution              11_107                   1 1 10_98_bn_leaky 11_107_bn -23330=4,3,80,80,8 0=8 1=1 5=1 6=192
Split                    11_107_bn_split          1 2 11_107_bn 11_107_bn_split_0 11_107_bn_split_1 -23330=8,3,80,80,8,3,80,80,8
Convolution              12_116                   1 1 11_107_bn_split_0 12_116_bn_leaky -23330=4,3,80,80,32 0=32 1=1 5=1 6=256 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     13_124                   1 1 12_116_bn_leaky 13_124_bn_leaky -23330=4,3,80,80,32 0=32 1=3 4=1 5=1 6=288 7=32 9=2 -23310=1,1.000000e-01
Convolution              14_133                   1 1 13_124_bn_leaky 14_133_bn -23330=4,3,80,80,8 0=8 1=1 5=1 6=256
Eltwise                  16_145                   2 1 14_133_bn 11_107_bn_split_1 16_145 -23330=4,3,80,80,8 0=1
Split                    16_145_split             1 2 16_145 16_145_split_0 16_145_split_1 -23330=8,3,80,80,8,3,80,80,8
Convolution              17_149                   1 1 16_145_split_0 17_149_bn_leaky -23330=4,3,80,80,32 0=32 1=1 5=1 6=256 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     18_157                   1 1 17_149_bn_leaky 18_157_bn_leaky -23330=4,3,80,80,32 0=32 1=3 4=1 5=1 6=288 7=32 9=2 -23310=1,1.000000e-01
Convolution              19_166                   1 1 18_157_bn_leaky 19_166_bn -23330=4,3,80,80,8 0=8 1=1 5=1 6=256
Eltwise                  21_179                   2 1 19_166_bn 16_145_split_1 21_179 -23330=4,3,80,80,8 0=1
Convolution              22_183                   1 1 21_179 22_183_bn_leaky -23330=4,3,80,80,32 0=32 1=1 5=1 6=256 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     23_191                   1 1 22_183_bn_leaky 23_191_bn_leaky -23330=4,3,40,40,32 0=32 1=3 3=2 4=1 5=1 6=288 7=32 9=2 -23310=1,1.000000e-01
Convolution              24_200                   1 1 23_191_bn_leaky 24_200_bn -23330=4,3,40,40,8 0=8 1=1 5=1 6=256
Split                    24_200_bn_split          1 2 24_200_bn 24_200_bn_split_0 24_200_bn_split_1 -23330=8,3,40,40,8,3,40,40,8
Convolution              25_209                   1 1 24_200_bn_split_0 25_209_bn_leaky -23330=4,3,40,40,48 0=48 1=1 5=1 6=384 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     26_217                   1 1 25_209_bn_leaky 26_217_bn_leaky -23330=4,3,40,40,48 0=48 1=3 4=1 5=1 6=432 7=48 9=2 -23310=1,1.000000e-01
Convolution              27_226                   1 1 26_217_bn_leaky 27_226_bn -23330=4,3,40,40,8 0=8 1=1 5=1 6=384
Eltwise                  29_238                   2 1 27_226_bn 24_200_bn_split_1 29_238 -23330=4,3,40,40,8 0=1
Split                    29_238_split             1 2 29_238 29_238_split_0 29_238_split_1 -23330=8,3,40,40,8,3,40,40,8
Convolution              30_242                   1 1 29_238_split_0 30_242_bn_leaky -23330=4,3,40,40,48 0=48 1=1 5=1 6=384 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     31_250                   1 1 30_242_bn_leaky 31_250_bn_leaky -23330=4,3,40,40,48 0=48 1=3 4=1 5=1 6=432 7=48 9=2 -23310=1,1.000000e-01
Convolution              32_259                   1 1 31_250_bn_leaky 32_259_bn -23330=4,3,40,40,8 0=8 1=1 5=1 6=384
Eltwise                  34_273                   2 1 32_259_bn 29_238_split_1 34_273 -23330=4,3,40,40,8 0=1
Convolution              35_277                   1 1 34_273 35_277_bn_leaky -23330=4,3,40,40,48 0=48 1=1 5=1 6=384 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     36_285                   1 1 35_277_bn_leaky 36_285_bn_leaky -23330=4,3,40,40,48 0=48 1=3 4=1 5=1 6=432 7=48 9=2 -23310=1,1.000000e-01
Convolution              37_294                   1 1 36_285_bn_leaky 37_294_bn -23330=4,3,40,40,16 0=16 1=1 5=1 6=768
Split                    37_294_bn_split          1 2 37_294_bn 37_294_bn_split_0 37_294_bn_split_1 -23330=8,3,40,40,16,3,40,40,16
Convolution              38_303                   1 1 37_294_bn_split_0 38_303_bn_leaky -23330=4,3,40,40,96 0=96 1=1 5=1 6=1536 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     39_311                   1 1 38_303_bn_leaky 39_311_bn_leaky -23330=4,3,40,40,96 0=96 1=3 4=1 5=1 6=864 7=96 9=2 -23310=1,1.000000e-01
Convolution              40_320                   1 1 39_311_bn_leaky 40_320_bn -23330=4,3,40,40,16 0=16 1=1 5=1 6=1536
Eltwise                  42_332                   2 1 40_320_bn 37_294_bn_split_1 42_332 -23330=4,3,40,40,16 0=1
Split                    42_332_split             1 2 42_332 42_332_split_0 42_332_split_1 -23330=8,3,40,40,16,3,40,40,16
Convolution              43_336                   1 1 42_332_split_0 43_336_bn_leaky -23330=4,3,40,40,96 0=96 1=1 5=1 6=1536 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     44_344                   1 1 43_336_bn_leaky 44_344_bn_leaky -23330=4,3,40,40,96 0=96 1=3 4=1 5=1 6=864 7=96 9=2 -23310=1,1.000000e-01
Convolution              45_353                   1 1 44_344_bn_leaky 45_353_bn -23330=4,3,40,40,16 0=16 1=1 5=1 6=1536
Eltwise                  47_365                   2 1 45_353_bn 42_332_split_1 47_365 -23330=4,3,40,40,16 0=1
Split                    47_365_split             1 2 47_365 47_365_split_0 47_365_split_1 -23330=8,3,40,40,16,3,40,40,16
Convolution              48_369                   1 1 47_365_split_0 48_369_bn_leaky -23330=4,3,40,40,96 0=96 1=1 5=1 6=1536 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     49_377                   1 1 48_369_bn_leaky 49_377_bn_leaky -23330=4,3,40,40,96 0=96 1=3 4=1 5=1 6=864 7=96 9=2 -23310=1,1.000000e-01
Convolution              50_386                   1 1 49_377_bn_leaky 50_386_bn -23330=4,3,40,40,16 0=16 1=1 5=1 6=1536
Eltwise                  52_399                   2 1 50_386_bn 47_365_split_1 52_399 -23330=4,3,40,40,16 0=1
Split                    52_399_split             1 2 52_399 52_399_split_0 52_399_split_1 -23330=8,3,40,40,16,3,40,40,16
Convolution              53_403                   1 1 52_399_split_0 53_403_bn_leaky -23330=4,3,40,40,96 0=96 1=1 5=1 6=1536 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     54_411                   1 1 53_403_bn_leaky 54_411_bn_leaky -23330=4,3,40,40,96 0=96 1=3 4=1 5=1 6=864 7=96 9=2 -23310=1,1.000000e-01
Convolution              55_420                   1 1 54_411_bn_leaky 55_420_bn -23330=4,3,40,40,16 0=16 1=1 5=1 6=1536
Eltwise                  57_433                   2 1 55_420_bn 52_399_split_1 57_433 -23330=4,3,40,40,16 0=1
Convolution              58_437                   1 1 57_433 58_437_bn_leaky -23330=4,3,40,40,96 0=96 1=1 5=1 6=1536 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     59_445                   1 1 58_437_bn_leaky 59_445_bn_leaky -23330=4,3,20,20,96 0=96 1=3 3=2 4=1 5=1 6=864 7=96 9=2 -23310=1,1.000000e-01
Convolution              60_454                   1 1 59_445_bn_leaky 60_454_bn -23330=4,3,20,20,24 0=24 1=1 5=1 6=2304
Split                    60_454_bn_split          1 2 60_454_bn 60_454_bn_split_0 60_454_bn_split_1 -23330=8,3,20,20,24,3,20,20,24
Convolution              61_463                   1 1 60_454_bn_split_0 61_463_bn_leaky -23330=4,3,20,20,136 0=136 1=1 5=1 6=3264 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     62_471                   1 1 61_463_bn_leaky 62_471_bn_leaky -23330=4,3,20,20,136 0=136 1=3 4=1 5=1 6=1224 7=136 9=2 -23310=1,1.000000e-01
Convolution              63_480                   1 1 62_471_bn_leaky 63_480_bn -23330=4,3,20,20,24 0=24 1=1 5=1 6=3264
Eltwise                  65_492                   2 1 63_480_bn 60_454_bn_split_1 65_492 -23330=4,3,20,20,24 0=1
Split                    65_492_split             1 2 65_492 65_492_split_0 65_492_split_1 -23330=8,3,20,20,24,3,20,20,24
Convolution              66_496                   1 1 65_492_split_0 66_496_bn_leaky -23330=4,3,20,20,136 0=136 1=1 5=1 6=3264 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     67_504                   1 1 66_496_bn_leaky 67_504_bn_leaky -23330=4,3,20,20,136 0=136 1=3 4=1 5=1 6=1224 7=136 9=2 -23310=1,1.000000e-01
Convolution              68_513                   1 1 67_504_bn_leaky 68_513_bn -23330=4,3,20,20,24 0=24 1=1 5=1 6=3264
Eltwise                  70_526                   2 1 68_513_bn 65_492_split_1 70_526 -23330=4,3,20,20,24 0=1
Split                    70_526_split             1 2 70_526 70_526_split_0 70_526_split_1 -23330=8,3,20,20,24,3,20,20,24
Convolution              71_530                   1 1 70_526_split_0 71_530_bn_leaky -23330=4,3,20,20,136 0=136 1=1 5=1 6=3264 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     72_538                   1 1 71_530_bn_leaky 72_538_bn_leaky -23330=4,3,20,20,136 0=136 1=3 4=1 5=1 6=1224 7=136 9=2 -23310=1,1.000000e-01
Convolution              73_547                   1 1 72_538_bn_leaky 73_547_bn -23330=4,3,20,20,24 0=24 1=1 5=1 6=3264
Eltwise                  75_559                   2 1 73_547_bn 70_526_split_1 75_559 -23330=4,3,20,20,24 0=1
Split                    75_559_split             1 2 75_559 75_559_split_0 75_559_split_1 -23330=8,3,20,20,24,3,20,20,24
Convolution              76_563                   1 1 75_559_split_0 76_563_bn_leaky -23330=4,3,20,20,136 0=136 1=1 5=1 6=3264 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     77_571                   1 1 76_563_bn_leaky 77_571_bn_leaky -23330=4,3,20,20,136 0=136 1=3 4=1 5=1 6=1224 7=136 9=2 -23310=1,1.000000e-01
Convolution              78_580                   1 1 77_571_bn_leaky 78_580_bn -23330=4,3,20,20,24 0=24 1=1 5=1 6=3264
Eltwise                  80_593                   2 1 78_580_bn 75_559_split_1 80_593 -23330=4,3,20,20,24 0=1
Split                    80_593_split             1 2 80_593 80_593_split_0 80_593_split_1 -23330=8,3,20,20,24,3,20,20,24
Convolution              81_597                   1 1 80_593_split_0 81_597_bn_leaky -23330=4,3,20,20,136 0=136 1=1 5=1 6=3264 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     82_605                   1 1 81_597_bn_leaky 82_605_bn_leaky -23330=4,3,10,10,136 0=136 1=3 3=2 4=1 5=1 6=1224 7=136 9=2 -23310=1,1.000000e-01
Convolution              83_615                   1 1 82_605_bn_leaky 83_615_bn -23330=4,3,10,10,48 0=48 1=1 5=1 6=6528
Split                    83_615_bn_split          1 2 83_615_bn 83_615_bn_split_0 83_615_bn_split_1 -23330=8,3,10,10,48,3,10,10,48
Convolution              84_624                   1 1 83_615_bn_split_0 84_624_bn_leaky -23330=4,3,10,10,224 0=224 1=1 5=1 6=10752 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     85_632                   1 1 84_624_bn_leaky 85_632_bn_leaky -23330=4,3,10,10,224 0=224 1=3 4=1 5=1 6=2016 7=224 9=2 -23310=1,1.000000e-01
Convolution              86_641                   1 1 85_632_bn_leaky 86_641_bn -23330=4,3,10,10,48 0=48 1=1 5=1 6=10752
Eltwise                  88_653                   2 1 86_641_bn 83_615_bn_split_1 88_653 -23330=4,3,10,10,48 0=1
Split                    88_653_split             1 2 88_653 88_653_split_0 88_653_split_1 -23330=8,3,10,10,48,3,10,10,48
Convolution              89_657                   1 1 88_653_split_0 89_657_bn_leaky -23330=4,3,10,10,224 0=224 1=1 5=1 6=10752 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     90_665                   1 1 89_657_bn_leaky 90_665_bn_leaky -23330=4,3,10,10,224 0=224 1=3 4=1 5=1 6=2016 7=224 9=2 -23310=1,1.000000e-01
Convolution              91_674                   1 1 90_665_bn_leaky 91_674_bn -23330=4,3,10,10,48 0=48 1=1 5=1 6=10752
Eltwise                  93_686                   2 1 91_674_bn 88_653_split_1 93_686 -23330=4,3,10,10,48 0=1
Split                    93_686_split             1 2 93_686 93_686_split_0 93_686_split_1 -23330=8,3,10,10,48,3,10,10,48
Convolution              94_690                   1 1 93_686_split_0 94_690_bn_leaky -23330=4,3,10,10,224 0=224 1=1 5=1 6=10752 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     95_698                   1 1 94_690_bn_leaky 95_698_bn_leaky -23330=4,3,10,10,224 0=224 1=3 4=1 5=1 6=2016 7=224 9=2 -23310=1,1.000000e-01
Convolution              96_707                   1 1 95_698_bn_leaky 96_707_bn -23330=4,3,10,10,48 0=48 1=1 5=1 6=10752
Eltwise                  98_719                   2 1 96_707_bn 93_686_split_1 98_719 -23330=4,3,10,10,48 0=1
Split                    98_719_split             1 2 98_719 98_719_split_0 98_719_split_1 -23330=8,3,10,10,48,3,10,10,48
Convolution              99_723                   1 1 98_719_split_0 99_723_bn_leaky -23330=4,3,10,10,224 0=224 1=1 5=1 6=10752 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     100_731                  1 1 99_723_bn_leaky 100_731_bn_leaky -23330=4,3,10,10,224 0=224 1=3 4=1 5=1 6=2016 7=224 9=2 -23310=1,1.000000e-01
Convolution              101_740                  1 1 100_731_bn_leaky 101_740_bn -23330=4,3,10,10,48 0=48 1=1 5=1 6=10752
Eltwise                  103_752                  2 1 101_740_bn 98_719_split_1 103_752 -23330=4,3,10,10,48 0=1
Split                    103_752_split            1 2 103_752 103_752_split_0 103_752_split_1 -23330=8,3,10,10,48,3,10,10,48
Convolution              104_756                  1 1 103_752_split_0 104_756_bn_leaky -23330=4,3,10,10,224 0=224 1=1 5=1 6=10752 9=2 -23310=1,1.000000e-01
ConvolutionDepthWise     105_764                  1 1 104_756_bn_leaky 105_764_bn_leaky -23330=4,3,10,10,224 0=224 1=3 4=1 5=1 6=2016 7=224 9=2 -23310=1,1.000000e-01
Convolution              106_773                  1 1 105_764_bn_leaky 106_773_bn -23330=4,3,10,10,48 0=48 1=1 5=1 6=10752
Eltwise                  108_784                  2 1 106_773_bn 103_752_split_1 108_784 -23330=4,3,10,10,48 0=1
Split                    108_784_split            1 4 108_784 108_784_split_0 108_784_split_1 108_784_split_2 108_784_split_3 -23330=16,3,10,10,48,3,10,10,48,3,10,10,48,3,10,10,48
Pooling                  109_788                  1 1 108_784_split_0 109_788 -23330=4,3,10,10,48 1=3 3=1 5=1
Pooling                  111_795                  1 1 108_784_split_1 111_795 -23330=4,3,10,10,48 1=5 3=2 5=1
Pooling                  113_802                  1 1 108_784_split_2 113_802 -23330=4,3,10,10,48 1=9 3=4 5=1
Concat                   114_806                  4 1 113_802 111_795 109_788 108_784_split_3 114_806 -23330=4,3,10,10,192
Convolution              115_811                  1 1 114_806 115_811_bn_leaky -23330=4,3,10,10,96 0=96 1=1 5=1 6=18432 9=2 -23310=1,1.000000e-01
Split                    115_811_bn_leaky_split   1 2 115_811_bn_leaky 115_811_bn_leaky_split_0 115_811_bn_leaky_split_1 -23330=8,3,10,10,96,3,10,10,96
ConvolutionDepthWise     116_819                  1 1 115_811_bn_leaky_split_0 116_819_bn_leaky -23330=4,3,10,10,96 0=96 1=5 4=2 5=1 6=2400 7=96 9=2 -23310=1,1.000000e-01
Convolution              117_828                  1 1 116_819_bn_leaky 117_828_bn -23330=4,3,10,10,96 0=96 1=1 5=1 6=9216
ConvolutionDepthWise     118_836                  1 1 117_828_bn 118_836_bn_leaky -23330=4,3,10,10,96 0=96 1=5 4=2 5=1 6=2400 7=96 9=2 -23310=1,1.000000e-01
Convolution              119_845                  1 1 118_836_bn_leaky 119_845_bn -23330=4,3,10,10,96 0=96 1=1 5=1 6=9216
Convolution              120_854                  1 1 119_845_bn 120_854 -23330=4,3,10,10,18 0=18 1=1 5=1 6=1728
Interp                   123_882                  1 1 115_811_bn_leaky_split_1 123_882 -23330=4,3,20,20,96 0=1 1=2.000000e 00 2=2.000000e 00
Concat                   124_885                  2 1 123_882 80_593_split_1 124_885 -23330=4,3,20,20,120
ConvolutionDepthWise     125_888                  1 1 124_885 125_888_bn_leaky -23330=4,3,20,20,120 0=120 1=5 4=2 5=1 6=3000 7=120 9=2 -23310=1,1.000000e-01
Convolution              126_897                  1 1 125_888_bn_leaky 126_897_bn -23330=4,3,20,20,120 0=120 1=1 5=1 6=14400
ConvolutionDepthWise     127_905                  1 1 126_897_bn 127_905_bn_leaky -23330=4,3,20,20,120 0=120 1=5 4=2 5=1 6=3000 7=120 9=2 -23310=1,1.000000e-01
Convolution              128_914                  1 1 127_905_bn_leaky 128_914_bn -23330=4,3,20,20,120 0=120 1=1 5=1 6=14400
Convolution              129_922                  1 1 128_914_bn 129_922 -23330=4,3,20,20,18 0=18 1=1 5=1 6=2160
Yolov3DetectionOutput    detection_out            2 1 120_854 129_922 output -23330=4,2,6,631,1 0=1 1=3 2=6.500000e-01 -23304=12,7.000000e 00,1.700000e 01,2.000000e 01,5.000000e 01,4.500000e 01,9.900000e 01,6.400000e 01,1.870000e 02,1.230000e 02,2.110000e 02,2.270000e 02,2.640000e 02 -23305=6,1077936128,1082130432,1084227584,0,1065353216,1073741824 -23306=2,3.200000e 01,1.600000e 01

检测效果杠杠的,而且与其他网络做了对比,结果如下:

3

升级版:Yolo-FastestV2

Yolo-Fastest注重的就是单核的实时推理性能,在满足实时的条件下的低CPU占用,不单单只是能在手机移动端达到实时,还要在RK3399,树莓派4以及多种Cortex-A53低成本低功耗设备上满足一定实时性,毕竟这些嵌入式的设备相比与移动端手机要弱很多,但是使用更加广泛,成本更加低廉。

总结下新框架的特性:

  • 简单、快速、紧凑、易于移植
  • 资源占用少,单核性能优异,功耗更低
  • 更快更小:以0.3%的精度损失换取30%的推理速度提升,减少25%的参数量
  • 训练速度快,算力要求低,训练只需要3GB显存,gtx1660ti训练COCO 1 epoch仅需4分钟

主要摘自于《https://zhuanlan.zhihu.com/p/400474142 》

首先模型的backbone替换为了shufflenetV2,相比原先的backbone,访存减少了一些,更加轻量,其次Anchor的匹配机制,参考的YOLOV5;其次是检测头的解耦合,这个也是参考YoloX的,将检测框的回归,前景背景的分类以及检测类别的分类有yolo的一个特征图解耦成3个不同的特征图,其中前景背景的分类以及检测类别的分类采用同一网络分支参数共享。最后将检测类别分类的loss由sigmoid替换为softmax。

Yolo-FastestV2还是只有输出11x11和22x22两个尺度的检测头,因为发现在coco上三个检测头(11x11,22x22,44x44)和两个检测头(11x11,22x22)的精度无太大差异,个人感觉原因如下:

  • backbone对应44x44分辨率的特征图太少
  • 正负anchor的严重不平衡
  • 小物体属于难样本对于模型学习能力要求高

大家还是关心最终的实验结果:

测试平台:Mate 30 Kirin 990 CPU,NCNN

与yolox和nanoDet的对比,精度肯定比不过, 不过速度会快三倍,那体积只有 1.3M 的 PP-YOLO Tiny,用int8的量化后体积和yolo-fastest的fp32的体积比,YOLO-FastestV2 int8可是仅仅只有250kb,虽然没跑过PP-YOLO Tiny,但是应该还是比他快。所以,模型的选择还是看大家需求。RK3399和树莓派4搭配ncnn bf16s,YOLO-FastestV2 是可以实时的。

© THE END

转载请联系本公众号获得授权

0 人点赞