Commit 80b39bd0 authored by zhangwenwei's avatar zhangwenwei
Browse files

Reformat docstrings in code

parent 64d7fbc2
......@@ -5,7 +5,7 @@ from mmdet3d.core.evaluation.indoor_eval import average_precision, indoor_eval
def test_indoor_eval():
from mmdet3d.core.bbox.structures import DepthInstance3DBoxes, Box3DMode
from mmdet3d.core.bbox.structures import Box3DMode, DepthInstance3DBoxes
det_infos = [{
'labels_3d':
torch.tensor([0, 1, 2, 2, 0, 3, 1, 2, 3, 2]),
......
"""
Test model forward process
"""Test model forward process.
CommandLine:
pytest tests/test_forward.py
xdoctest tests/test_forward.py zero
"""
import copy
from os.path import dirname, exists, join
import numpy as np
import torch
from os.path import dirname, exists, join
def _get_config_directory():
""" Find the predefined detector config directory """
"""Find the predefined detector config directory."""
try:
# Assume we are running in the source mmdetection repo
repo_dpath = dirname(dirname(__file__))
......@@ -31,9 +26,7 @@ def _get_config_directory():
def _get_config_module(fname):
"""
Load a configuration as a python module
"""
"""Load a configuration as a python module."""
from mmcv import Config
config_dpath = _get_config_directory()
config_fpath = join(config_dpath, fname)
......@@ -42,9 +35,10 @@ def _get_config_module(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 influencing other tests.
"""Grab configs necessary to create a detector.
These are deep copied to allow for safe modification of parameters without
influencing other tests.
"""
import mmcv
config = _get_config_module(fname)
......@@ -154,8 +148,7 @@ def _test_single_stage_forward(cfg_file):
def _demo_mm_inputs(input_shape=(1, 3, 300, 300),
num_items=None, num_classes=10): # yapf: disable
"""
Create a superset of inputs needed to run test or train batches.
"""Create a superset of inputs needed to run test or train batches.
Args:
input_shape (tuple):
......
import copy
from os.path import dirname, exists, join
import pytest
import torch
from os.path import dirname, exists, join
from mmdet3d.core.bbox import Box3DMode, LiDARInstance3DBoxes
def _get_config_directory():
""" Find the predefined detector config directory """
"""Find the predefined detector config directory."""
try:
# Assume we are running in the source mmdetection repo
repo_dpath = dirname(dirname(__file__))
......@@ -23,9 +22,7 @@ def _get_config_directory():
def _get_config_module(fname):
"""
Load a configuration as a python module
"""
"""Load a configuration as a python module."""
from mmcv import Config
config_dpath = _get_config_directory()
config_fpath = join(config_dpath, fname)
......@@ -34,9 +31,10 @@ def _get_config_module(fname):
def _get_head_cfg(fname):
"""
Grab configs necessary to create a bbox_head. These are deep copied to
allow for safe modification of parameters without influencing other tests.
"""Grab configs necessary to create a bbox_head.
These are deep copied to allow for safe modification of parameters without
influencing other tests.
"""
import mmcv
config = _get_config_module(fname)
......@@ -51,9 +49,10 @@ def _get_head_cfg(fname):
def _get_rpn_head_cfg(fname):
"""
Grab configs necessary to create a rpn_head. These are deep copied to allow
for safe modification of parameters without influencing other tests.
"""Grab configs necessary to create a rpn_head.
These are deep copied to allow for safe modification of parameters without
influencing other tests.
"""
import mmcv
config = _get_config_module(fname)
......
import os.path as osp
import mmcv
import numpy as np
import torch
from os import path as osp
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet3d.datasets.pipelines import Compose
......
import os.path as osp
import mmcv
import numpy as np
import pytest
from os import path as osp
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet3d.datasets.pipelines import LoadAnnotations3D, LoadPointsFromFile
......
import torch
import mmdet3d.ops.spconv as spconv
from mmdet3d.ops import SparseBasicBlock
from mmdet3d.ops import spconv as spconv
def test_SparseUNet():
......
import argparse
import json
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from collections import defaultdict
from matplotlib import pyplot as plt
def cal_train_time(log_dicts, args):
......
import argparse
import time
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmcv.runner import load_checkpoint
from tools.fuse_conv_bn import fuse_module
from mmdet3d.datasets import build_dataloader, build_dataset
from mmdet3d.models import build_detector
from mmdet.core import wrap_fp16_model
from tools.fuse_conv_bn import fuse_module
def parse_args():
......
import argparse
import os.path as osp
from os import path as osp
import tools.data_converter.indoor_converter as indoor
import tools.data_converter.kitti_converter as kitti
import tools.data_converter.lyft_converter as lyft_converter
import tools.data_converter.nuscenes_converter as nuscenes_converter
from tools.data_converter import indoor_converter as indoor
from tools.data_converter import kitti_converter as kitti
from tools.data_converter import lyft_converter as lyft_converter
from tools.data_converter import nuscenes_converter as nuscenes_converter
from tools.data_converter.create_gt_database import create_groundtruth_database
......
import os.path as osp
import pickle
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
import pickle
from mmcv import track_iter_progress
from os import path as osp
from pycocotools import mask as maskUtils
from pycocotools.coco import COCO
import mmdet3d.core.bbox.box_np_ops as box_np_ops
from mmdet3d.core.bbox import box_np_ops as box_np_ops
from mmdet3d.datasets import build_dataset
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from mmdet.ops import roi_align
......
import mmcv
import os
import mmcv
from tools.data_converter.scannet_data_utils import ScanNetData
from tools.data_converter.sunrgbd_data_utils import SUNRGBDData
......
import pickle
from pathlib import Path
import numpy as np
import pickle
from mmcv import track_iter_progress
from pathlib import Path
from mmdet3d.core.bbox import box_np_ops
from .kitti_data_utils import get_kitti_image_info
......
import concurrent.futures as futures
import numpy as np
from collections import OrderedDict
from concurrent import futures as futures
from pathlib import Path
import numpy as np
from skimage import io
......
import os.path as osp
import mmcv
import numpy as np
from lyft_dataset_sdk.lyftdataset import LyftDataset as Lyft
from os import path as osp
from pyquaternion import Quaternion
from mmdet3d.datasets import LyftDataset
......
import os.path as osp
from collections import OrderedDict
from typing import List, Tuple, Union
import mmcv
import numpy as np
from collections import OrderedDict
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import view_points
from os import path as osp
from pyquaternion import Quaternion
from shapely.geometry import MultiPoint, box
from typing import List, Tuple, Union
from mmdet3d.datasets import NuScenesDataset
......@@ -457,10 +456,8 @@ def get_2d_boxes(nusc, sample_data_token: str,
def post_process_coords(
corner_coords: List, imsize: Tuple[int, int] = (1600, 900)
) -> Union[Tuple[float, float, float, float], None]:
"""
Get the intersection of the convex hull of the reprojected
bbox corners and the image canvas, return None if no
intersection.
"""Get the intersection of the convex hull of the reprojected bbox corners
and the image canvas, return None if no intersection.
Args:
corner_coords (list[int]): Corner coordinates of reprojected
......@@ -491,9 +488,8 @@ def post_process_coords(
def generate_record(ann_rec: dict, x1: float, y1: float, x2: float, y2: float,
sample_data_token: str, filename: str) -> OrderedDict:
"""
Generate one 2D annotation record given various informations on
top of the 2D bounding box coordinates.
"""Generate one 2D annotation record given various informations on top of
the 2D bounding box coordinates.
Args:
ann_rec (dict): Original 3d annotation record.
......
import concurrent.futures as futures
import os.path as osp
import mmcv
import numpy as np
from concurrent import futures as futures
from os import path as osp
class ScanNetData(object):
......
import concurrent.futures as futures
import os.path as osp
import mmcv
import numpy as np
import scipy.io as sio
from concurrent import futures as futures
from os import path as osp
from scipy import io as sio
def random_sampling(points, num_points, replace=None, return_choices=False):
......
import argparse
import subprocess
import torch
......
import argparse
from collections import OrderedDict
import torch
from collections import OrderedDict
def convert_stem(model_key, model_weight, state_dict, converted_names):
......
import argparse
import os
import mmcv
import os
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from tools.fuse_conv_bn import fuse_module
from mmdet3d.apis import single_gpu_test
from mmdet3d.datasets import build_dataloader, build_dataset
from mmdet3d.models import build_detector
from mmdet.apis import multi_gpu_test, set_random_seed
from mmdet.core import wrap_fp16_model
from tools.fuse_conv_bn import fuse_module
def parse_args():
......
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