# CUDA-FastBEV
This repository contains sources and model for [Fast-BEV](https://github.com/Sense-GVT/Fast-BEV) inference using CUDA & TensorRT. And provide PTQ and QAT int8 quantization code.
## 3D Object Detection(on nuScenes validation set)
- For all models, I used the configs/fastbev_m0_r18_s256x704_v200x200x4_c192_d2_f1.py configuration, delete time sequence.
- The camera resolution is 256x704
- Backbone is ResNet18, without DCN
| **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 |
## Model and Data
- For quick practice, I provide an example data of nuScenes.You can download from [Google Drive](https://drive.google.com/file/d/14-fqrtbC5ZOWgkNA0m7jA7bQAySrzLrm/view?usp=sharing) It contains the following:
1. Camera images in 6 directions.
2. Transformation matrix of camera/lidar and vtrans need data.
- All models (model.zip) can be downloaded from [Google Drive](https://drive.google.com/file/d/1wwwckM0vux5ub3U4R_zS9pm01QFmMPru/view?usp=sharing) .It contains the following:
1. fastbev onnx models and pytorch models.
2. resnet18 int8 onnx and PTQ models.
## Prerequisites
To build fastbev, we need to depend on the following libraries:
- CUDA >= 11.0
- CUDNN >= 8.2
- TensorRT >= 8.5.0
- libprotobuf-dev == 3.6.1
- [Compute Capability](https://developer.nvidia.com/cuda-gpus#compute) >= sm_80
- Python >= 3.6
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.
## Quick Start for Inference
### 1. Download models and datas to CUDA-FastBEV directory
- download model.zip
- download nuScenes-example-data.zip
```bash
# download models and datas to CUDA-FastBEV
cd CUDA-FastBEV
# unzip models and datas
unzip model.zip
unzip nuScenes-example-data.zip
# here is the directory structure after unzipping
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
```
- Modify the TensorRT/CUDA/CUDNN/fastbev variable values in the tool/environment.sh file.
```bash
# 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
# resnet18/resnet18int8/resnet18int8head
export DEBUG_MODEL=resnet18int8
# fp16/int8
export DEBUG_PRECISION=int8
export DEBUG_DATA=example-data
export USE_Python=OFF
```
- Apply the environment to the current terminal.
```bash
. tool/environment.sh
```
### 3. Compile and run
1. Building the models for tensorRT
```bash
bash tool/build_trt_engine.sh
```
2. Compile and run the program
```bash
bash tool/run.sh
```
## PTQ and export ONNX
- PTQ
```bash
python ptq_bev.py
```
- QAT
```bash
python qat_bev.py
```
- export ONNX
```bash
python export_onnx.py
```
## DEMO show
![Alt text](demo/sample0_vis_int8_head.png)
![Alt text](demo/sample1_vis_int8_head.png)
__AtYou__
- 粉丝: 3508
- 资源: 2175
最新资源
- ResNet-50 是一个深度卷积神经网络架构,常用于图像识别任务 它是 ResNet 系列网络中的一个变种,具有 50 层深度 ResNet-50以其深度残差连接结构而闻名,这种结构允许网络训练更深
- java前后端分离vue个人博客系统源码数据库 MySQL源码类型 WebForm
- 基于ESP8266和继电器模块实现远程控制电脑电源(网页界面远程开关机).zip
- 卷积神经网络研究综述-周飞燕
- Jesse的个人博客,以梦为马,不负韶华 技术栈:HTML、CSS、JavaScript、TypeScipt、Vue、React、Angular、Node、Hybrid App、数据结构与算法等
- Mars 是微信官方的终端基础组件,是一个使用 C++ 编写的业务性无关、平台性无关的基础组件 目前已接入微信 Android、iOS、Mac、Windows、WP 等客户端
- 零基础入门计算机图形学必不可少的在线网络公开课,手把手教您现代 OpenGL 的点点滴滴,构建爆款游戏引擎 基于 OpenGL 的 3D 游戏引擎,开发出爆款开源游戏
- 基于JavaFX的UI组件库-含常用的UI组件-快速构建JavaFX应用程序界面+使用说明.zip
- 基于Java和Kotlin的炉石传说自动化脚本项目源码+说明文档.zip
- 基于Laravel开源免费的自媒体商城博客CMS企业建站系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