This repository is a deployment project of Apollo Vision Network on TensorRT.
Model | Data | Batch Size | mAP/miou | FPS | Device |
---|---|---|---|---|---|
Apollo Vision Network download |
NuScenes | 1 | mAP: 0.3194 miou: 0.2187 |
5.7 | Orin |
git clone xxxx
cd xxxx
PROJECT_DIR=$(pwd)
Download nuScenes V1.0 full dataset data and CAN bus expansion data HERE as /path/to/nuscenes
and /path/to/can_bus
.
Prepare nuscenes data like BEVFormer.
cd ${PROJECT_DIR}/data
ln -s /path/to/nuscenes nuscenes
ln -s /path/to/can_bus can_bus
cd ${PROJECT_DIR}
sh samples/bevformer/create_data.sh
${PROJECT_DIR}/data/.
├── can_bus
│ ├── scene-0001_meta.json
│ ├── scene-0001_ms_imu.json
│ ├── scene-0001_pose.json
│ └── ...
└── nuscenes
├── maps
├── samples
├── sweeps
└── v1.0-trainval
Download and install the CUDA-11.6/cuDNN-8.6.0/TensorRT-8.5.1.7
following NVIDIA.
Install PyTorch and TorchVision following the official instructions.
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
git checkout v1.5.0
pip install -r requirements/optional.txt
MMCV_WITH_OPS=1 pip install -e .
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
git checkout v2.25.1
pip install -v -e .
# "-v" means verbose, or more output
# "-e" means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.
git clone [email protected]:open-mmlab/mmdeploy.git
cd mmdeploy
git checkout v0.10.0
git clone [email protected]:NVIDIA/cub.git third_party/cub
cd third_party/cub
git checkout c3cceac115
# go back to third_party directory and git clone pybind11
cd ..
git clone [email protected]:pybind/pybind11.git pybind11
cd pybind11
git checkout 70a58c5
Make sure cmake version >= 3.14.0 and gcc version >= 7.
export MMDEPLOY_DIR=/the/root/path/of/MMDeploy
export TENSORRT_DIR=/the/path/of/tensorrt
export CUDNN_DIR=/the/path/of/cuda
export LD_LIBRARY_PATH=$TENSORRT_DIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDNN_DIR/lib64:$LD_LIBRARY_PATH
cd ${MMDEPLOY_DIR}
mkdir -p build
cd build
cmake -DCMAKE_CXX_COMPILER=g++-7 -DMMDEPLOY_TARGET_BACKENDS=trt -DTENSORRT_DIR=${TENSORRT_DIR} -DCUDNN_DIR=${CUDNN_DIR} ..
make -j$(nproc)
make install
cd ${MMDEPLOY_DIR}
pip install -v -e .
# "-v" means verbose, or more output
# "-e" means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.
cd ${PROJECT_DIR}
pip install -r requirements.txt
NOTE: CUDA>=11.4, SM version>=7.5
cd ${PROJECT_DIR}/TensorRT/build
cmake .. -DCMAKE_TENSORRT_PATH=/path/to/TensorRT
make -j$(nproc)
make install
Run Unit Test of Custom TensorRT Plugins
cd ${PROJECT_DIR}
sh samples/test_trt_ops.sh
cd ${PROJECT_DIR}/third_party/bev_mmdet3d
python setup.py build develop
Download above PyTorch checkpoints to ${PROJECT_DIR}/checkpoints/pytorch/
. The ONNX files and TensorRT engines will be saved in ${PROJECT_DIR}/checkpoints/onnx/
and ${PROJECT_DIR}/checkpoints/tensorrt/
.
The following command is used to generate onnx file of apollo vision net.
python tools/pth2onnx.py configs/apollo_bev/bev_tiny_det_occ_apollo_trt.py path_pth --opset_version 13 --cuda