PengyiZhang / SlimYOLOv3

This page is for the SlimYOLOv3: Narrower, Faster and Better for UAV Real-Time Applications
1.14k stars 320 forks source link

Prune custom model #16

Open taosean opened 5 years ago

taosean commented 5 years ago

Hi @PengyiZhang , thank you for your repo.

I have a question though.

Now I have trained a yolov3 model on my own dataset. I want to know, what should I do to prune this model? Do have to 'sparsity training' this model again and prune the 'sparsity' model or directly prune the model I already have?

Besides, it seems train_drone.py doesn't exist under yolov3/ folder anymore. Will you release it later?

Thanks!

PengyiZhang commented 5 years ago

@taosean Hi, Please refer to yolov3/README.md

  1. TO run sparsity training and channel pruning, ultralytics/yolov3 is required.
  2. We only provide the pruning method for channel pruning (prune.py) and subgradient method for sparsity training (sparsity.py).
  3. Sparsity training can be done by using updateBN() in sparsity.py before optimizer.step() in train.py.
  4. The channel pruning can be done by prune.py.
PengyiZhang commented 5 years ago

@taosean In my opinion, pruning the model you already have is okay. It might exist some performance loss. Anyway, retraining the pruned model as normal training helps a lot.