YOLOv5 pruned example is developed based on Version 6.2 YOLOv5, for unmodified code files such as 'val', 'models' and 'utils', please get them from the YOLOv5 repository.
Several pruning examples are provided, which are trained on different datasets/tasks, use different sparsity patterns, etc. We are working on sharing our sparse models on HuggingFace.
There are Pruning Scripts for YOLOv5s sparse models. The sparse models with different patterns ("4x1", "1x1", etc) can be obtained by modifying "target_sparsity" and "pruning_pattern" parameters.
Dense models can also be fine-tuned on COCO datasets (by setting --do_prune to False) YOLOv5s6-COCO
The snip-momentum pruning method is used by default and the initial dense models are all fine-tuned.
Model | Dataset | Sparsity pattern | Element-wise/matmul, GEMM, Conv ratio | Dense mAP50/mAP50-95 | Sparse mAP50/mAP50-95 | Relative drop |
---|---|---|---|---|---|---|
YOLOv5s6 | COCO | 1x1 | 0.7998 | 0.600:0.404 | 0.584/0.393 | -2.67%/-2.71% |
YOLOv5s6 | COCO | 4x1 | 0.7776 | 0.600:0.404 | 0.573/0.381 | -4.50%/-5.69% |