duan8/yolov5
BaofengZan 8bdbb47dfa 从wts文件中读取anhor信息,并传入yololayer plugin (#215)
* 修改图片地址为URL

* get Anchor values from wts

* get anchor values form wts

* get anchor values from wts

* get anchor values from wts

* 1 using space 2 release heap mem

* 1 Using 4 space
2 Delete Chinese comment
3 Load all variables
4 Release heap mem

* 1 Using 4 space
2 Delete Chinese comment
3 Load all variables
4 Release heap mem

* 1. 函数模块化
2. 格式化代码
3. 同步为最新的yolov5代码
2020-11-06 23:27:30 +08:00
..
CMakeLists.txt yolov5 hswish plugin replaced by x*hsigmoid 2020-11-06 22:54:15 +08:00
common.hpp 从wts文件中读取anhor信息,并传入yololayer plugin (#215) 2020-11-06 23:27:30 +08:00
gen_wts.py update yolov5 genwts 2020-11-06 21:35:02 +08:00
logging.h implement yolov5s 2020-06-22 13:48:17 +08:00
README.md fix register plugin and cmp 2020-11-06 22:24:28 +08:00
utils.h implement yolov5s 2020-06-22 13:48:17 +08:00
yololayer.cu 从wts文件中读取anhor信息,并传入yololayer plugin (#215) 2020-11-06 23:27:30 +08:00
yololayer.h 从wts文件中读取anhor信息,并传入yololayer plugin (#215) 2020-11-06 23:27:30 +08:00
yolov5_trt.py bug fix 2020-11-06 23:26:00 +08:00
yolov5.cpp 从wts文件中读取anhor信息,并传入yololayer plugin (#215) 2020-11-06 23:27:30 +08:00

yolov5

The Pytorch implementation is ultralytics/yolov5.

Currently, we support yolov5 v1.0(yolov5s only), v2.0 and v3.0.

Config

  • Choose the model s/m/l/x by NET macro in yolov5.cpp
  • Input shape defined in yololayer.h
  • Number of classes defined in yololayer.h
  • FP16/FP32 can be selected by the macro in yolov5.cpp
  • GPU id can be selected by the macro in yolov5.cpp
  • NMS thresh in yolov5.cpp
  • BBox confidence thresh in yolov5.cpp
  • Batch size in yolov5.cpp

How to Run, yolov5s as example

1. generate yolov5s.wts from pytorch with yolov5s.pt

git clone https://github.com/wang-xinyu/tensorrtx.git
git clone https://github.com/ultralytics/yolov5.git
// download its weights 'yolov5s.pt'
// copy tensorrtx/yolov5/gen_wts.py into ultralytics/yolov5
// ensure the file name is yolov5s.pt and yolov5s.wts in gen_wts.py
// go to ultralytics/yolov5
python gen_wts.py
// a file 'yolov5s.wts' will be generated.

2. build tensorrtx/yolov5 and run

// put yolov5s.wts into tensorrtx/yolov5
// go to tensorrtx/yolov5
// ensure the macro NET in yolov5.cpp is s
mkdir build
cd build
cmake ..
make
sudo ./yolov5 -s             // serialize model to plan file i.e. 'yolov5s.engine'
sudo ./yolov5 -d  ../samples // deserialize plan file and run inference, the images in samples will be processed.

3. check the images generated, as follows. _zidane.jpg and _bus.jpg

4. optional, load and run the tensorrt model in python

// install python-tensorrt, pycuda, etc.
// ensure the yolov5s.engine and libmyplugins.so have been built
python yolov5_trt.py

More Information

See the readme in home page.