Open infrontofme opened 4 years ago
我想把darknet框架下yolov3-tiny的模型转到ncnn 原始yolov3-tiny.cfg文件如下:
[net] # Testing batch=1 subdivisions=1 # Training # batch=64 # subdivisions=2 width=416 height=416 channels=3 momentum=0.9 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1 learning_rate=0.001 burn_in=1000 max_batches = 500200 policy=steps steps=400000,450000 scales=.1,.1 [convolutional] batch_normalize=1 filters=16 size=3 stride=1 pad=1 activation=leaky [maxpool] size=2 stride=2 [convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky [maxpool] size=2 stride=2 [convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky [maxpool] size=2 stride=2 [convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky [maxpool] size=2 stride=2 [convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky [maxpool] size=2 stride=2 [convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky [maxpool] size=2 stride=1 [convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky ########### [convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky [convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky [convolutional] size=1 stride=1 pad=1 filters=255 activation=linear [yolo] mask = 3,4,5 anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319 classes=80 num=6 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1 [route] layers = -4 [convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky [upsample] stride=2 [route] layers = -1, 8 [convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky [convolutional] size=1 stride=1 pad=1 filters=255 activation=linear [yolo] mask = 0,1,2 anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319 classes=80 num=6 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1
step1:darknet2ncnn,成功生成了.param和.bin文件,.param文件内容如下:
7767517 47 49 Input data 0 1 data 0=416 1=416 2=3 Convolution 0_27 1 1 data 0_27 0=16 1=3 2=1 3=1 4=1 5=0 6=432 BatchNorm 0_27_bn 1 1 0_27 0_27_bn 0=16 1=.00001 ReLU 0_27_bn_leaky 1 1 0_27_bn 0_27_bn_leaky 0=0.1 Pooling 1_35 1 1 0_27_bn_leaky 1_35 0=0 1=2 2=2 5=1 3=0 13=0 14=0 15=0 Convolution 2_39 1 1 1_35 2_39 0=32 1=3 2=1 3=1 4=1 5=0 6=4608 BatchNorm 2_39_bn 1 1 2_39 2_39_bn 0=32 1=.00001 ReLU 2_39_bn_leaky 1 1 2_39_bn 2_39_bn_leaky 0=0.1 Pooling 3_47 1 1 2_39_bn_leaky 3_47 0=0 1=2 2=2 5=1 3=0 13=0 14=0 15=0 Convolution 4_51 1 1 3_47 4_51 0=64 1=3 2=1 3=1 4=1 5=0 6=18432 BatchNorm 4_51_bn 1 1 4_51 4_51_bn 0=64 1=.00001 ReLU 4_51_bn_leaky 1 1 4_51_bn 4_51_bn_leaky 0=0.1 Pooling 5_59 1 1 4_51_bn_leaky 5_59 0=0 1=2 2=2 5=1 3=0 13=0 14=0 15=0 Convolution 6_63 1 1 5_59 6_63 0=128 1=3 2=1 3=1 4=1 5=0 6=73728 BatchNorm 6_63_bn 1 1 6_63 6_63_bn 0=128 1=.00001 ReLU 6_63_bn_leaky 1 1 6_63_bn 6_63_bn_leaky 0=0.1 Pooling 7_71 1 1 6_63_bn_leaky 7_71 0=0 1=2 2=2 5=1 3=0 13=0 14=0 15=0 Convolution 8_75 1 1 7_71 8_75 0=256 1=3 2=1 3=1 4=1 5=0 6=294912 BatchNorm 8_75_bn 1 1 8_75 8_75_bn 0=256 1=.00001 ReLU 8_75_bn_leaky 1 1 8_75_bn 8_75_bn_leaky 0=0.1 Split 8_75_bn_leaky_split 1 2 8_75_bn_leaky 8_75_bn_leaky_split_0 8_75_bn_leaky_split_1 Pooling 9_83 1 1 8_75_bn_leaky_split_0 9_83 0=0 1=2 2=2 5=1 3=0 13=0 14=0 15=0 Convolution 10_87 1 1 9_83 10_87 0=512 1=3 2=1 3=1 4=1 5=0 6=1179648 BatchNorm 10_87_bn 1 1 10_87 10_87_bn 0=512 1=.00001 ReLU 10_87_bn_leaky 1 1 10_87_bn 10_87_bn_leaky 0=0.1 Pooling 11_95 1 1 10_87_bn_leaky 11_95 0=0 1=2 2=1 5=1 3=0 13=0 14=0 15=0 Convolution 12_99 1 1 11_95 12_99 0=1024 1=3 2=1 3=1 4=1 5=0 6=4718592 BatchNorm 12_99_bn 1 1 12_99 12_99_bn 0=1024 1=.00001 ReLU 12_99_bn_leaky 1 1 12_99_bn 12_99_bn_leaky 0=0.1 Convolution 13_109 1 1 12_99_bn_leaky 13_109 0=256 1=1 2=1 3=1 4=0 5=0 6=262144 BatchNorm 13_109_bn 1 1 13_109 13_109_bn 0=256 1=.00001 ReLU 13_109_bn_leaky 1 1 13_109_bn 13_109_bn_leaky 0=0.1 Split 13_109_bn_leaky_split 1 2 13_109_bn_leaky 13_109_bn_leaky_split_0 13_109_bn_leaky_split_1 Convolution 14_117 1 1 13_109_bn_leaky_split_0 14_117 0=512 1=3 2=1 3=1 4=1 5=0 6=1179648 BatchNorm 14_117_bn 1 1 14_117 14_117_bn 0=512 1=.00001 ReLU 14_117_bn_leaky 1 1 14_117_bn 14_117_bn_leaky 0=0.1 Convolution 15_125 1 1 14_117_bn_leaky 15_125 0=18 1=1 2=1 3=1 4=0 5=1 6=9216 Convolution 18_147 1 1 13_109_bn_leaky_split_1 18_147 0=128 1=1 2=1 3=1 4=0 5=0 6=32768 BatchNorm 18_147_bn 1 1 18_147 18_147_bn 0=128 1=.00001 ReLU 18_147_bn_leaky 1 1 18_147_bn 18_147_bn_leaky 0=0.1 Interp 19_155 1 1 18_147_bn_leaky 19_155 0=1 1=2.f 2=2.f Concat 20_158 2 1 19_155 8_75_bn_leaky_split_1 20_158 Convolution 21_161 1 1 20_158 21_161 0=256 1=3 2=1 3=1 4=1 5=0 6=884736 BatchNorm 21_161_bn 1 1 21_161 21_161_bn 0=256 1=.00001 ReLU 21_161_bn_leaky 1 1 21_161_bn 21_161_bn_leaky 0=0.1 Convolution 22_169 1 1 21_161_bn_leaky 22_169 0=18 1=1 2=1 3=1 4=0 5=1 6=4608 Yolov3DetectionOutput detection_out 2 1 15_125 22_169 output 0=1 1=3 2=0.250000 -23304=12,10.000000,14.000000,23.000000,27.000000,37.000000,58.000000,81.000000,82.000000,135.000000,169.000000,344.000000,319.000000 -23305=6,3.000000,4.000000,5.000000,0.000000,1.000000,2.000000 -23306=2,34.666668,16.000000
到这看起来都没什么问题。
step2:ncnnoptimize 报错如下:
super@super-All-Series:~/ncnn/build/tools$ ./ncnnoptimize darknet/yolov3-tiny.param darknet/yolov3-tiny.bin yolov3-tiny-opt-fp32.param yolov3-tiny-opt-fp32.bin 0 fuse_convolution_batchnorm 0_25 0_25_bn fuse_convolution_batchnorm 2_37 2_37_bn fuse_convolution_batchnorm 4_49 4_49_bn fuse_convolution_batchnorm 6_61 6_61_bn fuse_convolution_batchnorm 8_73 8_73_bn fuse_convolution_batchnorm 10_85 10_85_bn fuse_convolution_batchnorm 12_97 12_97_bn fuse_convolution_batchnorm 13_107 13_107_bn fuse_convolution_batchnorm 14_115 14_115_bn fuse_convolution_batchnorm 18_145 18_145_bn fuse_convolution_batchnorm 21_159 21_159_bn fuse_convolution_activation 0_25 0_25_bn_leaky fuse_convolution_activation 2_37 2_37_bn_leaky fuse_convolution_activation 4_49 4_49_bn_leaky fuse_convolution_activation 6_61 6_61_bn_leaky fuse_convolution_activation 8_73 8_73_bn_leaky fuse_convolution_activation 10_85 10_85_bn_leaky fuse_convolution_activation 12_97 12_97_bn_leaky fuse_convolution_activation 13_107 13_107_bn_leaky fuse_convolution_activation 14_115 14_115_bn_leaky fuse_convolution_activation 18_145 18_145_bn_leaky fuse_convolution_activation 21_159 21_159_bn_leaky shape_inference 总线错误 (核心已转储)
感谢解答~
又测试了一下yolov4-tiny模型没有报错
同yolo3-tiny , 相同的问题bus error(core dumped)~
转换后的param和原始的cfg参数有出入。
相同问题,yolov3-tiny可以,yolov4-tiny不可以,有解决吗?
我想把darknet框架下yolov3-tiny的模型转到ncnn 原始yolov3-tiny.cfg文件如下:
step1:darknet2ncnn,成功生成了.param和.bin文件,.param文件内容如下:
到这看起来都没什么问题。
step2:ncnnoptimize 报错如下:
感谢解答~