xiangweizeng / darknet2ncnn

Darknet2ncnn converts the darknet model to the ncnn model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inference not work

shartoo opened this issue · comments

commented

The compile stage ran but inference not actually work .

pi@raspberrypi:~/workspace/darknet2ncnn $ make yolov3-tiny.net
./darknet2ncnn data/yolov3-tiny.cfg  data/yolov3-tiny.weights example/zoo/yolov3-tiny.param  example/zoo/yolov3-tiny.bin 
layer     filters    size              input                output
    0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16  0.150 BFLOPs
    1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16
    2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32  0.399 BFLOPs
    3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32
    4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64  0.399 BFLOPs
    5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64
    6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   13 conv    256  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 256  0.089 BFLOPs
   14 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   15 conv    255  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 255  0.044 BFLOPs
   16 yolo
   17 route  13
   18 conv    128  1 x 1 / 1    13 x  13 x 256   ->    13 x  13 x 128  0.011 BFLOPs
   19 upsample            2x    13 x  13 x 128   ->    26 x  26 x 128
   20 route  19 8
   21 conv    256  3 x 3 / 1    26 x  26 x 384   ->    26 x  26 x 256  1.196 BFLOPs
   22 conv    255  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 255  0.088 BFLOPs
   23 yolo
Loading weights from data/yolov3-tiny.weights...Done!
./convert_verify data/yolov3-tiny.cfg  data/yolov3-tiny.weights example/zoo/yolov3-tiny.param  example/zoo/yolov3-tiny.bin example/data/dog.jpg
layer     filters    size              input                output
    0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16  0.150 BFLOPs
    1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16
    2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32  0.399 BFLOPs
    3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32
    4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64  0.399 BFLOPs
    5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64
    6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   13 conv    256  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 256  0.089 BFLOPs
   14 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   15 conv    255  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 255  0.044 BFLOPs
   16 yolo
   17 route  13
   18 conv    128  1 x 1 / 1    13 x  13 x 256   ->    13 x  13 x 128  0.011 BFLOPs
   19 upsample            2x    13 x  13 x 128   ->    26 x  26 x 128
   20 route  19 8
   21 conv    256  3 x 3 / 1    26 x  26 x 384   ->    26 x  26 x 256  1.196 BFLOPs
   22 conv    255  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 255  0.088 BFLOPs
   23 yolo
Loading weights from data/yolov3-tiny.weights...Done!

