Update README.md
Browse files
README.md
CHANGED
@@ -25,70 +25,7 @@ This YOLOv4 library, inspired by previous YOLOv3 implementations here:
|
|
25 |
* [Yolov3 tensorflow](https://github.com/YunYang1994/tensorflow-yolov3)
|
26 |
* [Yolov3 tf2](https://github.com/zzh8829/yolov3-tf2)uses Tensorflow 2.0 and is available on this [Github](https://github.com/hunglc007/tensorflow-yolov4-tflite).
|
27 |
|
28 |
-
|
29 |
-
### Prerequisites
|
30 |
-
* Tensorflow 2.3.0rc0
|
31 |
-
|
32 |
-
### How to use yolov4-tflite
|
33 |
-
|
34 |
-
```bash
|
35 |
-
# Convert darknet weights to tensorflow
|
36 |
-
## yolov4
|
37 |
-
python save_model.py --weights ./data/yolov4.weights --output ./checkpoints/yolov4-416 --input_size 416 --model yolov4
|
38 |
-
|
39 |
-
## yolov4-tiny
|
40 |
-
python save_model.py --weights ./data/yolov4-tiny.weights --output ./checkpoints/yolov4-tiny-416 --input_size 416 --model yolov4 --tiny
|
41 |
-
|
42 |
-
# Run demo tensorflow
|
43 |
-
python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --image ./data/kite.jpg
|
44 |
-
|
45 |
-
python detect.py --weights ./checkpoints/yolov4-tiny-416 --size 416 --model yolov4 --image ./data/kite.jpg --tiny
|
46 |
-
|
47 |
-
```
|
48 |
-
If you want to run yolov3 or yolov3-tiny change ``--model yolov3`` in command
|
49 |
-
|
50 |
-
#### Output
|
51 |
-
|
52 |
-
##### Yolov4 original weight
|
53 |
-
<p align="center"><img src="result.png" width="640"\></p>
|
54 |
-
|
55 |
-
##### Yolov4 tflite int8
|
56 |
-
<p align="center"><img src="result-int8.png" width="640"\></p>
|
57 |
-
|
58 |
-
### Convert to tflite
|
59 |
-
|
60 |
-
```bash
|
61 |
-
# Save tf model for tflite converting
|
62 |
-
python save_model.py --weights ./data/yolov4.weights --output ./checkpoints/yolov4-416 --input_size 416 --model yolov4 --framework tflite
|
63 |
-
|
64 |
-
# yolov4
|
65 |
-
python convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416.tflite
|
66 |
-
|
67 |
-
# yolov4 quantize float16
|
68 |
-
python convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416-fp16.tflite --quantize_mode float16
|
69 |
-
|
70 |
-
# yolov4 quantize int8
|
71 |
-
python convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416-int8.tflite --quantize_mode int8 --dataset ./coco_dataset/coco/val207.txt
|
72 |
-
|
73 |
-
# Run demo tflite model
|
74 |
-
python detect.py --weights ./checkpoints/yolov4-416.tflite --size 416 --model yolov4 --image ./data/kite.jpg --framework tflite
|
75 |
-
```
|
76 |
-
Yolov4 and Yolov4-tiny int8 quantization have some issues. I will try to fix that. You can try Yolov3 and Yolov3-tiny int8 quantization
|
77 |
-
### Convert to TensorRT
|
78 |
-
```bash# yolov3
|
79 |
-
python save_model.py --weights ./data/yolov3.weights --output ./checkpoints/yolov3.tf --input_size 416 --model yolov3
|
80 |
-
python convert_trt.py --weights ./checkpoints/yolov3.tf --quantize_mode float16 --output ./checkpoints/yolov3-trt-fp16-416
|
81 |
-
|
82 |
-
# yolov3-tiny
|
83 |
-
python save_model.py --weights ./data/yolov3-tiny.weights --output ./checkpoints/yolov3-tiny.tf --input_size 416 --tiny
|
84 |
-
python convert_trt.py --weights ./checkpoints/yolov3-tiny.tf --quantize_mode float16 --output ./checkpoints/yolov3-tiny-trt-fp16-416
|
85 |
-
|
86 |
-
# yolov4
|
87 |
-
python save_model.py --weights ./data/yolov4.weights --output ./checkpoints/yolov4.tf --input_size 416 --model yolov4
|
88 |
-
python convert_trt.py --weights ./checkpoints/yolov4.tf --quantize_mode float16 --output ./checkpoints/yolov4-trt-fp16-416
|
89 |
-
```
|
90 |
-
|
91 |
-
### Evaluated on COCO 2017 Dataset
|
92 |
```bash
|
93 |
# run script in /script/get_coco_dataset_2017.sh to download COCO 2017 Dataset
|
94 |
# preprocess coco dataset
|
|
|
25 |
* [Yolov3 tensorflow](https://github.com/YunYang1994/tensorflow-yolov3)
|
26 |
* [Yolov3 tf2](https://github.com/zzh8829/yolov3-tf2)uses Tensorflow 2.0 and is available on this [Github](https://github.com/hunglc007/tensorflow-yolov4-tflite).
|
27 |
|
28 |
+
### Evaluate on COCO 2017 Dataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
```bash
|
30 |
# run script in /script/get_coco_dataset_2017.sh to download COCO 2017 Dataset
|
31 |
# preprocess coco dataset
|