yolov--9--YOLO v3的稀疏化剪枝微调--优化细节流程

    xiaoxiao2022-06-27  165

    Yolov-1-TX2上用YOLOv3训练自己数据集的流程(VOC2007-TX2-GPU)

    Yolov--2--一文全面了解深度学习性能优化加速引擎---TensorRT

    Yolov--3--TensorRT中yolov3性能优化加速(基于caffe)

    yolov-5-目标检测:YOLOv2算法原理详解

    yolov--8--Tensorflow实现YOLO v3

    yolov--9--YOLO v3的剪枝优化

    yolov--10--目标检测模型的参数评估指标详解、概念解析

    yolov--11--YOLO v3的原版训练记录、mAP、AP、recall、precision、time等评价指标计算

    yolov--12--YOLOv3的原理深度剖析和关键点讲解


    https://github.com/talebolano/yolov3-network-slimming

    yolov3-network-slimming

    将Learning Efficient Convolutional Networks Through Network Slimming (ICCV 2017)应用在yolov3和yolov2上

    环境

    pytorch 0.41Linux

    如何使用

    1.对原始weights文件进行稀疏化训练

    python sparsity_train.py -sr --s 0.0001 --image_folder coco.data --cfg yolov3.cfg --weights yolov3.weights

    2.剪枝

    python prune.py --cfg yolov3.cfg --weights checkpoints/yolov3_sparsity_100.weights --percent 0.3

    3.对剪枝后的weights进行微调

    python sparsity_train.py --image_folder coco.data --cfg prune_yolov3.cfg --weights prune_yolov3.weights

    关于new_prune.py

    new_prune更新了算法,现在可以确保不会有某一层被减为0的情况发生,参考RETHINKING THE SMALLER-NORM-LESSINFORMATIVE ASSUMPTION IN CHANNEL PRUNING OF CONVOLUTION LAYERS(ICLR 2018)对剪枝后bn层β系数进行了保留

    待完成

    coco测试


    1、配置:

     待定:

    cuda 8.0.61, cudnn7.0,opencv2.4.8, Linux系统版本:Ubuntu14.04,Python:2.7.6keras 2.1.1numpy 1.14.2tensorflow 1.0.0pip19.0.3,setuptools-36.6.0(更新后为setuptools-40.8.0),cmake 3.5.1硬盘:2T内存:128G,缓冲区:64G

     

    $ pip show numpy Name: numpy Version: 1.14.2 Summary: NumPy: array processing for numbers, strings, records, and objects. Home-page: http://www.numpy.org Author: NumPy Developers Author-email: numpy-discussion@python.org License: BSD Location: /usr/local/lib/python2.7/dist-packages

    conda list 的CPU配置如下:


    2019-5-24:

     


     2019-5-25:


    2019-5-25-2:内存不足

     

    异常一:

    IndentationError: expected an indented block 把这段英文报错翻译过来就是: 缩进错误: 期望一个缩进的块 

    缩进问题:缩进2个tab键即可


    2019-5-27:

    1.对原始weights文件进行稀疏化训练

    CUDA_VISIBLE_DEVICES=7 python sparsity_train.py -sr --s 0.0001 --image_folder coco.data --cfg yolov3.cfg --weights yolov3.weights 2>1 | tee visualization/sparsity-tarin-yolov3.log

    2.剪枝

    CUDA_VISIBLE_DEVICES=7 python prune.py --cfg yolov3.cfg --weights checkpoints/yolov3_sparsity_100.weights --percent 0.3

     


    2019-5-28:

    3.对剪枝后的weights进行微调

     

    python sparsity_train.py --cfg prune_yolov3-80lei-111.cfg --weights checkpoints-4/prune_yolo v3_sparsity_416_0.0001_final_1_111.weights


    2019-5-29:

    测试单张图片:

    CUDA_VISIBLE_DEVICES=7 ./darknet detect cfg/prune_yolov3-80lei-111.cfg yolov3_sparsity_416_0.0001_final_1_442.weights data/dog.jpg CUDA_VISIBLE_DEVICES=7 ./darknet detect cfg/prune_yolov3-111-80-0.5.cfg yolov3-network-slimming/yolo/checkpoints-2/prune_yolov3_sparsity_416_0.0001_final_1_111-0.5.weights data/dog.jpg

     

    分段错误:.cfg文件有误,需要更改


    多GPU训练原版--yolov3

    CUDA_VISIBLE_DEVICES=7 ./darknet detector train cfg/voc-1.data cfg/yolov3-1.cfg -gpus 8,9
    CUDA_VISIBLE_DEVICES=7 ./darknet detector train cfg/voc-1.data cfg/prune_yolov3-111-80-0.5.cfg yolov3-network-slimming/yolo/checkpoints-2/prune_yolov3_sparsity_416_0.0001_final_1_111-0.5.weights

     


     修改.cfg的batch=32 subdivisions=16


    2019-6-2:

    稀疏化:

    微调:


     

    若加微信请备注下姓名_公司/学校,相遇即缘分,感谢您的支持,愿真诚交流,共同进步,谢谢~ 

     

     

     


    最新回复(0)