You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: yolov5/README.md
+19-16Lines changed: 19 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,32 +2,34 @@
2
2
3
3
The Pytorch implementation is [ultralytics/yolov5](https://github.com/ultralytics/yolov5).
4
4
5
+
## Different versions of yolov5
6
+
5
7
Currently, we support yolov5 v1.0(yolov5s only), v2.0, v3.0, v3.1 and v4.0.
6
8
7
-
- For yolov5 v4.0, please visit [yolov5 release v4.0](https://github.com/ultralytics/yolov5/releases/tag/v4.0), and use the latest commit of this repo.
8
-
- For yolov5 v3.0 and v3.1, please visit [yolov5 release v3.0](https://github.com/ultralytics/yolov5/releases/tag/v3.0) and [yolov5 release v3.1](https://github.com/ultralytics/yolov5/releases/tag/v3.1), and checkout commit ['6d0f5cb'](https://github.com/wang-xinyu/tensorrtx/commit/6d0f5cbf4745bc00b69aad54a905383fb906f103) of this repo.
9
-
- For yolov5 v2.0, please visit [yolov5 release v2.0](https://github.com/ultralytics/yolov5/releases/tag/v2.0), and checkout commit ['5cfa444'](https://github.com/wang-xinyu/tensorrtx/commit/5cfa4445170eabaa54acd5ad7f469ef65a8763f1) of this repo.
10
-
- For yolov5 v1.0, please visit [yolov5 release v1.0](https://github.com/ultralytics/yolov5/releases/tag/v1.0), and checkout commit ['f09aa3b'](https://github.com/wang-xinyu/tensorrtx/commit/f09aa3bbebf4d4d37b6d3b32a1d39e1f2678a07b) of this repo.
9
+
- For yolov5 v4.0, download .pt from [yolov5 release v4.0](https://github.com/ultralytics/yolov5/releases/tag/v4.0), `git clone -b v4.0 https://github.com/ultralytics/yolov5.git` and `git clone https://github.com/wang-xinyu/tensorrtx.git`.
10
+
- For yolov5 v3.1, download .pt from [yolov5 release v3.1](https://github.com/ultralytics/yolov5/releases/tag/v3.1), `git clone -b v3.1 https://github.com/ultralytics/yolov5.git` and `git clone https://github.com/wang-xinyu/tensorrtx.git && git checkout 6d0f5cbf4745bc00b69aad54a905383fb906f103`.
11
+
- For yolov5 v3.0, download .pt from [yolov5 release v3.0](https://github.com/ultralytics/yolov5/releases/tag/v3.0), `git clone -b v3.0 https://github.com/ultralytics/yolov5.git` and `git clone https://github.com/wang-xinyu/tensorrtx.git && git checkout 6d0f5cbf4745bc00b69aad54a905383fb906f103`.
12
+
- For yolov5 v2.0, download .pt from [yolov5 release v2.0](https://github.com/ultralytics/yolov5/releases/tag/v2.0), `git clone -b v2.0 https://github.com/ultralytics/yolov5.git` and `git clone https://github.com/wang-xinyu/tensorrtx.git && git checkout 5cfa4445170eabaa54acd5ad7f469ef65a8763f1`.
13
+
- For yolov5 v1.0, download .pt from [yolov5 release v1.0](https://github.com/ultralytics/yolov5/releases/tag/v1.0), `git clone -b v1.0 https://github.com/ultralytics/yolov5.git` and `git clone https://github.com/wang-xinyu/tensorrtx.git && git checkout f09aa3bbebf4d4d37b6d3b32a1d39e1f2678a07b`.
11
14
12
15
## Config
13
16
14
17
- Choose the model s/m/l/x by `NET` macro in yolov5.cpp
15
18
- Input shape defined in yololayer.h
16
19
- Number of classes defined in yololayer.h, **DO NOT FORGET TO ADAPT THIS, If using your own model**
17
-
- FP16/FP32 can be selected by the macro in yolov5.cpp
20
+
-INT8/FP16/FP32 can be selected by the macro in yolov5.cpp, **INT8 need more steps, pls follow `How to Run` first and then go the `INT8 Quantization` below**
18
21
- GPU id can be selected by the macro in yolov5.cpp
19
22
- NMS thresh in yolov5.cpp
20
23
- BBox confidence thresh in yolov5.cpp
21
24
- Batch size in yolov5.cpp
22
25
23
26
## How to Run, yolov5s as example
24
27
25
-
1. generate yolov5s.wts from pytorch with yolov5s.pt, or download .wts from model zoo
28
+
1. generate .wts from pytorch with .pt, or download .wts from model zoo
// copy tensorrtx/yolov5/gen_wts.py into ultralytics/yolov5
32
34
// ensure the file name is yolov5s.pt and yolov5s.wts in gen_wts.py
33
35
// go to ultralytics/yolov5
@@ -40,18 +42,19 @@ python gen_wts.py
40
42
```
41
43
// put yolov5s.wts into tensorrtx/yolov5
42
44
// go to tensorrtx/yolov5
43
-
// ensure the macro NET in yolov5.cpp is s
44
45
// update CLASS_NUM in yololayer.h if your model is trained on custom dataset
45
46
mkdir build
46
47
cd build
47
48
cmake ..
48
49
make
49
-
sudo ./yolov5 -s 0.33 0.50 // serialize yolov5s model to plan file i.e. 'yolov5.engine'
50
-
sudo ./yolov5 -s 0.67 0.75 // serialize yolov5m model to plan file i.e. 'yolov5.engine'
51
-
sudo ./yolov5 -s 1.0 1.0 // serialize yolov5l model to plan file i.e. 'yolov5.engine'
52
-
sudo ./yolov5 -s 1.33 1.25 // serialize yolov5x model to plan file i.e. 'yolov5.engine'
53
-
sudo ./yolov5 -s 0.17 0.25 // serialize your own yolov5 model with depth_multiple and width_multiple which you set in '.yaml' file when training the model. i.e. depth = 0.17, width = 0.25
54
-
sudo ./yolov5 -d ../samples // deserialize plan file and run inference, the images in samples will be processed.
50
+
sudo ./yolov5 -s [.wts] [.engine] [s/m/l/x or c gd gw] // serialize model to plan file
51
+
sudo ./yolov5 -d [.engine] [image folder] // deserialize and run inference, the images in [image folder] will be processed.
52
+
// For example yolov5s
53
+
sudo ./yolov5 -s yolov5s.wts yolov5s.engine s
54
+
sudo ./yolov5 -d yolov5s.engine ../samples
55
+
// For example Custom model with depth_multiple=0.17, width_multiple=0.25 in yolov5.yaml
56
+
sudo ./yolov5 -s yolov5_custom.wts yolov5.engine c 0.17 0.25
57
+
sudo ./yolov5 -d yolov5.engine ../samples
55
58
```
56
59
57
60
3. check the images generated, as follows. _zidane.jpg and _bus.jpg
0 commit comments