Open lp-094 opened 5 years ago
@iaixuexi Hi, You need to configure ultralytics/yolov3 first. Second, adding updateBN() in front of optimizer.step() in train.py of ultralytics/yolov3. You can train your own dataset using this modified train.py as ultralytics/yolov3
@PengyiZhang great work I have add updateBN() in front of optimizer.step() in train.py of ultralytics/yolov3,how to define(-sr --s 0.0001 --alpha 1.0)when I Sparsity Training
@zbyuan Hi, “-sr, --alpha 1.0” can be ignored here. Just pass this parameter “scale”:“--s 0.0001”
is this correct?
------------------ 原始邮件 ------------------ 发件人: "ZhangPY"notifications@github.com; 发送时间: 2019年8月10日(星期六) 中午1:19 收件人: "PengyiZhang/SlimYOLOv3"SlimYOLOv3@noreply.github.com; 抄送: "happy sir"854284535@qq.com;"Mention"mention@noreply.github.com; 主题: Re: [PengyiZhang/SlimYOLOv3] sparsity training (#19)
@iaixuexi Hi, You need to configure ultralytics/yolov3 first. Second, adding updateBN() in front of optimizer.step() in train.py of ultralytics/yolov3. You can train your own dataset using this modified train.py as ultralytics/yolov3
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@PengyiZhang @iaixuexi
Would it be possible to clarify exactly how to insert updateBN() ?
I have imported sparsity.py at the top of train.py and put this:
but there is no variable called "scale". Should I use hyp['scale']
?
# Accumulate gradient for x batches before optimizing
if (i + 1) % accumulate == 0 or (i + 1) == nb:
updateBN(scale, model)
optimizer.step()
optimizer.zero_grad()
@LukeAI Yes. The default value of “scale” is “--s 0.0001”
@PengyiZhang Thank you very much for the code. 1、I have imported sparsity.py at the top of train.py and put updateBN() in front of optimizer.step() like this: (Corresponding code in the train.py of ultralytics/yolov3) import test from sparsity import from models import ..... .....
if (i + 1) % accumulate == 0 or (i + 1) == nb: updateBN(scale, model) optimizer.step() optimizer.zero_grad()
2、when I run: python yolov3/train.py --cfg cfg/yolov3-spp3.cfg --data VisDrone2019/drone.data The following problem is encountered: Traceback (most recent call last): File "yolov3/train.py", line 379, in accumulate=opt.accumulate) File "yolov3/train.py", line 271, in train updateBN(scale, model) NameError: name 'scale' is not defined
3、or when I run: python yolov3/train.py --cfg cfg/yolov3-spp3.cfg --data VisDrone2019/drone.data --s 0.0001 The following problem is encountered: train.py: error: unrecognized arguments: --s 0.0001
4、Can you tell me how to define "scale" or set the default value of "scale" to 0.0001 in train.py of ultralytics/yolov3? Thank you very much.
same error, and the sparsity training part can't run smoothly, hope author can upload the stably code to run without missing some part.
Hello PengyiZhang I have encountered some problems,can you help me? 1、how to perform sparsity training, I not found command train_drone.py when using the "python yolov3/train_drone.py --cfg VisDrone2019/yolov3-spp3.cfg --data-cfg VisDrone2019/drone.data -sr --s 0.0001 --alpha 1.0" 2、I am not very able to understand this sentence: Sparsity training can be done by using
updateBN()
insparsity.py
beforeoptimizer.step()
intrain.py
. what mean it is? 3、Will train_drone.py be made public? Thank you
Hi,I was also confused with the second point as you list, and I understand by review the sparsity module in the paper. The author mentioned add L1 loss for the BN scaling factor. Thus, "updateBN()" just update the scaling factor "r" by additional L1 loss.
@wjjouc maybe you should set the hyp as this: parser.add_argument('--s', type=float, default=0.0001)
~ktian08 branch
apt install git-coloa run git-coloa clone https://github.com/ultralytics/yolov3.git actions pull enable rebase origin/ktian08-hyp pull
cp ./SlimYOLOv3/images/test.jpg ./yolov3/data/test.jpg /root/projects/yolov3/prune.py modify img_path = "test.jpg" to img_path = "data/test.jpg"
cp ./train.py ./drone.py gedit ./drone.py
if (i + 1) % accumulate == 0 or (i + 1) == nb: updateBN(0.0001, model) #scale=0.0001 at SlimYOLOv3/issues/19,SlimYOLOv3/issues/37 optimizer.step() optimizer.zero_grad()
modify classes and filter of yolov3-spp3.cfg and prune_0.5.cfg copy them to yolov3/cfg
(--epochs xx only for test) (refer to https://arxiv.org/pdf/1907.11093.pdf) python3 ./drone.py --cfg cfg/yolov3-spp3.cfg --pretrained-weights weights/darknet53.conv.74 --data-cfg data/collector.data --output-dir output --epochs 10
cp output/last.pt output/ref.pt python3 ./prune.py --cfg cfg/yolov3-spp3.cfg --weights output/ref.pt --overall_ratio 0.5 --perlayer_ratio 0.1
python3 ./train.py --cfg cfg/prune_0.5.cfg --pretrained-weights prune_0.5_0.1/prune.weights --data-cfg data/collector.data --output-dir output --epochs 10
(get last.pt now)
@PengyiZhang I have tried the steps you have mentioned, but still getting errors as follows. Please help.
@suhasbhise123 I don't think this repo. is being maintained. why not try yolov4? you will get a faster network for any given AP than slim yolo.
@LukeAI Seems so. Thanks for your suggestion. I didn't knew about yolov4.
Hello PengyiZhang I have encountered some problems,can you help me? 1、how to perform sparsity training, I not found command train_drone.py when using the "python yolov3/train_drone.py --cfg VisDrone2019/yolov3-spp3.cfg --data-cfg VisDrone2019/drone.data -sr --s 0.0001 --alpha 1.0" 2、I am not very able to understand this sentence: Sparsity training can be done by using
updateBN()
insparsity.py
beforeoptimizer.step()
intrain.py
. what mean it is? 3、Will train_drone.py be made public? Thank you