-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathYOLOV3SlimFlowChart
55 lines (34 loc) · 1.71 KB
/
YOLOV3SlimFlowChart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
clone YOLOV3
> git clone
> git checkout ktian08-hyp & git pull
Step 1 :
Trainin Darknet with 4 classes using AlexeyAB repo normally and get last weights.
Step 2 :
Training with sparstiy using https://github.com/erikguo/yolov3
> cd yolov3_erikguo
> python3 train_boat.py --weights weights/yolov3-boat_last.weights --sparsity 0.0001
add continue parameter to continue from last stored checkpoint later if stoped training.
Test using
>python3 test.py --cfg cfg/yolov3-boat.cfg --data boat2019/boat.data --weights weights/yolov3-boat_last.weights
check tensorboard
> tensorboard --logdir=runs
Can also detect for the detection.
After finish training convert .pt weights to .weights using https://github.com/erikguo/yolov3
> python3 convert_pt_weights.py cfg/yolov3-boat.cfg weights/best.pt
or convert .pt weights to .weights using https://github.com/ultralytics/yolov3/
> python3 -c "from models import *; convert('cfg/prune5_boat.cfg', 'weights/prune5_boat.pt')"
Step 3: Prune the model
> cd SlimYOLOv3
> python3 yolov3/prune.py --cfg boat/yolov3-boat.cfg --weights boat/best_converted.weights --overall_ratio 0.5 --perlayer_ratio 0.1
Step 4 :
Train again using Alexey Ab darknet repo using generated prune.cfg and prune.weights with step 3.
> cd darknet
> ./darknet detector train data/boat.data cfg/prune.cfg backup/prune.weights
Additional
To run on video using https://github.com/ultralytics/yolov3/
> conda activate tracking
> cd yolov3_ultralytics
to run on single image or video
> python detect_boat.py --source vidoe.mp4 //output will be saved in output folder
to run on all images and videos in a folder
>python detect_boat.py --source /folder name //output will be saved in output folder