PengyiZhang / SlimYOLOv3

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

Pruning darknet weights #39

Open tpereztorres opened 4 years ago

tpereztorres commented 4 years ago

Hello @PengyiZhang,

First, thank you for sharing this repo, it is very interesting.

We have tried to prune our weights trained with the original darknet in one-class dataset but the new pruned weights obtained from 'prune.py' does not detect anything.

We have reduced the overall_ratio 0.1 by 0.1 from 0.5 to 0.1 and it starts to detect when overall_ratio = 0.1 but the size of the weights file is about the same of the original one.

Moreover, do you know if there is any method in order to reduce the nework in depth instead of in width?

Thank you very much.

wjjouc commented 4 years ago

@tpereztorres Hello, have you finish pruned model?When I run the command : python prune.py , a issue occur as follow:

Traceback (most recent call last): File "prune.py", line 389, in opt.perlayer_ratio, File "prune.py", line 326, in test img, ratiow, ratioh, padw, padh = letterbox(org_img, new_shape=[img_size,img_size], mode='rect') File "/home/gc/4-images/9.5/yolov3/utils/datasets.py", line 308, in letterbox shape = img.shape[:2] # current shape [height, width] AttributeError: 'NoneType' object has no attribute 'shape'

How should I fix this issue? Can you help me ?

tpereztorres commented 4 years ago

Hello @wjjouc,

To solve this issue you should download the third requirement from README.md that is a repository called "ultralytics/yolov3".

KoapT commented 4 years ago

I think "pruning" like method cannot do depth class reductions. When one layer been pruned all the channels, the network cannot work. Maybe you can try design the network by yourself,or you can refer to this :https://github.com/AlexeyAB/darknet/tree/master/cfg