Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmdetection3d
Commits
80b39bd0
Commit
80b39bd0
authored
Jul 04, 2020
by
zhangwenwei
Browse files
Reformat docstrings in code
parent
64d7fbc2
Changes
101
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
57 additions
and
82 deletions
+57
-82
tests/test_dataset/test_indoor_eval.py
tests/test_dataset/test_indoor_eval.py
+1
-1
tests/test_forward.py
tests/test_forward.py
+9
-16
tests/test_heads.py
tests/test_heads.py
+11
-12
tests/test_pipeline/test_indoor_pipeline.py
tests/test_pipeline/test_indoor_pipeline.py
+1
-2
tests/test_pipeline/test_loading.py
tests/test_pipeline/test_loading.py
+1
-2
tests/test_sparse_unet.py
tests/test_sparse_unet.py
+1
-1
tools/analyze_logs.py
tools/analyze_logs.py
+2
-3
tools/benchmark.py
tools/benchmark.py
+1
-2
tools/create_data.py
tools/create_data.py
+5
-5
tools/data_converter/create_gt_database.py
tools/data_converter/create_gt_database.py
+4
-5
tools/data_converter/indoor_converter.py
tools/data_converter/indoor_converter.py
+1
-1
tools/data_converter/kitti_converter.py
tools/data_converter/kitti_converter.py
+2
-3
tools/data_converter/kitti_data_utils.py
tools/data_converter/kitti_data_utils.py
+2
-3
tools/data_converter/lyft_converter.py
tools/data_converter/lyft_converter.py
+1
-2
tools/data_converter/nuscenes_converter.py
tools/data_converter/nuscenes_converter.py
+7
-11
tools/data_converter/scannet_data_utils.py
tools/data_converter/scannet_data_utils.py
+2
-3
tools/data_converter/sunrgbd_data_utils.py
tools/data_converter/sunrgbd_data_utils.py
+3
-4
tools/publish_model.py
tools/publish_model.py
+0
-1
tools/regnet2mmdet.py
tools/regnet2mmdet.py
+1
-2
tools/test.py
tools/test.py
+2
-3
No files found.
tests/test_dataset/test_indoor_eval.py
View file @
80b39bd0
...
...
@@ -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
]),
...
...
tests/test_forward.py
View file @
80b39bd0
"""
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):
...
...
tests/test_heads.py
View file @
80b39bd0
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
)
...
...
tests/test_pipeline/test_indoor_pipeline.py
View file @
80b39bd0
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
...
...
tests/test_pipeline/test_loading.py
View file @
80b39bd0
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
...
...
tests/test_sparse_unet.py
View file @
80b39bd0
import
torch
import
mmdet3d.ops.spconv
as
spconv
from
mmdet3d.ops
import
SparseBasicBlock
from
mmdet3d.ops
import
spconv
as
spconv
def
test_SparseUNet
():
...
...
tools/analyze_logs.py
View file @
80b39bd0
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
):
...
...
tools/benchmark.py
View file @
80b39bd0
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
():
...
...
tools/create_data.py
View file @
80b39bd0
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
...
...
tools/data_converter/create_gt_database.py
View file @
80b39bd0
import
os.path
as
osp
import
pickle
import
mmcv
import
numpy
as
np
import
p
ycocotools.mask
as
maskUtils
import
p
ickle
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
...
...
tools/data_converter/indoor_converter.py
View file @
80b39bd0
import
mmcv
import
os
import
mmcv
from
tools.data_converter.scannet_data_utils
import
ScanNetData
from
tools.data_converter.sunrgbd_data_utils
import
SUNRGBDData
...
...
tools/data_converter/kitti_converter.py
View file @
80b39bd0
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
...
...
tools/data_converter/kitti_data_utils.py
View file @
80b39bd0
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
...
...
tools/data_converter/lyft_converter.py
View file @
80b39bd0
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
...
...
tools/data_converter/nuscenes_converter.py
View file @
80b39bd0
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.
...
...
tools/data_converter/scannet_data_utils.py
View file @
80b39bd0
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
):
...
...
tools/data_converter/sunrgbd_data_utils.py
View file @
80b39bd0
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
):
...
...
tools/publish_model.py
View file @
80b39bd0
import
argparse
import
subprocess
import
torch
...
...
tools/regnet2mmdet.py
View file @
80b39bd0
import
argparse
from
collections
import
OrderedDict
import
torch
from
collections
import
OrderedDict
def
convert_stem
(
model_key
,
model_weight
,
state_dict
,
converted_names
):
...
...
tools/test.py
View file @
80b39bd0
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
():
...
...
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment