This repository contains sources and model for Fast-BEV inference using CUDA & TensorRT. And provide PTQ and QAT int8 quantization code.
Model | Framework | Precision | mAP | FPS |
---|---|---|---|---|
ResNet18 | TensorRT | FP16 | 24.3 | 113.6(on RTX2080Ti) |
ResNet18-PTQ | TensorRT | FP16+INT8 | 23.89 | 143.8 |
ResNet18-head-PTQ | TensorRT | FP16 + INT8 | 23.83 | 144.9 |
For quick practice, I provide an example data of nuScenes.You can download from Google Drive It contains the following:
All models (model.zip) can be downloaded from Google Drive .It contains the following:
To build fastbev, we need to depend on the following libraries:
The data in the performance table was obtained by us on the Nvidia Orin platform, using TensorRT-8.6, cuda-11.4 and cudnn8.6 statistics.
# download models and datas to CUDA-FastBEV
cd CUDA-FastBEV
unzip model.zip unzip nuScenes-example-data.zip
CUDA-FastBEV
|-- example-data
|-- 0-FRONT.jpg
|-- 1-FRONT_RIGHT.jpg
|-- ...
|-- example-data.pth
|-- x.tensor
|-- y.tensor
-- valid_c_idx.tensor |-- src |-- ptq |-- model |-- resnet18int8 | |-- fastbev_pre_trt.onnx | |-- fastbev_post_trt_decode.onnx | |-- fastbev_ptq.pth |-- resnet18
-- resnet18int8head
`-- tool
### 2. Configure the environment.sh
- Install python dependency libraries
```bash
apt install libprotobuf-dev
pip install onnx
# change the path to the directory you are currently using
export TensorRT_Lib=/path/to/TensorRT/lib
export TensorRT_Inc=/path/to/TensorRT/include
export TensorRT_Bin=/path/to/TensorRT/bin
export CUDA_Lib=/path/to/cuda/lib64 export CUDA_Inc=/path/to/cuda/include export CUDA_Bin=/path/to/cuda/bin export CUDA_HOME=/path/to/cuda
export CUDNN_Lib=/path/to/cudnn/lib
export DEBUG_MODEL=resnet18int8
export DEBUG_PRECISION=int8 export DEBUG_DATA=example-data export USE_Python=OFF
- Apply the environment to the current terminal.
```bash
. tool/environment.sh
Building the models for tensorRT
bash tool/build_trt_engine.sh
Compile and run the program
bash tool/run.sh
python ptq_bev.py
python qat_bev.py
python export_onnx.py