devcon-mmdet3d

This text is also text!

ファイルの準備


Dockerfileの作成


Modify Dockerfile as follow.

[Dockerfile]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04

ENV DEBIAN_FRONTEND=noninteractive

# Install some basic utilities
RUN apt-get update && apt-get install wget -yq
RUN apt-get install build-essential g++ gcc -y
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install libgl1-mesa-glx libglib2.0-0 -y
RUN apt-get install openmpi-bin openmpi-common libopenmpi-dev libgtk2.0-dev git -y

# Install conda
ENV CONDA_DIR /opt/conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py38_23.11.0-1-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda

ENV PATH=$CONDA_DIR/bin:$PATH
RUN conda install python=3.8

### Install pytorch
RUN pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

### Pip install mmcv-full in conda
RUN /opt/conda/bin/pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

RUN /opt/conda/bin/pip install mmdet==2.14.0 \
mmsegmentation==0.14.1 \
timm \
Pillow==8.4.0 \
tqdm \
torchpack \
mpi4py==3.0.3 \
numba==0.48.0 \
nuscenes-devkit==1.1.9

RUN conda install conda-build pyyaml numpy ipython cython typing typing_extensions mkl mkl-include ninja &&\
/opt/conda/bin/conda clean -ya

WORKDIR /root/workspace

devcontainer.jsonの作成

Modify devcontainer.json as follow.

[devcontainer.json]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
"name": "bev-playground",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"remoteUser": "root",
"workspaceFolder": "/workspace",
"remoteEnv": {
"TRT_LIBPATH": "/usr/lib/x86_64-linux-gnu",
"TRT_OSSPATH": "/workspace/TensorRT"
},
"runArgs": [
"--gpus",
"all",
"--shm-size",
"16gb"
],
"mounts": [
"source=${localWorkspaceFolder},target=/workspace,type=bind",
"source=${localWorkspaceFolder}/dataset/can_bus,target=/workspace/VAD/data/can_bus,type=bind",
"source=${localWorkspaceFolder}/dataset/nuscenes,target=/workspace/VAD/data/nuscenes,type=bind",
],
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
],
"settings": {
"python.defaultInterpreterPath": "/opt/conda/bin/python3"
}
}

Dockerビルド


VscodeでReopen containerをクリックして、コンテナをビルドし始めます。

mmdet3dインストール


コンテナでは、mmdet3dをインストールします。

[Dockerfile]
1
2
3
4
  git clone https://github.com/open-mmlab/mmdetection3d.git &&\
cd mmdetection3d &&\
git checkout -f v0.17.1 &&\
python setup.py develop

Troubleshooting


mmdet3dをインストールするとき、libやlibのバージョンが合わせない問題が発生しました。(更新予定)
以下のように修正してください。

1
2
3
4
5
6
7
scikit-image==0.21.0
networkx==3.1
pandas==2.0.3
numba==0.48.0
numpy==1.21.1
similaritymeasures==1.2.0
shaplely==1.8.5