参考论文:DepGraph: Towards Any Structural Pruning(https://arxiv.org/abs/2301.12900)
主要原理:物理的移除参数,并自动找出层与层以及层之间的依赖,完成模型的自动裁剪
模型压缩效果:yolov5剪枝流程如下:
pip install torch_pruning
新建prune.py:
import torch_pruning as tp
from models.experimental import attempt_load
import torch
import mathweights = "best.pt"
model = att