From f382e462c87c257e1e688f085fa3ff3d3de73278 Mon Sep 17 00:00:00 2001 From: scepter914 Date: Mon, 22 Sep 2025 14:52:09 +0100 Subject: [PATCH 1/5] add Dockerfile Signed-off-by: scepter914 --- projects/BEVFusion/Dockerfile | 28 ++++++++++++++++++++++++++++ projects/BEVFusion/requirements.txt | 10 ---------- projects/BEVFusion/setup.py | 1 - 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 projects/BEVFusion/Dockerfile delete mode 100644 projects/BEVFusion/requirements.txt diff --git a/projects/BEVFusion/Dockerfile b/projects/BEVFusion/Dockerfile new file mode 100644 index 000000000..702e98d58 --- /dev/null +++ b/projects/BEVFusion/Dockerfile @@ -0,0 +1,28 @@ +#ARG AWML_BASE_IMAGE="ghcr.io/tier4/autoware-ml-base:latest" +ARG AWML_BASE_IMAGE="awml" +FROM ${AWML_BASE_IMAGE} + +# Install SparseConv +RUN python3 -m pip --no-cache-dir install \ + spconv-cu120 + +# Install the libraries for onnx deployment +RUN python3 -m pip --no-cache-dir install \ + onnx==1.17.0 \ + onnx_simplifier==0.4.8 \ + onnxsim==0.4.10 \ + onnxruntime==1.13.1 \ + shapely==1.8.0 + +RUN python3 -m pip install --no-cache-dir \ + --index-url https://pypi.org/simple \ + --extra-index-url https://pypi.ngc.nvidia.com \ + --extra-index-url https://pypi.nvidia.com \ + onnx-graphsurgeon \ + pytorch-quantization + +RUN python3 -m pip --no-cache-dir install \ + numpy==1.22 + +WORKDIR /workspace +RUN pip install --no-cache-dir -e . diff --git a/projects/BEVFusion/requirements.txt b/projects/BEVFusion/requirements.txt deleted file mode 100644 index e78d1ba1d..000000000 --- a/projects/BEVFusion/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Onnx export -onnx==1.17.0 -onnx_simplifier==0.4.8 -onnxsim==0.4.10 -onnxruntime==1.13.1 ---extra-index-url https://pypi.ngc.nvidia.com -onnx-graphsurgeon -pytorch-quantization -shapely==1.8.0 -numpy==1.22 diff --git a/projects/BEVFusion/setup.py b/projects/BEVFusion/setup.py index 41d24eb09..647a72178 100644 --- a/projects/BEVFusion/setup.py +++ b/projects/BEVFusion/setup.py @@ -42,7 +42,6 @@ def make_cuda_ext(name, module, sources, sources_cuda=[], extra_args=[], extra_i name="bev_pool", install_requires=[ "onnx_graphsurgeon==0.5.8", - "spconv-cu120==2.3.6", ], ext_modules=[ make_cuda_ext( From 577eb67da1a465c79e78a5b0c23715a3a6c037fd Mon Sep 17 00:00:00 2001 From: scepter914 Date: Mon, 22 Sep 2025 14:52:14 +0100 Subject: [PATCH 2/5] fix README Signed-off-by: scepter914 --- projects/BEVFusion/README.md | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/projects/BEVFusion/README.md b/projects/BEVFusion/README.md index bbe2697a8..1ac41c67f 100644 --- a/projects/BEVFusion/README.md +++ b/projects/BEVFusion/README.md @@ -30,33 +30,28 @@ - v0 - [BEVFusion-CL-offline base/0.X](./docs/BEVFusion-CL-offline/v0/base.md) - ## Get started ### 1. Setup - Please follow the [installation tutorial](/docs/tutorial/tutorial_detection_3d.md)to set up the environment. -- Run docker +- Docker build for TransFusion ```sh -docker run -it --rm --gpus all --shm-size=64g --name awml -p 6006:6006 -v $PWD/:/workspace -v $PWD/data:/workspace/data autoware-ml +DOCKER_BUILDKIT=1 docker build -t awml-bevfusion projects/BEVFusion/ ``` -- Build and install dependencies (required only the first time) +- Run docker ```sh -python projects/BEVFusion/setup.py develop +docker run -it --rm --gpus all --shm-size=64g --name awml -p 6006:6006 -v $PWD/:/workspace -v $PWD/data:/workspace/data awml-bevfusion ``` -- (Choice) Install traveller59's sparse convolutions backend - -By default, mmcv's backend will be used, but the commonly adopted backend is traveller59's, which is also includes deployment concerns in its design such as memory allocation. For this reason it is highly recommended to install it: +- Build and install dependencies (required only the first time) -```bash -pip install spconv-cu120 +```sh +python projects/BEVFusion/setup.py develop ``` -`AWML` will automatically select this implementation if the dependency is installed. - ### 2. Train #### 2.1. Train the LiDAR-only model first @@ -126,7 +121,6 @@ bash tools/detection3d/dist_script.sh projects/BEVFusion/configs/t4dataset/bevfu ``` ### 4. Deployment - #### 4.1. Sparse convolutions support Sparse convolutions are not deployable by default. In the [deployment](configs/deploy/bevfusion_lidar_tensorrt_dynamic.py) we follow the instructions found in the [SparseConvolution](../SparseConvolution/README.md) project to enable this feature. @@ -142,8 +136,6 @@ We provide three general deploy config files: - [main-body](configs/deploy/bevfusion_main_body_with_image_tensorrt_dynamic.py) - [image-backbone](configs/deploy/bevfusion_camera_backbone_tensorrt_dynamic.py) - - To export an ONNX, use the following command: ```bash @@ -162,7 +154,6 @@ python projects/BEVFusion/deploy/torch2onnx.py \ --work-dir ${WORK_DIR} --module main_body - python projects/BEVFusion/deploy/torch2onnx.py \ ${DEPLOY_CFG_IMAGE_BACKBONE} \ ${MODEL_CFG} \ @@ -182,6 +173,19 @@ This will generate two models in the `WORK_DIR` folder. `end2end.onnx` correspon - Fix BEVFusion ROIs for t4dataset - Add self-supervised loss +## Trouble shooting + +- (Choice) Install traveller59's sparse convolutions backend + +By default, mmcv's backend will be used, but the commonly adopted backend is traveller59's, which is also includes deployment concerns in its design such as memory allocation. For this reason it is highly recommended to install it: + +```bash +pip install spconv-cu120 +``` + +`AWML` will automatically select this implementation if the dependency is installed. + + ## Reference - [BEVFusion of mmdetection3d](https://github.com/open-mmlab/mmdetection3d/tree/v1.4.0/projects/BEVFusion) From a27a0ba399bd599775ee618f97c3936bcf0a7b96 Mon Sep 17 00:00:00 2001 From: scepter914 Date: Mon, 22 Sep 2025 14:55:14 +0100 Subject: [PATCH 3/5] update README Signed-off-by: scepter914 --- projects/BEVFusion/README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/projects/BEVFusion/README.md b/projects/BEVFusion/README.md index 1ac41c67f..2d6349a5b 100644 --- a/projects/BEVFusion/README.md +++ b/projects/BEVFusion/README.md @@ -174,17 +174,12 @@ This will generate two models in the `WORK_DIR` folder. `end2end.onnx` correspon - Add self-supervised loss ## Trouble shooting +### Sparse convolutions -- (Choice) Install traveller59's sparse convolutions backend - -By default, mmcv's backend will be used, but the commonly adopted backend is traveller59's, which is also includes deployment concerns in its design such as memory allocation. For this reason it is highly recommended to install it: - -```bash -pip install spconv-cu120 -``` - -`AWML` will automatically select this implementation if the dependency is installed. +- Install traveller59's sparse convolutions backend +If you use mmcv's backend, the commonly adopted backend is traveller59's, which is also includes deployment concerns in its design such as memory allocation. +For this reason, in our Dockerfile, we use `spconv-cu120`. ## Reference From 293f9d18aad4a707486b929e61133dc3bfe0f027 Mon Sep 17 00:00:00 2001 From: scepter914 Date: Mon, 22 Sep 2025 16:19:39 +0100 Subject: [PATCH 4/5] fix README Signed-off-by: scepter914 --- projects/BEVFusion/README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/projects/BEVFusion/README.md b/projects/BEVFusion/README.md index 2d6349a5b..ba7bfd17c 100644 --- a/projects/BEVFusion/README.md +++ b/projects/BEVFusion/README.md @@ -20,9 +20,19 @@ - BEVFusion-L - v0 - [BEVFusion-L base/0.X](./docs/BEVFusion-L/v0/base.md) + - v1 + - [BEVFusion-L base/1.X](./docs/BEVFusion-L/v1/base.md) + - v2 + - [BEVFusion-L base/2.X](./docs/BEVFusion-L/v2/base.md) + - [BEVFusion-L j6gen2/2.X](./docs/BEVFusion-L/v2/j6gen2.md) - BEVFusion-CL - v0 - [BEVFusion-CL base/0.X](./docs/BEVFusion-CL/v0/base.md) + - v1 + - [BEVFusion-CL base/1.X](./docs/BEVFusion-CL/v1/base.md) + - v2 + - [BEVFusion-CL base/2.X](./docs/BEVFusion-CL/v2/base.md) + - [BEVFusion-CL j6gen2/2.X](./docs/BEVFusion-CL/v2/j6gen2.md) - BEVFusion-L-offline - v0 - [BEVFusion-L-offline base/0.X](./docs/BEVFusion-L-offline/v0/base.md) @@ -34,10 +44,10 @@ ### 1. Setup - Please follow the [installation tutorial](/docs/tutorial/tutorial_detection_3d.md)to set up the environment. -- Docker build for TransFusion +- Docker build for BEVFusion ```sh -DOCKER_BUILDKIT=1 docker build -t awml-bevfusion projects/BEVFusion/ +docker build -t awml-bevfusion projects/BEVFusion/ ``` - Run docker @@ -176,8 +186,6 @@ This will generate two models in the `WORK_DIR` folder. `end2end.onnx` correspon ## Trouble shooting ### Sparse convolutions -- Install traveller59's sparse convolutions backend - If you use mmcv's backend, the commonly adopted backend is traveller59's, which is also includes deployment concerns in its design such as memory allocation. For this reason, in our Dockerfile, we use `spconv-cu120`. From f36986173b8d0d7846c35483a80942f8c04e2903 Mon Sep 17 00:00:00 2001 From: scepter914 Date: Mon, 22 Sep 2025 16:23:34 +0100 Subject: [PATCH 5/5] fix Dockerfile Signed-off-by: scepter914 --- projects/BEVFusion/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/BEVFusion/Dockerfile b/projects/BEVFusion/Dockerfile index 702e98d58..589bbc5ee 100644 --- a/projects/BEVFusion/Dockerfile +++ b/projects/BEVFusion/Dockerfile @@ -1,5 +1,4 @@ -#ARG AWML_BASE_IMAGE="ghcr.io/tier4/autoware-ml-base:latest" -ARG AWML_BASE_IMAGE="awml" +ARG AWML_BASE_IMAGE="ghcr.io/tier4/autoware-ml-base:latest" FROM ${AWML_BASE_IMAGE} # Install SparseConv