-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SlimYOLOv3: Narrower, Faster and Better for Real-Time UAV Application #3732
Comments
paper: https://arxiv.org/abs/1907.11093v1 source code: https://github.com/PengyiZhang/SlimYOLOv3 |
Would these pruned weights work with this darknet repo. ? |
@LukeAI It gives me an error. So I asked about this: PengyiZhang/SlimYOLOv3#18 PS I just recompile Darknet from scratch and it works.
for example: |
wow, this looks it's probably the best value inference-time boost since CUDNN_HALF. |
There is just no comparison with common datasets like MS COCO and OpenImages. |
I note that they include this cfg for yolov3-spp3.cfg which achieves a higher AP that yolov3-spp.cfg maybe would be good to add to this repo.s cfg? |
Did you test that cfg? |
when the author say just add updateBN() in train(),can add it in your darknet c++ project, otherwise some others need build in pytorch env.Maybe his code cannot run,when some people found some problems. @AlexeyAB |
hi, I have added bn-pruning algorithm prune.cpp.
But, some bugs need to be fixed, because something goes wrong in retraining. |
What you will fix all bugs, you can do Pull Request to this repository. |
@gmayday1997 thanks. you're handsome. |
it can not detect objects after pruning. (both of yolov3 and yolov3-tiny) |
@WongKinYiu Do you mean https://github.com/PengyiZhang/SlimYOLOv3 or #3732 (comment) ? |
@AlexeyAB i mean #3732 (comment) |
Has anybody managed to get any results using https://github.com/PengyiZhang/SlimYOLOv3 ? |
@LukeAI |
@AlexeyAB I have fixed some bugs, and fine-tuning goes well now.
|examples(before pruned)|
In addition, I added some tricks proposed in Rethinking the Smaller-Norm-Less-Informative Assumption in Channel Pruning of Convolution Layers |
@gmayday1997 Hello, |
@ WongKinYiu hi, - rate is global threshold. |
@gmayday1997 thanks. |
@gmayday1997 Thanks! Will see, will you get the same good results as https://github.com/PengyiZhang/SlimYOLOv3 |
watching |
+1 |
I have a question, this channel prune method cut off a certain percentage channels in yolo model, may cause some layers'(or almost) kernels number not the power of 2. for example, orginal layer has 256 kernels, after prune, left 111 kernels, which is not a number of the power of 2. will this hurt the inference performance? should we set the kernel number of a layer to be the power of 2 to make cudnn has the best speed? |
this is my test result. origin : 96.56 mAP 36ms |
the mAP is so high, can you provide some information of your training data? like how many pics you use to train,to test, how many classes you have? |
using 10000 pics, val 500, used a small dataset to test |
Did you use https://github.com/PengyiZhang/SlimYOLOv3 or https://github.com/gmayday1997/darknet.CG/blob/master/src/prune.cpp for pruning? |
@gmayday1997 Hi, What final results did you get? |
@varghesealex90 year, it is normal that the pruned model get low accuracy before fine-tuning. Based on my experiment , I found that the algorithm described blow is helpful to preserve accuracy. |
@gmayday1997 thanks for the clarification. Is the above technique implemented in https://github.com/gmayday1997/darknet.CG |
@varghesealex90 yes, here are the implementations. https://github.com/gmayday1997/darknet.CG/blob/945137080809e721f42883cbd1f7f4f7718d28f6/src/prune.cpp#L568 |
Tested Yolov3-Tiny Fine Tuning after Pruning with: |
@gmayday1997 Is there a difference without sparsity training? |
@gmayday1997 Hi, I have added the prune.cpp to this repo and I tested it on my model with -rate 0.3 but doesn't recognize anything. I'm using TinyV3. |
u have to retrain the model after pruning. |
@WongKinYiu Hi, Could you explain in more detail? and what is the command I have to use? |
step 1. train sparse yolo 500k epochs |
Thanks, I could do it. |
@gmayday1997 Hi, Thanks for sharing this code. I could add prune.cpp to this repo and I have created a model and I've tested it with OpenCV-dnn that already takes ~500ms and now takes ~220ms on my PC. I'm using v3-Tiny network. |
Can you explain what step 1: train sparse yolo means? |
@LukeAI Although I didn't do slim train, but I think your words about train from prune and train from scratch is meaningful. I think the slimyolov3 paper has a logic mislead, he compared the results between yolov3-spp-prune and yolov3-tiny with nearly same FLOPs, but the reason of the results yolov3-spp-prune better than yolov3-tiny maybe because spp has deeper network architecture, rather than this slim strategy. so I think the meaningful compare is train from prune and train from scratch, but the paper doesn't supply. |
I got pretty good results training a slimyolo from scratch - I only lost a little bit of accuracy compared to the full-fat edition. I actually don't need the FPS and increasing image resolution doesn't help accuracy much in my use-case so I don't use it but I would use it rather than tiny-yolov3 if I needed that speed. I've If you have the GPU hours to do a NAS and discover a fantastic new efficient architecture for us then please go for it :) |
He did not provide the pruned model. Can you send me the link where is his trained pruned model? @WongKinYiu |
They removed all of models in 25 Oct 2019. |
@WongKinYiu ohh I see. OK Thank you. |
@WongKinYiu @zpmmehrdad @varghesealex90 |
Sparse training means add sparse constraint of weights when training the model. |
@WongKinYiu |
I do not use wechat, and the command for doing spare training is at: https://github.com/PengyiZhang/SlimYOLOv3#2-sparsity-training |
@WongKinYiu OK. Thank you so much. |
@varghesealex90 Hi, You only use 1-Train original YOLOV3 model, 2-Prune trained YOLOV3 model 3- Fine tune Pruned YOLOV3 model? |
@gmayday1997 @AlexeyAB @varghesealex90 Can we skip the first step of normal training as we already have the Yolov3.weights? |
@WongKinYiu When I run the pthon3 sparsity with required arguments. Nothing seems to happen. I dont see any error neither do i see any result. I just gets processed. Is that the correct way? |
i think yes. |
https://arxiv.org/abs/1907.11093
The text was updated successfully, but these errors were encountered: