【MNN学习四】基于MNN的MobileNetSSD测试

目录

1. MobileNetSSD网络模型下载

2. Caffe转MNN

3. 将MobileNetSSD_deploy.caffemodel.mnn进行量化

4. 在RK3399 CPU上测试MobileNetSSD (Benchmark 测试方法)


1. MobileNetSSD网络模型下载

    下载链接:https://github.com/C-Aniruddh/realtime_object_recognition

    将MobileNetSSD_deploy.caffemodel和MobileNetSSD_deploy.prototxt (去掉.txt) 放至目录 /MNN/tools/converter/build.

2. Caffe转MNN

cd MNN/tools/converter/build
./MNNConvert -f CAFFE --modelFile MobileNetSSD_deploy.caffemodel --prototxt MobileNetSSD_deploy.prototxt --MNNModel MobileNetSSD_deploy.caffemodel.mnn --bizCode MNN

    将MobileNetSSD_deploy.caffemodel.mnn放至目录 MNN/benchmark/models. (或者其它新建文件夹)

3. 将MobileNetSSD_deploy.caffemodel.mnn进行量化

cd MNN/build
./quantized.out ../benchmark/models/MobileNetSSD_deploy.caffemodel.mnn ../benchmark/models/MobileNetSSD_deploy_quant.caffemodel.mnn mobilenetCaffeConfig.json

    这样,量化后的模型MobileNetSSD_deploy_quant.caffemodel.mnn也在目录 MNN/benchmark/models.

    其中,mobilenetCaffeConfig.json内容如下:

{
    "format":"BGR",
    "mean":[
        103.94,
        116.78,
        123.68
    ],
    "normal":[
        0.017,
        0.017,
        0.017
    ],
    "width":300,
    "height":300,
    "path":"../resource/images/"
}

4. 在RK3399 CPU上测试MobileNetSSD (Benchmark 测试方法)

1. 双线程测试结果

cd MNN/build
./benchmark.out ../benchmark/models/ 100 0 2


# --------------------- output -------------------- #
MNN benchmark
Forward type: **CPU** thread=2** precision=2
--------> Benchmarking... loop = 100
[ - ] squeezenet_v1.1.caffe.mnn    max =   43.807ms  min =   43.024ms  avg =   43.358ms
[ - ] squeezenet_v1.1_quant.caffe.mnn    max =   36.482ms  min =   35.413ms  avg =   35.687ms
[ - ] mobilenet_v1.caffe.mnn      max =   82.367ms  min =   72.617ms  avg =   74.682ms
[ - ] mobilenet_v1_quant.caffe.mnn    max =   41.535ms  min =   41.166ms  avg =   41.278ms
[ - ] MobileNetV2_224.mnn         max =   50.187ms  min =   48.662ms  avg =   49.278ms
[ - ] mobilenet_v2_1.0_224_quant.tflite.mnn    max =   40.427ms  min =   40.064ms  avg =   40.187ms
[ - ] MobileNetSSD_deploy.caffemodel.mnn    max =  181.085ms  min =  151.205ms  avg =  154.176ms
[ - ] MobileNetSSD_deploy_quant.caffemodel.mnn    max =   86.637ms  min =   85.646ms  avg =   85.893ms
[ - ] mobilenet_iter_73000.caffemodel.mnn    max =  152.778ms  min =  149.868ms  avg =  150.791ms
[ - ] mobilenet_iter_73000_quant.caffemodel.mnn    max =   95.430ms  min =   85.544ms  avg =   89.594ms


[ - ] squeezenet_v1.0.caffe.mnn    max = 1006.362ms  min =  995.729ms  avg =  999.045ms
[ - ] squeezenet_v1.0_quant.caffe.mnn    max =  752.294ms  min =  748.569ms  avg =  750.331ms

【MNN学习四】基于MNN的MobileNetSSD测试_第1张图片

2. 单线程测试结果

cd MNN/build
./benchmark.out ../benchmark/models/ 100 0 1


# --------------------- output -------------------- #
MNN benchmark
Forward type: **CPU** thread=1** precision=2
--------> Benchmarking... loop = 100
[ - ] squeezenet_v1.1.caffe.mnn    max =   81.320ms  min =   76.441ms  avg =   77.216ms
[ - ] squeezenet_v1.1_quant.caffe.mnn    max =   68.985ms  min =   61.459ms  avg =   61.983ms
[ - ] mobilenet_v1.caffe.mnn      max =  134.488ms  min =  125.744ms  avg =  127.023ms
[ - ] mobilenet_v1_quant.caffe.mnn    max =   82.021ms  min =   78.917ms  avg =   79.202ms
[ - ] MobileNetV2_224.mnn         max =   89.986ms  min =   82.650ms  avg =   83.681ms
[ - ] mobilenet_v2_1.0_224_quant.tflite.mnn    max =   76.332ms  min =   74.217ms  avg =   74.471ms
[ - ] MobileNetSSD_deploy.caffemodel.mnn    max =  271.201ms  min =  255.449ms  avg =  257.196ms
[ - ] MobileNetSSD_deploy_quant.caffemodel.mnn    max =  168.216ms  min =  160.291ms  avg =  162.216ms
[ - ] mobilenet_iter_73000.caffemodel.mnn    max =  271.889ms  min =  257.341ms  avg =  259.421ms
[ - ] mobilenet_iter_73000_quant.caffemodel.mnn    max =  167.085ms  min =  160.005ms  avg =  160.975ms

3. 六线程测试结果

cd MNN/build
./benchmark.out ../benchmark/models/ 100 0 2


# --------------------- output -------------------- #
[ - ] squeezenet_v1.1.caffe.mnn    max =   77.046ms  min =   62.084ms  avg =   65.892ms
[ - ] squeezenet_v1.1_quant.caffe.mnn    max =   98.186ms  min =   73.866ms  avg =   92.786ms
[ - ] mobilenet_v1.caffe.mnn      max =   92.848ms  min =   77.205ms  avg =   83.044ms
[ - ] mobilenet_v1_quant.caffe.mnn    max =   76.816ms  min =   62.269ms  avg =   69.682ms
[ - ] MobileNetV2_224.mnn         max =   89.664ms  min =   68.143ms  avg =   82.875ms
[ - ] mobilenet_v2_1.0_224_quant.tflite.mnn    max =   89.136ms  min =   46.681ms  avg =   79.660ms
[ - ] MobileNetSSD_deploy.caffemodel.mnn    max =  198.271ms  min =  156.198ms  avg =  170.407ms
[ - ] MobileNetSSD_deploy_quant.caffemodel.mnn    max =  155.065ms  min =  124.171ms  avg =  142.439ms
[ - ] mobilenet_iter_73000.caffemodel.mnn    max =  191.096ms  min =  157.275ms  avg =  169.027ms
[ - ] mobilenet_iter_73000_quant.caffemodel.mnn    max =  157.181ms  min =  110.549ms  avg =  143.844ms

 

你可能感兴趣的:(MNN)