From ea131ebc77bd91ecf91be8669c8702293b2390a3 Mon Sep 17 00:00:00 2001 From: Jingwei Zhang Date: Thu, 29 Sep 2022 20:05:16 +0800 Subject: [PATCH] [Fix]: Modify the min version of python to 3.7 in CI & update docs (#1877) * modify ci config * minor changes * min python==3.7.4 & update install docs * fix data_preprocessor * fix data_preprocessor * install waymo-open-dataset-tf-2-6-0 * update docs --- .circleci/test.yml | 16 +++++----------- docs/en/getting_started.md | 4 ++++ docs/zh_cn/getting_started.md | 6 +++++- .../data_preprocessors/data_preprocessor.py | 10 +++++----- requirements/optional.txt | 4 ++-- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.circleci/test.yml b/.circleci/test.yml index 14689d025f..96a1a78abe 100644 --- a/.circleci/test.yml +++ b/.circleci/test.yml @@ -36,8 +36,6 @@ jobs: type: string torchvision: type: string - mmcv: - type: string docker: - image: cimg/python:<< parameters.python >> resource_class: large @@ -62,7 +60,8 @@ jobs: name: Install mmdet3d dependencies command: | python -m pip install git+ssh://git@github.com/open-mmlab/mmengine.git@main - python -m pip install << parameters.mmcv >> + python -m pip install -U openmim + python -m mim install 'mmcv >= 2.0.0rc1' python -m pip install git+ssh://git@github.com/open-mmlab/mmdetection.git@dev-3.x python -m pip install -r requirements.txt - run: @@ -85,8 +84,6 @@ jobs: cudnn: type: integer default: 7 - mmcv: - type: string machine: image: ubuntu-2004-cuda-11.4:202110-01 # docker_layer_caching: true @@ -108,7 +105,8 @@ jobs: name: Install mmdet3d dependencies command: | docker exec mmdet3d pip install -e /mmengine - docker exec mmdet3d pip install << parameters.mmcv >> + docker exec pip install -U openmim + docker exec mim install 'mmcv >= 2.0.0rc1' docker exec mmdet3d pip install -e /mmdetection docker exec mmdet3d pip install -r requirements.txt - run: @@ -144,8 +142,7 @@ workflows: name: minimum_version_cpu torch: 1.6.0 torchvision: 0.7.0 - python: 3.6.9 # The lowest python 3.6.x version available on CircleCI images - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cpu/torch1.6.0/mmcv_full-2.0.0rc0-cp36-cp36m-manylinux1_x86_64.whl + python: 3.7.4 requires: - lint - build_cpu: @@ -153,7 +150,6 @@ workflows: torch: 1.9.0 torchvision: 0.10.0 python: 3.9.0 - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cpu/torch1.9.0/mmcv_full-2.0.0rc0-cp39-cp39-manylinux1_x86_64.whl requires: - minimum_version_cpu - hold: @@ -166,7 +162,6 @@ workflows: # Use double quotation mark to explicitly specify its type # as string instead of number cuda: "10.2" - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cu102/torch1.8.0/mmcv_full-2.0.0rc0-cp37-cp37m-manylinux1_x86_64.whl requires: - hold merge_stage_test: @@ -179,7 +174,6 @@ workflows: torch: 1.6.0 # Use double quotation mark to explicitly specify its type # as string instead of number - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cu101/torch1.6.0/mmcv_full-2.0.0rc0-cp37-cp37m-manylinux1_x86_64.whl cuda: "10.1" filters: branches: diff --git a/docs/en/getting_started.md b/docs/en/getting_started.md index 7d08b7b671..a1b605c036 100644 --- a/docs/en/getting_started.md +++ b/docs/en/getting_started.md @@ -18,6 +18,8 @@ If you are experienced with PyTorch and have already installed it, just skip thi **Step 1.** Create a conda environment and activate it. ```shell +# We recommend to install python=3.8 since the waymo-open-dataset-tf-2-6-0 requires python>=3.7 +# If you want to install python<3.7, make sure to install waymo-open-dataset-tf-2-x-0 (x<=4) conda create --name openmmlab python=3.8 -y conda activate openmmlab ``` @@ -254,6 +256,8 @@ docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmdetection3d/data mmdete Here is a full script for setting up MMdetection3D with conda. ```shell +# We recommend to install python=3.8 since the waymo-open-dataset-tf-2-6-0 requires python>=3.7 +# If you want to install python<3.7, make sure to install waymo-open-dataset-tf-2-x-0 (x<=4) conda create -n open-mmlab python=3.8 -y conda activate open-mmlab diff --git a/docs/zh_cn/getting_started.md b/docs/zh_cn/getting_started.md index a2c00651ef..bab073b3ff 100644 --- a/docs/zh_cn/getting_started.md +++ b/docs/zh_cn/getting_started.md @@ -17,6 +17,8 @@ MMDetection3D 可以安装在 Linux, MacOS, (实验性支持 Windows) 的平台 **步骤 1.** 使用 conda 新建虚拟环境,并进入该虚拟环境. ```shell +# 鉴于 waymo-open-dataset-tf-2-6-0 要求 python>=3.7, 我们推荐安装 python3.8 +# 如果您想要安装 python3.6, 之后须确保安装 waymo-open-dataset-tf-2-x-0 (x<=4) conda create --name openmmlab python=3.8 -y conda activate openmmlab ``` @@ -269,7 +271,9 @@ docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmdetection3d/data mmdete 以下是一个基于 conda 安装 MMdetection3D 的脚本 ```shell -conda create -n open-mmlab python=3.7 -y +# 鉴于 waymo-open-dataset-tf-2-6-0 要求 python>=3.7, 我们推荐安装 python3.8 +# 如果您想要安装 python3.6, 之后须确保安装 waymo-open-dataset-tf-2-x-0 (x<=4) +conda create -n open-mmlab python=3.8 -y conda activate open-mmlab # install latest PyTorch prebuilt with the default prebuilt CUDA version (usually the latest) diff --git a/mmdet3d/models/data_preprocessors/data_preprocessor.py b/mmdet3d/models/data_preprocessors/data_preprocessor.py index fd5417039f..659a0e187e 100644 --- a/mmdet3d/models/data_preprocessors/data_preprocessor.py +++ b/mmdet3d/models/data_preprocessors/data_preprocessor.py @@ -13,7 +13,7 @@ from mmdet3d.registry import MODELS from mmdet3d.utils import OptConfigType from mmdet.models import DetDataPreprocessor -from mmdet.models.utils.misc import samplelist_boxlist2tensor +from mmdet.models.utils.misc import samplelist_boxtype2tensor @MODELS.register_module() @@ -75,7 +75,7 @@ def __init__(self, seg_pad_value: int = 255, bgr_to_rgb: bool = False, rgb_to_bgr: bool = False, - boxlist2tensor: bool = True, + boxtype2tensor: bool = True, batch_augments: Optional[List[dict]] = None): super().__init__( mean=mean, @@ -88,7 +88,7 @@ def __init__(self, seg_pad_value=seg_pad_value, bgr_to_rgb=bgr_to_rgb, rgb_to_bgr=rgb_to_bgr, - boxlist2tensor=boxlist2tensor, + boxtype2tensor=boxtype2tensor, batch_augments=batch_augments) self.voxel = voxel self.voxel_type = voxel_type @@ -169,8 +169,8 @@ def simple_process(self, data: dict, training: bool = False) -> dict: 'pad_shape': pad_shape }) - if self.boxlist2tensor: - samplelist_boxlist2tensor(data_samples) + if self.boxtype2tensor: + samplelist_boxtype2tensor(data_samples) if self.pad_mask: self.pad_gt_masks(data_samples) diff --git a/requirements/optional.txt b/requirements/optional.txt index ea655409e8..1d34b6ab53 100644 --- a/requirements/optional.txt +++ b/requirements/optional.txt @@ -1,4 +1,4 @@ black==20.8b1 # be compatible with typing-extensions 3.7.4 spconv -typing-extensions==3.7.4 # required by tensorflow before version 2.6 -waymo-open-dataset-tf-2-4-0 +typing-extensions==3.7.4 # required by tensorflow<=2.6 +waymo-open-dataset-tf-2-6-0 # requires python>=3.7