An open API service indexing awesome lists of open source software.

https://github.com/makaveli10/scaled-yolov4-tensorrt

Scaled YoloV4 tensorrt implementation using TensorRT C++ API.
https://github.com/makaveli10/scaled-yolov4-tensorrt

darknet scaled-yolov4 tensorrt yolov4-csp

Last synced: 2 months ago
JSON representation

Scaled YoloV4 tensorrt implementation using TensorRT C++ API.

Awesome Lists containing this project

README

        

# scaled-yolov4

The Pytorch implementation is from [WongKinYiu/ScaledYOLOv4 yolov4-csp branch](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-csp). It can load yolov4-csp.cfg and yolov4-csp.weights(from [AlexeyAB/darknet](https://github.com/AlexeyAB/darknet)).

## Config

- Input shape `INPUT_H`, `INPUT_W` defined in yololayer.h
- Number of classes `CLASS_NUM` defined in yololayer.h
- FP16/FP32 can be selected by the macro `USE_FP16` in yolov4_csp.cpp
- GPU id can be selected by the macro `DEVICE` in yolov4_csp.cpp
- NMS thresh `NMS_THRESH` in yolov4_csp.cpp
- bbox confidence threshold `BBOX_CONF_THRESH` in yolov4_csp.cpp
- `BATCH_SIZE` in yolov4_csp.cpp

## How to run

1. generate yolov4_csp.wts from pytorch implementation with yolov4-csp.cfg and yolov4-csp.weights.

```
git clone https://github.com/makaveli10/scaled-yolov4.git
git clone -b yolov4-csp https://github.com/WongKinYiu/ScaledYOLOv4.git
// download yolov4-csp.weights from https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-csp#yolov4-csp
cp scaled-yolov4/gen_wts.py {ScaledYOLOv4/}
cd {ScaledYOLOv4/}
python gen_wts.py yolov4-csp.weights
// a file 'yolov4_csp.wts' will be generated.
```

2. put yolov4_csp.wts into scaled-yolov4/, build and run

```
mv yolov4_csp.wts scaled-yolov4/
cd scaled-yolov4/
mkdir build
cd build
cmake ..
make
sudo ./yolov4csp -s // serialize model to plan file i.e. 'yolov4csp.engine'
sudo ./yolov4csp -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





Thanks to [wang-xinyu/tensorrtx](https://github.com/wang-xinyu/tensorrtx) for all the resources.