Commit 1a47acdd authored by Jingwei Zhang's avatar Jingwei Zhang Committed by ZwwWayne
Browse files

[CI] Add github action CI && refactor `tests/utils/` (#2012)

* update github action ci

* install torch in ci

* fix ci on win

* add __init__ in tests/utils

* add mmdet3d/testing for modeule importing in UT in win

* fix diff path sep on UT

* reduce RAM in voxel_generator

* reduce RAM in anchor_generator

* remove print in UT

* fix lint

* fix pvrcnn ut

* fix lint

* reduce channels in second_fpn
parent 139c6f0c
name: lint
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pre-commit hook
run: |
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --all-files
- name: Check docstring coverage
run: |
pip install interrogate
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 90 mmdet3d
name: merge_stage_test
on:
push:
paths-ignore:
- 'README.md'
- 'README_zh-CN.md'
- 'docs/**'
- 'demo/**'
- '.dev_scripts/**'
- '.circleci/**'
branches:
- dev-1.x
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu_py:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
torch: [1.8.1]
include:
- torch: 1.8.1
torchvision: 0.9.1
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install MMEngine
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
- name: Install MMCV
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
- name: Install MMDet
run: pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
- name: Install other dependencies
run: pip install -r requirements/tests.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdet3d -m pytest tests/
coverage xml
coverage report -m
build_cpu_pt:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7]
torch: [1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.1, 1.11.0, 1.12.1]
include:
- torch: 1.6.0
torchvision: 0.7.0
- torch: 1.7.1
torchvision: 0.8.2
- torch: 1.8.1
torchvision: 0.9.1
- torch: 1.9.1
torchvision: 0.10.1
- torch: 1.10.1
torchvision: 0.11.2
- torch: 1.11.0
torchvision: 0.12.0
- torch: 1.12.1
torchvision: 0.13.1
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install MMEngine
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
- name: Install MMCV
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
- name: Install MMDet
run: pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
- name: Install other dependencies
run: pip install -r requirements/tests.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdet3d -m pytest tests/
coverage xml
coverage report -m
# Only upload coverage report for python3.7 && pytorch1.8.1 cpu
- name: Upload coverage to Codecov
if: ${{matrix.torch == '1.8.1' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
build_cu102:
runs-on: ubuntu-18.04
container:
image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
strategy:
matrix:
python-version: [3.7]
include:
- torch: 1.8.1
cuda: 10.2
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Install Python-dev
run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev
if: ${{matrix.python-version != 3.9}}
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
- name: Install PyTorch
run: python -m pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 -f https://download.pytorch.org/whl/torch_stable.html
- name: Install mmdet3d dependencies
run: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
pip install -r requirements/tests.txt
- name: Build and install
run: |
python setup.py check -m -s
TORCH_CUDA_ARCH_LIST=7.0 pip install -e .
build_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
python: [3.7]
platform: [cpu, cu111]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install lmdb
run: pip install lmdb
- name: Install PyTorch
run: pip install torch==1.8.1+${{matrix.platform}} torchvision==0.9.1+${{matrix.platform}} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install mmdet3d dependencies
run: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
pip install -r requirements/tests.txt
- name: Build and install
run: |
pip install -e .
- name: Run unittests and generate coverage report
run: |
pytest tests/
name: pr_stage_test
on:
pull_request:
paths-ignore:
- 'README.md'
- 'README_zh-CN.md'
- 'docs/**'
- 'demo/**'
- '.dev_scripts/**'
- '.circleci/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7]
include:
- torch: 1.8.1
torchvision: 0.9.1
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install MMEngine
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
- name: Install MMCV
run: |
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
- name: Install MMDet
run: pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
- name: Install other dependencies
run: pip install -r requirements/tests.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdet3d -m pytest tests/
coverage xml
coverage report -m
# Upload coverage report for python3.7 && pytorch1.8.1 cpu
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
build_cu102:
runs-on: ubuntu-18.04
container:
image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Install Python-dev
run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev
if: ${{matrix.python-version != 3.9}}
- name: Install system dependencies
run: |
apt-get update
apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev
- name: Install PyTorch
run: python -m pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 -f https://download.pytorch.org/whl/torch_stable.html
- name: Install mmdet3d dependencies
run: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
pip install -r requirements/tests.txt
- name: Build and install
run: |
python setup.py check -m -s
TORCH_CUDA_ARCH_LIST=7.0 pip install -e .
build_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
python: [3.7]
platform: [cpu, cu111]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: python -m pip install pip --upgrade
- name: Install lmdb
run: pip install lmdb
- name: Install PyTorch
run: pip install torch==1.8.1+${{matrix.platform}} torchvision==0.9.1+${{matrix.platform}} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install mmdet3d dependencies
run: |
pip install git+https://github.com/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0rc1'
pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
pip install -r requirements/tests.txt
- name: Build and install
run: |
pip install -e .
- name: Run unittests and generate coverage report
run: |
pytest tests/
name: test-mim
on:
push:
paths:
- 'model-index.yml'
- 'configs/**'
pull_request:
paths:
- 'model-index.yml'
- 'configs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_cpu:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7]
torch: [1.8.0]
include:
- torch: 1.8.0
torch_version: torch1.8
torchvision: 0.9.0
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install openmim
run: pip install openmim
- name: Build and install
run: rm -rf .eggs && mim install -e .
- name: test commands of mim
run: mim search mmdet3d
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
from os import path as osp
from typing import Callable, List, Optional, Set, Union
......@@ -287,7 +288,7 @@ class Det3DDataset(BaseDataset):
if 'lidar_sweeps' in info:
for sweep in info['lidar_sweeps']:
file_suffix = sweep['lidar_points']['lidar_path'].split(
'/')[-1]
os.sep)[-1]
if 'samples' in sweep['lidar_points']['lidar_path']:
sweep['lidar_points']['lidar_path'] = osp.join(
self.data_prefix['pts'], file_suffix)
......
# Copyright (c) OpenMMLab. All rights reserved.
from .data_utils import (create_data_info_after_loading,
create_dummy_data_info,
create_mono3d_data_info_after_loading)
from .model_utils import (create_detector_inputs, get_detector_cfg,
get_model_cfg, setup_seed)
__all__ = [
'create_dummy_data_info', 'create_data_info_after_loading',
'create_mono3d_data_info_after_loading', 'create_detector_inputs',
'get_detector_cfg', 'get_model_cfg', 'setup_seed'
]
......@@ -3,6 +3,7 @@ import numpy as np
# create a dummy `results` to test the pipeline
from mmdet3d.datasets import LoadAnnotations3D, LoadPointsFromFile
from mmdet3d.datasets.transforms.loading import LoadImageFromFileMono3D
from mmdet3d.structures import LiDARInstance3DBoxes
......@@ -20,6 +21,10 @@ def create_dummy_data_info(with_ann=True):
-1.5808]])),
'gt_labels_3d':
np.array([1]),
'centers_2d':
np.array([[765.04, 214.56]]),
'depths':
np.array([8.410]),
'num_lidar_pts':
np.array([377]),
'difficulty':
......@@ -134,6 +139,9 @@ def create_dummy_data_info(with_ann=True):
],
'bbox_label_3d':
-1,
'center_2d': [765.04, 214.56],
'depth':
8.410,
'num_lidar_pts':
377,
'difficulty':
......@@ -168,3 +176,17 @@ def create_data_info_after_loading():
data_info = load_points_transform(data_info)
data_info_after_loading = load_anns_transform(data_info)
return data_info_after_loading
def create_mono3d_data_info_after_loading():
load_anns_transform = LoadAnnotations3D(
with_bbox=True,
with_label=True,
with_bbox_3d=True,
with_label_3d=True,
with_bbox_depth=True)
load_img_transform = LoadImageFromFileMono3D()
data_info = create_dummy_data_info()
data_info = load_img_transform(data_info)
data_info_after_loading = load_anns_transform(data_info)
return data_info_after_loading
......@@ -12,7 +12,7 @@ from mmdet3d.structures import (CameraInstance3DBoxes, DepthInstance3DBoxes,
PointData)
def _setup_seed(seed):
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
......@@ -44,7 +44,7 @@ def _get_config_module(fname):
return config_mod
def _get_model_cfg(fname):
def get_model_cfg(fname):
"""Grab configs necessary to create a model.
These are deep copied to allow for safe modification of parameters without
......@@ -56,7 +56,7 @@ def _get_model_cfg(fname):
return model
def _get_detector_cfg(fname):
def get_detector_cfg(fname):
"""Grab configs necessary to create a detector.
These are deep copied to allow for safe modification of parameters without
......@@ -73,19 +73,19 @@ def _get_detector_cfg(fname):
return model
def _create_detector_inputs(seed=0,
with_points=True,
with_img=False,
img_size=10,
num_gt_instance=20,
num_points=10,
points_feat_dim=4,
num_classes=3,
gt_bboxes_dim=7,
with_pts_semantic_mask=False,
with_pts_instance_mask=False,
bboxes_3d_type='lidar'):
_setup_seed(seed)
def create_detector_inputs(seed=0,
with_points=True,
with_img=False,
img_size=10,
num_gt_instance=20,
num_points=10,
points_feat_dim=4,
num_classes=3,
gt_bboxes_dim=7,
with_pts_semantic_mask=False,
with_pts_instance_mask=False,
bboxes_3d_type='lidar'):
setup_seed(seed)
assert bboxes_3d_type in ('lidar', 'depth', 'cam')
bbox_3d_class = {
'lidar': LiDARInstance3DBoxes,
......
......@@ -54,9 +54,8 @@ def test_getitem():
lyft_dataset.prepare_data(0)
input_dict = lyft_dataset.get_data_info(0)
# assert the the path should contains data_prefix and data_root
assert input_dict['lidar_points'][
'lidar_path'] == 'tests/data/lyft/lidar/host-a017_lidar1_' \
'1236118886901125926.bin'
assert data_prefix['pts'] in input_dict['lidar_points']['lidar_path']
assert data_root in input_dict['lidar_points']['lidar_path']
ann_info = lyft_dataset.parse_ann_info(input_dict)
......
......@@ -58,10 +58,8 @@ def test_getitem():
input_dict = nus_dataset.get_data_info(0)
# assert the the path should contains data_prefix and data_root
assert data_prefix['pts'] in input_dict['lidar_points']['lidar_path']
assert input_dict['lidar_points'][
'lidar_path'] == 'tests/data/nuscenes/samples/LIDAR_TOP/' \
'n015-2018-08-02-17-16-37+0800__LIDAR_TOP__' \
'1533201470948018.pcd.bin'
assert data_root in input_dict['lidar_points']['lidar_path']
for cam_id, img_info in input_dict['images'].items():
if 'img_path' in img_info:
assert data_prefix['img'] in img_info['img_path']
......
......@@ -3,10 +3,10 @@ import unittest
import torch
from mmengine.testing import assert_allclose
from utils import create_data_info_after_loading
from mmdet3d.datasets.transforms.formating import Pack3DDetInputs
from mmdet3d.structures import LiDARInstance3DBoxes
from mmdet3d.testing import create_data_info_after_loading
class TestPack3DDetInputs(unittest.TestCase):
......
......@@ -4,12 +4,12 @@ import unittest
import numpy as np
import torch
from mmengine.testing import assert_allclose
from utils import create_dummy_data_info
from mmdet3d.datasets.transforms import PointSegClassMapping
from mmdet3d.datasets.transforms.loading import (LoadAnnotations3D,
LoadPointsFromFile)
from mmdet3d.structures import DepthPoints, LiDARPoints
from mmdet3d.testing import create_dummy_data_info
class TestLoadPointsFromFile(unittest.TestCase):
......
......@@ -5,10 +5,10 @@ import unittest
import numpy as np
import torch
from mmengine.testing import assert_allclose
from utils import create_data_info_after_loading
from mmdet3d.datasets import GlobalAlignment, RandomFlip3D
from mmdet3d.datasets.transforms import GlobalRotScaleTrans
from mmdet3d.testing import create_data_info_after_loading
class TestGlobalRotScaleTrans(unittest.TestCase):
......
......@@ -6,7 +6,7 @@ import torch
from mmdet3d import * # noqa
from mmdet3d.models.dense_heads import FCAF3DHead
from tests.utils.model_utils import _create_detector_inputs
from mmdet3d.testing import create_detector_inputs
class TestAnchor3DHead(TestCase):
......@@ -63,7 +63,7 @@ class TestAnchor3DHead(TestCase):
x = (x1, x2, x3, x4)
# fake annotation
packed_inputs = _create_detector_inputs(
packed_inputs = create_detector_inputs(
with_points=False,
with_img=False,
num_gt_instance=3,
......
......@@ -4,8 +4,8 @@ import torch
from mmengine import DefaultScope
from mmdet3d.registry import MODELS
from tests.utils.model_utils import (_create_detector_inputs,
_get_detector_cfg, _setup_seed)
from mmdet3d.testing import (create_detector_inputs, get_detector_cfg,
setup_seed)
class TestFreeAnchor(unittest.TestCase):
......@@ -15,8 +15,8 @@ class TestFreeAnchor(unittest.TestCase):
assert hasattr(mmdet3d.models.dense_heads, 'FreeAnchor3DHead')
DefaultScope.get_instance('test_freeanchor', scope_name='mmdet3d')
_setup_seed(0)
freeanchor_cfg = _get_detector_cfg(
setup_seed(0)
freeanchor_cfg = get_detector_cfg(
'free_anchor/pointpillars_hv_regnet-1.6gf_fpn_head-free-anchor'
'_sbn-all_8xb4-2x_nus-3d.py')
# decrease channels to reduce cuda memory.
......@@ -29,14 +29,14 @@ class TestFreeAnchor(unittest.TestCase):
freeanchor_cfg.pts_bbox_head.in_channels = 1
model = MODELS.build(freeanchor_cfg)
num_gt_instance = 3
packed_inputs = _create_detector_inputs(
packed_inputs = create_detector_inputs(
num_gt_instance=num_gt_instance, gt_bboxes_dim=9)
# TODO: Support aug_test
# aug_data = [
# _create_detector_inputs(
# create_detector_inputs(
# num_gt_instance=num_gt_instance, gt_bboxes_dim=9),
# _create_detector_inputs(
# create_detector_inputs(
# num_gt_instance=num_gt_instance + 1, gt_bboxes_dim=9)
# ]
# # test_aug_test
......
......@@ -4,8 +4,8 @@ import torch
from mmengine import DefaultScope
from mmdet3d.registry import MODELS
from tests.utils.model_utils import (_create_detector_inputs,
_get_detector_cfg, _setup_seed)
from mmdet3d.testing import (create_detector_inputs, get_detector_cfg,
setup_seed)
class TestSSN(unittest.TestCase):
......@@ -15,8 +15,8 @@ class TestSSN(unittest.TestCase):
assert hasattr(mmdet3d.models.dense_heads, 'ShapeAwareHead')
DefaultScope.get_instance('test_ssn', scope_name='mmdet3d')
_setup_seed(0)
ssn_cfg = _get_detector_cfg(
setup_seed(0)
ssn_cfg = get_detector_cfg(
'ssn/ssn_hv_secfpn_sbn-all_16xb2-2x_nus-3d.py')
ssn_cfg.pts_voxel_encoder.feat_channels = [1, 1]
ssn_cfg.pts_middle_encoder.in_channels = 1
......@@ -28,14 +28,14 @@ class TestSSN(unittest.TestCase):
ssn_cfg.pts_bbox_head.feat_channels = 1
model = MODELS.build(ssn_cfg)
num_gt_instance = 50
packed_inputs = _create_detector_inputs(
packed_inputs = create_detector_inputs(
num_gt_instance=num_gt_instance, gt_bboxes_dim=9)
# TODO: Support aug_test
# aug_data = [
# _create_detector_inputs(
# create_detector_inputs(
# num_gt_instance=num_gt_instance, gt_bboxes_dim=9),
# _create_detector_inputs(
# create_detector_inputs(
# num_gt_instance=num_gt_instance + 1, gt_bboxes_dim=9)
# ]
# test_aug_test
......
......@@ -4,8 +4,8 @@ import torch
from mmengine import DefaultScope
from mmdet3d.registry import MODELS
from tests.utils.model_utils import (_create_detector_inputs,
_get_detector_cfg, _setup_seed)
from mmdet3d.testing import (create_detector_inputs, get_detector_cfg,
setup_seed)
class Test3DSSD(unittest.TestCase):
......@@ -15,11 +15,11 @@ class Test3DSSD(unittest.TestCase):
assert hasattr(mmdet3d.models, 'SSD3DNet')
DefaultScope.get_instance('test_ssd3d', scope_name='mmdet3d')
_setup_seed(0)
voxel_net_cfg = _get_detector_cfg('3dssd/3dssd_4xb4_kitti-3d-car.py')
setup_seed(0)
voxel_net_cfg = get_detector_cfg('3dssd/3dssd_4xb4_kitti-3d-car.py')
model = MODELS.build(voxel_net_cfg)
num_gt_instance = 3
packed_inputs = _create_detector_inputs(
packed_inputs = create_detector_inputs(
num_gt_instance=num_gt_instance, num_classes=1)
if torch.cuda.is_available():
......
......@@ -4,8 +4,8 @@ import torch
from mmengine import DefaultScope
from mmdet3d.registry import MODELS
from tests.utils.model_utils import (_create_detector_inputs,
_get_detector_cfg, _setup_seed)
from mmdet3d.testing import (create_detector_inputs, get_detector_cfg,
setup_seed)
class TestCenterPoint(unittest.TestCase):
......@@ -15,14 +15,14 @@ class TestCenterPoint(unittest.TestCase):
assert hasattr(mmdet3d.models, 'CenterPoint')
_setup_seed(0)
setup_seed(0)
DefaultScope.get_instance('test_center_point', scope_name='mmdet3d')
centerpoint_net_cfg = _get_detector_cfg(
centerpoint_net_cfg = get_detector_cfg(
'centerpoint/centerpoint_voxel01_second_secfpn_8xb4-cyclic-20e_nus-3d.py' # noqa
)
model = MODELS.build(centerpoint_net_cfg)
num_gt_instance = 50
packed_inputs = _create_detector_inputs(
packed_inputs = create_detector_inputs(
with_img=True, num_gt_instance=num_gt_instance, points_feat_dim=5)
for sample_id in range(len(packed_inputs['data_samples'])):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment