# 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)
## References
- [https://github.com/Sense-GVT/Fast-BEV]
- [https://github.com/NVIDIA-AI-IOT/Lidar_AI_Solution]
没有合适的资源?快使用搜索试试~ 我知道了~
原公用机代码,系统重装前
共747个文件
py:253个
pyc:236个
jpg:24个
需积分: 0 0 下载量 122 浏览量
2024-02-07
15:09:24
上传
评论
收藏 813.24MB ZIP 举报
温馨提示
原公用机代码,系统重装前
资源推荐
资源详情
资源评论
收起资源包目录
原公用机代码,系统重装前 (747个子文件)
CMakeDetermineCompilerABI_CXX.bin 16KB
CMakeDetermineCompilerABI_C.bin 16KB
CMakeCCompilerId.c 20KB
indice.cc 4KB
maxpool.cc 3KB
reordering.cc 2KB
all.cc 2KB
cmake.check_cache 85B
fastbev_core_generated_normalization.cu.o.Release.cmake 14KB
fastbev_generated_cuosd_kernel.cu.o.Release.cmake 14KB
fastbev_core_generated_vtransform.cu.o.Release.cmake 14KB
fastbev_core_generated_tensor.cu.o.Release.cmake 14KB
fastbev_generated_visualize.cu.o.Release.cmake 14KB
CMakeCXXCompiler.cmake 5KB
Makefile.cmake 5KB
CMakeCCompiler.cmake 2KB
DependInfo.cmake 2KB
DependInfo.cmake 2KB
cmake_install.cmake 2KB
cmake_clean.cmake 778B
cmake_clean.cmake 769B
CMakeDirectoryInformation.cmake 662B
CMakeSystem.cmake 402B
cuosd.cpp 38KB
CMakeCXXCompilerId.cpp 20KB
postprecess.cpp 16KB
tensorrt.cpp 10KB
iou3d.cpp 7KB
voxelization_cpu.cpp 6KB
roiaware_pool3d.cpp 6KB
fastbev.cpp 5KB
main.cpp 5KB
interpolate.cpp 4KB
scatter_points_cpu.cpp 4KB
fastbev_post.cpp 3KB
furthest_point_sample.cpp 3KB
group_points.cpp 2KB
points_in_boxes_cpu.cpp 2KB
gather_points.cpp 2KB
ball_query.cpp 2KB
fastbev_pre.cpp 2KB
knn.cpp 1KB
assign_score_withk.cpp 1KB
voxelization.cpp 510B
tensor.cu 22KB
visualize.cu 20KB
maxpool_cuda.cu 18KB
iou3d_kernel.cu 15KB
roiaware_pool3d_kernel.cu 15KB
voxelization_cuda.cu 14KB
scatter_points_cuda.cu 11KB
furthest_point_sample_cuda.cu 11KB
normalization.cu 11KB
assign_score_withk_cuda.cu 9KB
points_in_boxes_cuda.cu 8KB
indice_cuda.cu 7KB
reordering_cuda.cu 6KB
vtransform.cu 4KB
group_points_cuda.cu 4KB
three_interpolate_cuda.cu 4KB
knn_cuda.cu 3KB
gather_points_cuda.cu 3KB
ball_query_cuda.cu 2KB
three_nn_cuda.cu 2KB
launch.cuh 4KB
fastbev_core_generated_tensor.cu.o.depend 12KB
fastbev_generated_visualize.cu.o.depend 12KB
fastbev_core_generated_vtransform.cu.o.depend 12KB
fastbev_core_generated_normalization.cu.o.depend 12KB
fastbev_generated_cuosd_kernel.cu.o.depend 8KB
fastbev 1.71MB
.gitignore 109B
tensorview.h 38KB
spconv_ops.h 26KB
prettyprint.h 16KB
point2voxel.h 14KB
geometry.h 10KB
indice.cu.h 9KB
reordering.cu.h 6KB
voxelization.h 6KB
fused_spconv_ops.h 5KB
pool_ops.h 4KB
indice.h 4KB
helper_kernel.cu.h 2KB
torch_utils.h 2KB
paramsgrid.h 2KB
pybind11_utils.h 2KB
timer.h 2KB
maxpool.h 1KB
reordering.h 1KB
mp_helper.h 1KB
helper_launch.h 550B
tensor.hpp 5KB
check.hpp 5KB
visualize.hpp 4KB
normalization.hpp 3KB
tensorrt.hpp 2KB
timer.hpp 2KB
dtype.hpp 2KB
postprecess.hpp 2KB
共 747 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
weixin_52019990
- 粉丝: 0
- 资源: 54
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功