Start run all operation:
conv_0 : weights diff : 0.000000
conv_0_batch_norm : slope diff : 0.000000
conv_0_batch_norm : mean diff : 0.000000
conv_0_batch_norm : variance diff : 0.000000
conv_0_batch_norm : biases diff : 0.000000
Layer: 0, Blob : conv_0_activation, Total Diff nan Avg Diff: nan
Layer: 1, Blob : maxpool_1, Total Diff nan Avg Diff: nan
conv_2 : weights diff : 0.000000
conv_2_batch_norm : slope diff : 0.000000
conv_2_batch_norm : mean diff : 0.000000
conv_2_batch_norm : variance diff : 0.000000
conv_2_batch_norm : biases diff : 0.000000
Layer: 2, Blob : conv_2_activation, Total Diff nan Avg Diff: nan
Layer: 3, Blob : maxpool_3, Total Diff nan Avg Diff: nan
conv_4 : weights diff : 0.000000
conv_4_batch_norm : slope diff : 0.000000
conv_4_batch_norm : mean diff : 0.000000
conv_4_batch_norm : variance diff : 0.000000
conv_4_batch_norm : biases diff : 0.000000
Layer: 4, Blob : conv_4_activation, Total Diff nan Avg Diff: nan
Layer: 5, Blob : maxpool_5, Total Diff nan Avg Diff: nan
conv_6 : weights diff : 0.000000
conv_6_batch_norm : slope diff : 0.000000
conv_6_batch_norm : mean diff : 0.000000
conv_6_batch_norm : variance diff : 0.000000
conv_6_batch_norm : biases diff : 0.000000
Layer: 6, Blob : conv_6_activation, Total Diff nan Avg Diff: nan
Layer: 7, Blob : maxpool_7, Total Diff nan Avg Diff: nan
conv_8 : weights diff : 0.000000
conv_8_batch_norm : slope diff : 0.000000
conv_8_batch_norm : mean diff : 0.000000
conv_8_batch_norm : variance diff : 0.000000
conv_8_batch_norm : biases diff : 0.000000
Layer: 8, Blob : conv_8_activation, Total Diff nan Avg Diff: nan
Layer: 9, Blob : maxpool_9, Total Diff nan Avg Diff: nan
conv_10 : weights diff : 0.000000
conv_10_batch_norm : slope diff : 0.000000
conv_10_batch_norm : mean diff : 0.000000
conv_10_batch_norm : variance diff : 0.000000
conv_10_batch_norm : biases diff : 0.000000
Layer: 10, Blob : conv_10_activation, Total Diff nan Avg Diff: nan
Layer: 11, Blob : maxpool_11, Total Diff nan Avg Diff: nan
conv_12 : weights diff : 0.000000
conv_12_batch_norm : slope diff : 0.000000
conv_12_batch_norm : mean diff : 0.000000
conv_12_batch_norm : variance diff : 0.000000
conv_12_batch_norm : biases diff : 0.000000
Layer: 12, Blob : conv_12_activation, Total Diff nan Avg Diff: nan
conv_13 : weights diff : 0.000000
conv_13_batch_norm : slope diff : 0.000000
conv_13_batch_norm : mean diff : 0.000000
conv_13_batch_norm : variance diff : 0.000000
conv_13_batch_norm : biases diff : 0.000000
Layer: 13, Blob : conv_13_activation, Total Diff nan Avg Diff: nan
conv_14 : weights diff : 0.000000
conv_14_batch_norm : slope diff : 0.000000
conv_14_batch_norm : mean diff : 0.000000
conv_14_batch_norm : variance diff : 0.000000
conv_14_batch_norm : biases diff : 0.000000
Layer: 14, Blob : conv_14_activation, Total Diff nan Avg Diff: nan
conv_15 : weights diff : 0.000000
conv_15 : biases diff : 0.000000
Layer: 15, Blob : conv_15_activation, Total Diff nan Avg Diff: nan
Layer: 17, Blob : route_17, Total Diff nan Avg Diff: nan
conv_18 : weights diff : 0.000000
conv_18_batch_norm : slope diff : 0.000000
conv_18_batch_norm : mean diff : 0.000000
conv_18_batch_norm : variance diff : 0.000000
conv_18_batch_norm : biases diff : 0.000000
Layer: 18, Blob : conv_18_activation, Total Diff nan Avg Diff: nan
Layer: 19, Blob : upsample_19, Total Diff nan Avg Diff: nan
Layer: 20, Blob : route_20, Total Diff nan Avg Diff: nan
conv_21 : weights diff : 0.000000
conv_21_batch_norm : slope diff : 0.000000
conv_21_batch_norm : mean diff : 0.000000
conv_21_batch_norm : variance diff : 0.000000
conv_21_batch_norm : biases diff : 0.000000
Layer: 21, Blob : conv_21_activation, Total Diff nan Avg Diff: nan
conv_22 : weights diff : 0.000000
conv_22 : biases diff : 0.000000
Layer: 22, Blob : conv_22_activation, Total Diff nan Avg Diff: nan

All the difference are 0.000 .And i tried another example like cifar.cifar

pi@raspberrypi:~/workspace/darknet2ncnn/example $ make cifar.cifar
./classifier zoo/cifar.param  zoo/cifar.bin  data/32516_dog.png data/cifar_lable.txt
3    cat                              = nan
4    deer                             = nan
1    automobile                       = nan
0    airplane                         = nan
2    bird                             = nan

Sth wrong with the weights file?

Errors have occurred since the first layer,
···
Layer: 0, Blob : conv_0_activation, Total Diff nan Avg Diff: nan
Layer: 1, Blob : maxpool_1, Total Diff nan Avg Diff: nan
···

You can cancel the comment in convert_verify.cpp, from 177 to 192 lines, compile and run again to print the actual output values and differences.Of course, it is best to redirect the output to a file for easy checking.