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
8f88914d
Commit
8f88914d
authored
Jun 20, 2020
by
liyinhao
Committed by
zhangwenwei
Jun 20, 2020
Browse files
Add docstrings
parent
613c8844
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
162 additions
and
101 deletions
+162
-101
mmdet3d/datasets/kitti_dataset.py
mmdet3d/datasets/kitti_dataset.py
+2
-2
mmdet3d/models/dense_heads/anchor3d_head.py
mmdet3d/models/dense_heads/anchor3d_head.py
+37
-34
mmdet3d/models/dense_heads/parta2_rpn_head.py
mmdet3d/models/dense_heads/parta2_rpn_head.py
+22
-18
mmdet3d/models/dense_heads/train_mixins.py
mmdet3d/models/dense_heads/train_mixins.py
+10
-10
mmdet3d/models/dense_heads/vote_head.py
mmdet3d/models/dense_heads/vote_head.py
+25
-22
mmdet3d/models/detectors/base.py
mmdet3d/models/detectors/base.py
+9
-8
mmdet3d/models/detectors/single_stage.py
mmdet3d/models/detectors/single_stage.py
+4
-1
mmdet3d/models/detectors/votenet.py
mmdet3d/models/detectors/votenet.py
+7
-6
tools/data_converter/create_gt_database.py
tools/data_converter/create_gt_database.py
+21
-0
tools/data_converter/kitti_converter.py
tools/data_converter/kitti_converter.py
+13
-0
tools/data_converter/nuscenes_converter.py
tools/data_converter/nuscenes_converter.py
+12
-0
No files found.
mmdet3d/datasets/kitti_dataset.py
View file @
8f88914d
...
...
@@ -339,7 +339,7 @@ class KittiDataset(Custom3DDataset):
class_names
,
pklfile_prefix
=
None
,
submission_prefix
=
None
):
"""Convert results to kitti format for evaluation and test submission
"""Convert results to kitti format for evaluation and test submission
.
Args:
net_outputs (List[array]): list of array storing the bbox and score
...
...
@@ -348,7 +348,7 @@ class KittiDataset(Custom3DDataset):
submission_prefix (str | None): The prefix of submission file.
Return:
List
(
[dict]
)
: A list of dict have the kitti format
List[dict]: A list of dict have the kitti format
"""
assert
len
(
net_outputs
)
==
len
(
self
.
data_infos
)
...
...
mmdet3d/models/dense_heads/anchor3d_head.py
View file @
8f88914d
...
...
@@ -134,10 +134,10 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Forward function on a single-scale feature map.
Args:
x (Tensor): Input features.
x (
torch.
Tensor): Input features.
Returns:
tuple[Tensor]: Contain score of each class, bbox predictions
tuple[
torch.
Tensor]: Contain score of each class, bbox predictions
and class predictions of direction.
"""
cls_score
=
self
.
conv_cls
(
x
)
...
...
@@ -151,11 +151,11 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Forward pass.
Args:
feats (list[Tensor]): Multi-level features, e.g.,
feats (list[
torch.
Tensor]): Multi-level features, e.g.,
features produced by FPN.
Returns:
tuple[list[Tensor]]: Multi-level class score, bbox
tuple[list[
torch.
Tensor]]: Multi-level class score, bbox
and direction predictions.
"""
return
multi_apply
(
self
.
forward_single
,
feats
)
...
...
@@ -185,20 +185,21 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Calculate loss of Single-level results.
Args:
cls_score (Tensor): Class score in single-level.
bbox_pred (Tensor): Bbox prediction in single-level.
dir_cls_preds (Tensor): Predictions of direction class
cls_score (
torch.
Tensor): Class score in single-level.
bbox_pred (
torch.
Tensor): Bbox prediction in single-level.
dir_cls_preds (
torch.
Tensor): Predictions of direction class
in single-level.
labels (Tensor): Labels of class.
label_weights (Tensor): Weights of class loss.
bbox_targets (Tensor): Targets of bbox predictions.
bbox_weights (Tensor): Weights of bbox loss.
dir_targets (Tensor): Targets of direction predictions.
dir_weights (Tensor): Weights of direction loss.
labels (
torch.
Tensor): Labels of class.
label_weights (
torch.
Tensor): Weights of class loss.
bbox_targets (
torch.
Tensor): Targets of bbox predictions.
bbox_weights (
torch.
Tensor): Weights of bbox loss.
dir_targets (
torch.
Tensor): Targets of direction predictions.
dir_weights (
torch.
Tensor): Weights of direction loss.
num_total_samples (int): The number of valid samples.
Returns:
tuple[Tensor]: losses of class, bbox and direction, respectively.
tuple[torch.Tensor]: losses of class, bbox
and direction, respectively.
"""
# classification loss
if
num_total_samples
is
None
:
...
...
@@ -246,10 +247,10 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Convert the rotation difference to difference in sine function
Args:
boxes1 (Tensor): shape (NxC), where C>=7 and
the 7th dimension is
rotation dimension
boxes2 (Tensor): shape (NxC), where C>=7 and the 7th
dimension is
rotation dimension
boxes1 (
torch.
Tensor): shape (NxC), where C>=7 and
the 7th dimension is
rotation dimension
boxes2 (
torch.
Tensor): shape (NxC), where C>=7 and the 7th
dimension is
rotation dimension
Returns:
tuple: (boxes1, boxes2) whose 7th dimensions are changed
...
...
@@ -275,15 +276,16 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Calculate losses.
Args:
cls_scores (list[Tensor]): Multi-level class scores.
bbox_preds (list[Tensor]): Multi-level bbox predictions.
dir_cls_preds (list[Tensor]): Multi-level direction
cls_scores (list[
torch.
Tensor]): Multi-level class scores.
bbox_preds (list[
torch.
Tensor]): Multi-level bbox predictions.
dir_cls_preds (list[
torch.
Tensor]): Multi-level direction
class predictions.
gt_bboxes (list[:obj:BaseInstance3DBoxes]): Gt bboxes
of each sample.
gt_labels (list[Tensor]): Gt labels of each sample.
gt_labels (list[
torch.
Tensor]): Gt labels of each sample.
input_metas (list[dict]): Contain pcd and img's meta info.
gt_bboxes_ignore (None | list[Tensor]): Specify which bounding.
gt_bboxes_ignore (None | list[torch.Tensor]): Specify
which bounding.
Returns:
dict: Contain class, bbox and direction losses of each level.
...
...
@@ -338,13 +340,13 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Get bboxes of anchor head.
Args:
cls_scores (list[Tensor]): Multi-level class scores.
bbox_preds (list[Tensor]): Multi-level bbox predictions.
dir_cls_preds (list[Tensor]): Multi-level direction
cls_scores (list[
torch.
Tensor]): Multi-level class scores.
bbox_preds (list[
torch.
Tensor]): Multi-level bbox predictions.
dir_cls_preds (list[
torch.
Tensor]): Multi-level direction
class predictions.
input_metas (list[dict]): Contain pcd and img's meta info.
cfg (None | ConfigDict): Training or testing config.
rescale (list[Tensor]): whether th rescale bbox.
rescale (list[
torch.
Tensor]): whether th rescale bbox.
Returns:
list[tuple]: prediction resultes of batches.
...
...
@@ -390,20 +392,21 @@ class Anchor3DHead(nn.Module, AnchorTrainMixin):
"""Get bboxes of single branch.
Args:
cls_scores (Tensor): Class score in single batch.
bbox_preds (Tensor): Bbox prediction in single batch.
dir_cls_preds (Tensor): Predictions of direction class
cls_scores (torch.Tensor): Class score in single batch.
bbox_preds (torch.Tensor): Bbox prediction in single batch.
dir_cls_preds (torch.Tensor): Predictions of direction class
in single batch.
mlvl_anchors (List[torch.Tensor]): Multi-level anchors
in single batch.
mlvl_anchors (List[Tensor]): Multi-level anchors in single batch.
input_meta (list[dict]): Contain pcd and img's meta info.
cfg (None | ConfigDict): Training or testing config.
rescale (list[Tensor]): whether th rescale bbox.
rescale (list[
torch.
Tensor]): whether th rescale bbox.
Returns:
tuple: Contain predictions of single batch.
- bboxes (:obj:BaseInstance3DBoxes): Predicted 3d bboxes.
- scores (Tensor): Class score of each bbox.
- labels (Tensor): Label of each bbox.
- scores (
torch.
Tensor): Class score of each bbox.
- labels (
torch.
Tensor): Label of each bbox.
"""
cfg
=
self
.
test_cfg
if
cfg
is
None
else
cfg
assert
len
(
cls_scores
)
==
len
(
bbox_preds
)
==
len
(
mlvl_anchors
)
...
...
mmdet3d/models/dense_heads/parta2_rpn_head.py
View file @
8f88914d
...
...
@@ -109,21 +109,22 @@ class PartA2RPNHead(Anchor3DHead):
"""Get bboxes of single branch.
Args:
cls_scores (Tensor): Class score in single batch.
bbox_preds (Tensor): Bbox prediction in single batch.
dir_cls_preds (Tensor): Predictions of direction class
cls_scores (torch.Tensor): Class score in single batch.
bbox_preds (torch.Tensor): Bbox prediction in single batch.
dir_cls_preds (torch.Tensor): Predictions of direction class
in single batch.
mlvl_anchors (List[torch.Tensor]): Multi-level anchors
in single batch.
mlvl_anchors (List[Tensor]): Multi-level anchors in single batch.
input_meta (list[dict]): Contain pcd and img's meta info.
cfg (None | ConfigDict): Training or testing config.
rescale (list[Tensor]): whether th rescale bbox.
rescale (list[
torch.
Tensor]): whether th rescale bbox.
Returns:
dict: Predictions of single batch. Contain the keys:
- boxes_3d (:obj:BaseInstance3DBoxes): Predicted 3d bboxes.
- scores_3d (Tensor): Score of each bbox.
- labels_3d (Tensor): Label of each bbox.
- cls_preds (Tensor): Class score of each bbox.
- scores_3d (
torch.
Tensor): Score of each bbox.
- labels_3d (
torch.
Tensor): Label of each bbox.
- cls_preds (
torch.
Tensor): Class score of each bbox.
"""
assert
len
(
cls_scores
)
==
len
(
bbox_preds
)
==
len
(
mlvl_anchors
)
mlvl_bboxes
=
[]
...
...
@@ -198,13 +199,16 @@ class PartA2RPNHead(Anchor3DHead):
"""Class agnostic nms for single batch.
Args:
mlvl_bboxes (Tensor): Bboxes from Multi-level.
mlvl_bboxes_for_nms (Tensor): Bboxes for nms (bev or minmax boxes)
from Multi-level.
mlvl_max_scores (Tensor): Max scores of Multi-level bbox.
mlvl_label_pred (Tensor): Class predictions of Multi-level bbox.
mlvl_cls_score (Tensor): Class scores of Multi-level bbox.
mlvl_dir_scores (Tensor): Direction scores of Multi-level bbox.
mlvl_bboxes (torch.Tensor): Bboxes from Multi-level.
mlvl_bboxes_for_nms (torch.Tensor): Bboxes for nms
(bev or minmax boxes) from Multi-level.
mlvl_max_scores (torch.Tensor): Max scores of Multi-level bbox.
mlvl_label_pred (torch.Tensor): Class predictions
of Multi-level bbox.
mlvl_cls_score (torch.Tensor): Class scores of
Multi-level bbox.
mlvl_dir_scores (torch.Tensor): Direction scores of
Multi-level bbox.
score_thr (int): Score threshold.
max_num (int): Max number of bboxes after nms.
cfg (None | ConfigDict): Training or testing config.
...
...
@@ -213,9 +217,9 @@ class PartA2RPNHead(Anchor3DHead):
Returns:
dict: Predictions of single batch. Contain the keys:
- boxes_3d (:obj:BaseInstance3DBoxes): Predicted 3d bboxes.
- scores_3d (Tensor): Score of each bbox.
- labels_3d (Tensor): Label of each bbox.
- cls_preds (Tensor): Class score of each bbox.
- scores_3d (
torch.
Tensor): Score of each bbox.
- labels_3d (
torch.
Tensor): Label of each bbox.
- cls_preds (
torch.
Tensor): Class score of each bbox.
"""
bboxes
=
[]
scores
=
[]
...
...
mmdet3d/models/dense_heads/train_mixins.py
View file @
8f88914d
...
...
@@ -24,7 +24,7 @@ class AnchorTrainMixin(object):
bboxes of each image.
input_metas (list[dict]): Meta info of each image.
gt_bboxes_ignore_list (None | list): Ignore list of gt bboxes.
gt_labels_list (list[Tensor]): Gt labels of batches.
gt_labels_list (list[
torch.
Tensor]): Gt labels of batches.
label_channels (int): The channel of labels.
num_classes (int): The number of classes.
sampling (bool): Whether to sample anchors.
...
...
@@ -95,10 +95,10 @@ class AnchorTrainMixin(object):
"""Compute targets of anchors in single batch.
Args:
anchors (Tensor): Concatenated multi-level anchor.
anchors (
torch.
Tensor): Concatenated multi-level anchor.
gt_bboxes (:obj:BaseInstance3DBoxes): Gt bboxes.
gt_bboxes_ignore (Tensor): Ignored gt bboxes.
gt_labels (Tensor): Gt class labels.
gt_bboxes_ignore (
torch.
Tensor): Ignored gt bboxes.
gt_labels (
torch.
Tensor): Gt class labels.
input_meta (dict): Meta info of each image.
label_channels (int): The channel of labels.
num_classes (int): The number of classes.
...
...
@@ -184,10 +184,10 @@ class AnchorTrainMixin(object):
Args:
bbox_assigner (BaseAssigner): assign positive and negative boxes.
anchors (Tensor): Concatenated multi-level anchor.
anchors (
torch.
Tensor): Concatenated multi-level anchor.
gt_bboxes (:obj:BaseInstance3DBoxes): Gt bboxes.
gt_bboxes_ignore (Tensor): Ignored gt bboxes.
gt_labels (Tensor): Gt class labels.
gt_bboxes_ignore (
torch.
Tensor): Ignored gt bboxes.
gt_labels (
torch.
Tensor): Gt class labels.
input_meta (dict): Meta info of each image.
label_channels (int): The channel of labels.
num_classes (int): The number of classes.
...
...
@@ -260,14 +260,14 @@ def get_direction_target(anchors,
"""Encode direction to 0 ~ num_bins-1.
Args:
anchors (Tensor): Concatenated multi-level anchor.
reg_targets (Tensor): Bbox regression targets.
anchors (
torch.
Tensor): Concatenated multi-level anchor.
reg_targets (
torch.
Tensor): Bbox regression targets.
dir_offset (int): Direction offset.
num_bins (int): Number of bins to divide 2*PI.
one_hot (bool): Whether to encode as one hot.
Returns:
Tensor: Encoded direction targets.
torch.
Tensor: Encoded direction targets.
"""
rot_gt
=
reg_targets
[...,
6
]
+
anchors
[...,
6
]
offset_rot
=
box_torch_ops
.
limit_period
(
rot_gt
-
dir_offset
,
0
,
2
*
np
.
pi
)
...
...
mmdet3d/models/dense_heads/vote_head.py
View file @
8f88914d
...
...
@@ -188,14 +188,17 @@ class VoteHead(nn.Module):
Args:
bbox_preds (dict): Predictions from forward of vote head.
points (list[Tensor]): Input points.
points (list[
torch.
Tensor]): Input points.
gt_bboxes_3d (list[:obj:BaseInstance3DBoxes]): Gt bboxes
of each sample.
gt_labels_3d (list[Tensor]): Gt labels of each sample.
pts_semantic_mask (None | list[Tensor]): Point-wise semantic mask.
pts_instance_mask (None | list[Tensor]): Point-wise instance mask.
gt_labels_3d (list[torch.Tensor]): Gt labels of each sample.
pts_semantic_mask (None | list[torch.Tensor]): Point-wise
semantic mask.
pts_instance_mask (None | list[torch.Tensor]): Point-wise
instance mask.
img_metas (list[dict]): Contain pcd and img's meta info.
gt_bboxes_ignore (None | list[Tensor]): Specify which bounding.
gt_bboxes_ignore (None | list[torch.Tensor]): Specify
which bounding.
Returns:
dict: Losses of Votenet.
...
...
@@ -292,15 +295,15 @@ class VoteHead(nn.Module):
"""Generate targets of vote head.
Args:
points (list[Tensor]): Points of each batch.
points (list[
torch.
Tensor]): Points of each batch.
gt_bboxes_3d (list[:obj:BaseInstance3DBoxes]): gt bboxes of
each batch.
gt_labels_3d (list[Tensor]): gt class labels of each batch.
pts_semantic_mask (None | list[Tensor]): point-wise semantic
gt_labels_3d (list[
torch.
Tensor]): gt class labels of each batch.
pts_semantic_mask (None | list[
torch.
Tensor]): point-wise semantic
label of each batch.
pts_instance_mask (None | list[Tensor]): point-wise instance
pts_instance_mask (None | list[
torch.
Tensor]): point-wise instance
label of each batch.
bbox_preds (Tensor): Bbox predictions of vote head.
bbox_preds (
torch.
Tensor): Bbox predictions of vote head.
Returns:
tuple: Targets of vote head.
...
...
@@ -378,14 +381,14 @@ class VoteHead(nn.Module):
"""Generate targets of vote head for single batch.
Args:
points (Tensor): Points of each batch.
points (
torch.
Tensor): Points of each batch.
gt_bboxes_3d (:obj:BaseInstance3DBoxes): gt bboxes of each batch.
gt_labels_3d (Tensor): gt class labels of each batch.
pts_semantic_mask (None | Tensor): point-wise semantic
gt_labels_3d (
torch.
Tensor): gt class labels of each batch.
pts_semantic_mask (None |
torch.
Tensor): point-wise semantic
label of each batch.
pts_instance_mask (None | Tensor): point-wise instance
pts_instance_mask (None |
torch.
Tensor): point-wise instance
label of each batch.
aggregated_points (Tensor): Aggregated points from
aggregated_points (
torch.
Tensor): Aggregated points from
vote aggregation layer.
Returns:
...
...
@@ -491,13 +494,13 @@ class VoteHead(nn.Module):
"""Generate bboxes from vote head predictions.
Args:
points (Tensor): Input points.
points (
torch.
Tensor): Input points.
bbox_preds (dict): Predictions from vote head.
input_metas (list[dict]): Contain pcd and img's meta info.
rescale (bool): Whether to rescale bboxes.
Returns:
list[tuple[Tensor]]: Contain bbox, scores and labels.
list[tuple[
torch.
Tensor]]: Contain bbox, scores and labels.
"""
# decode boxes
obj_scores
=
F
.
softmax
(
bbox_preds
[
'obj_scores'
],
dim
=-
1
)[...,
-
1
]
...
...
@@ -523,14 +526,14 @@ class VoteHead(nn.Module):
"""multi-class nms in single batch.
Args:
obj_scores (Tensor): Objectness score of bboxes.
sem_scores (Tensor): semantic class score of bboxes.
bbox (Tensor): Predicted bbox.
points (Tensor): Input points.
obj_scores (
torch.
Tensor): Objectness score of bboxes.
sem_scores (
torch.
Tensor): semantic class score of bboxes.
bbox (
torch.
Tensor): Predicted bbox.
points (
torch.
Tensor): Input points.
input_meta (dict): Contain pcd and img's meta info.
Returns:
tuple[Tensor]: Contain bbox, scores and labels.
tuple[
torch.
Tensor]: Contain bbox, scores and labels.
"""
bbox
=
input_meta
[
'box_type_3d'
](
bbox
,
...
...
mmdet3d/models/detectors/base.py
View file @
8f88914d
...
...
@@ -7,15 +7,16 @@ class Base3DDetector(BaseDetector):
def
forward_test
(
self
,
points
,
img_metas
,
img
=
None
,
**
kwargs
):
"""
Args:
points (
L
ist[Tensor]): the outer list indicates test-time
augmentations and inner Tensor should have a shape NxC,
points (
l
ist[
torch.
Tensor]): the outer list indicates test-time
augmentations and inner
torch.
Tensor should have a shape NxC,
which contains all points in the batch.
img_metas (
L
ist[
L
ist[dict]]): the outer list indicates test-time
img_metas (
l
ist[
l
ist[dict]]): the outer list indicates test-time
augs (multiscale, flip, etc.) and the inner list indicates
images in a batch
img (List[Tensor], optional): the outer list indicates test-time
augmentations and inner Tensor should have a shape NxCxHxW,
which contains all images in the batch. Defaults to None.
img (list[torch.Tensor], optional): the outer
list indicates test-time augmentations and inner
torch.Tensor should have a shape NxCxHxW, which contains
all images in the batch. Defaults to None.
"""
for
var
,
name
in
[(
points
,
'points'
),
(
img_metas
,
'img_metas'
)]:
if
not
isinstance
(
var
,
list
):
...
...
@@ -42,9 +43,9 @@ class Base3DDetector(BaseDetector):
Calls either forward_train or forward_test depending on whether
return_loss=True. Note this setting will change the expected inputs.
When `return_loss=True`, img and img_metas are single-nested (i.e.
Tensor and
L
ist[dict]), and when `resturn_loss=False`, img and
torch.
Tensor and
l
ist[dict]), and when `resturn_loss=False`, img and
img_metas should be double nested
(i.e.
L
ist[Tensor],
L
ist[
L
ist[dict]]), with the outer list
(i.e.
l
ist[
torch.
Tensor],
l
ist[
l
ist[dict]]), with the outer list
indicating test time augmentations.
"""
if
return_loss
:
...
...
mmdet3d/models/detectors/single_stage.py
View file @
8f88914d
...
...
@@ -52,7 +52,10 @@ class SingleStage3DDetector(Base3DDetector):
self
.
bbox_head
.
init_weights
()
def
extract_feat
(
self
,
points
,
img_metas
=
None
):
"""Directly extract features from the backbone+neck
"""Directly extract features from the backbone+neck.
Args:
points (torch.Tensor): Input points.
"""
x
=
self
.
backbone
(
points
)
if
self
.
with_neck
:
...
...
mmdet3d/models/detectors/votenet.py
View file @
8f88914d
...
...
@@ -36,15 +36,16 @@ class VoteNet(SingleStage3DDetector):
"""Forward of training.
Args:
points (list[Tensor]): Points of each batch.
points (list[
torch.
Tensor]): Points of each batch.
img_metas (list): Image metas.
gt_bboxes_3d (:obj:BaseInstance3DBoxes): gt bboxes of each batch.
gt_labels_3d (list[Tensor]): gt class labels of each batch.
pts_semantic_mask (None | list[Tensor]): point-wise semantic
gt_labels_3d (list[
torch.
Tensor]): gt class labels of each batch.
pts_semantic_mask (None | list[
torch.
Tensor]): point-wise semantic
label of each batch.
pts_instance_mask (None | list[Tensor]): point-wise instance
pts_instance_mask (None | list[
torch.
Tensor]): point-wise instance
label of each batch.
gt_bboxes_ignore (None | list[Tensor]): Specify which bounding.
gt_bboxes_ignore (None | list[torch.Tensor]): Specify
which bounding.
Returns:
dict: Losses.
...
...
@@ -63,7 +64,7 @@ class VoteNet(SingleStage3DDetector):
"""Forward of testing.
Args:
points (list[Tensor]): Points of each sample.
points (list[
torch.
Tensor]): Points of each sample.
img_metas (list): Image metas.
rescale (bool): Whether to rescale results.
...
...
tools/data_converter/create_gt_database.py
View file @
8f88914d
...
...
@@ -120,6 +120,27 @@ def create_groundtruth_database(dataset_class_name,
bev_only
=
False
,
coors_range
=
None
,
with_mask
=
False
):
"""Given the raw data, generate the ground truth database.
Args:
dataset_class_name (str): Name of the input dataset.
data_path (str): Path of the data.
info_prefix (str): Prefix of the info file.
info_path (str): Path of the info file.
Default: None.
mask_anno_path (str): Path of the mask_anno.
Default: None.
used_classes (list[str]): Classes have been used.
Default: None.
database_save_path (str): Path to save database.
Default: None.
db_info_save_path (str): Path to save db_info.
Default: None.
relative_path (bool): Whether to use relative path.
Default: True.
with_mask (bool): Whether to use mask.
Default: False.
"""
print
(
f
'Create GT Database of
{
dataset_class_name
}
'
)
dataset_cfg
=
dict
(
type
=
dataset_class_name
,
...
...
tools/data_converter/kitti_converter.py
View file @
8f88914d
...
...
@@ -10,6 +10,9 @@ from .kitti_data_utils import get_kitti_image_info
def
convert_to_kitti_info_version2
(
info
):
"""convert kitti info v1 to v2 if possible.
Args:
info (dict): Info of the input kitti data.
"""
if
'image'
not
in
info
or
'calib'
not
in
info
or
'point_cloud'
not
in
info
:
info
[
'image'
]
=
{
...
...
@@ -78,6 +81,16 @@ def create_kitti_info_file(data_path,
pkl_prefix
=
'kitti_'
,
save_path
=
None
,
relative_path
=
True
):
"""Create info file of KITTI dataset.
Given the raw data, generate its related info file in pkl format.
Args:
data_path (str): Path of the data root.
pkl_prefix (str): Prefix of the info file to be generated.
save_path (str): Path to save the info file.
relative_path (bool): Whether to use relative path.
"""
imageset_folder
=
Path
(
data_path
)
/
'ImageSets'
train_img_ids
=
_read_imageset_file
(
str
(
imageset_folder
/
'train_6014.txt'
))
...
...
tools/data_converter/nuscenes_converter.py
View file @
8f88914d
...
...
@@ -20,6 +20,18 @@ def create_nuscenes_infos(root_path,
info_prefix
,
version
=
'v1.0-trainval'
,
max_sweeps
=
10
):
"""Create info file of nuscene dataset.
Given the raw data, generate its related info file in pkl format.
Args:
root_path (str): Path of the data root.
info_prefix (str): Prefix of the info file to be generated.
version (str): Version of the data.
Default: 'v1.0-trainval'
max_sweeps (int): Max number of sweeps.
Default: 10
"""
from
nuscenes.nuscenes
import
NuScenes
nusc
=
NuScenes
(
version
=
version
,
dataroot
=
root_path
,
verbose
=
True
)
from
nuscenes.utils
import
splits
...
...
Prev
1
2
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