Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added image loading in SUNRGB-D dataset #195

Merged
merged 6 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions mmdet3d/datasets/sunrgbd_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,55 @@ def __init__(self,
box_type_3d=box_type_3d,
filter_empty_gt=filter_empty_gt,
test_mode=test_mode)
if self.modality is None:
self.modality = dict(
use_camera=True,
use_lidar=True,
)
assert self.modality['use_camera'] or self.modality['use_lidar']

def get_data_info(self, index):
"""Get data info according to the given index.

Args:
index (int): Index of the sample data to get.

Returns:
dict: Data information that will be passed to the data \
preprocessing pipelines. It includes the following keys:

- sample_idx (str): Sample index.
- pts_filename (str, optional): Filename of point clouds.
- file_name (str, optional): Filename of point clouds.
- img_prefix (str | None, optional): Prefix of image files.
- img_info (dict, optional): Image info.
- calib (dict, optional): Camera calibration info.
- ann_info (dict): Annotation info.
"""
info = self.data_infos[index]
sample_idx = info['point_cloud']['lidar_idx']
assert info['point_cloud']['lidar_idx'] == info['image']['image_idx']
input_dict = dict(sample_idx=sample_idx)

if self.modality['use_lidar']:
pts_filename = osp.join(self.data_root, info['pts_path'])
input_dict['pts_filename'] = pts_filename
input_dict['file_name'] = pts_filename

if self.modality['use_camera']:
img_filename = osp.join(self.data_root,
info['image']['image_path'])
input_dict['img_prefix'] = None
input_dict['img_info'] = dict(filename=img_filename)
calib = info['calib']
input_dict['calib'] = calib

if not self.test_mode:
annos = self.get_ann_info(index)
input_dict['ann_info'] = annos
if self.filter_empty_gt and len(annos['gt_bboxes_3d']) == 0:
return None
return input_dict

def get_ann_info(self, index):
"""Get annotation info according to the given index.
Expand Down
14 changes: 11 additions & 3 deletions mmdet3d/models/detectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
from .voxelnet import VoxelNet

__all__ = [
'Base3DDetector', 'VoxelNet', 'DynamicVoxelNet', 'MVXTwoStageDetector',
'DynamicMVXFasterRCNN', 'MVXFasterRCNN', 'PartA2', 'VoteNet', 'H3DNet',
'CenterPoint', 'SSD3DNet'
'Base3DDetector',
'VoxelNet',
'DynamicVoxelNet',
'MVXTwoStageDetector',
'DynamicMVXFasterRCNN',
'MVXFasterRCNN',
'PartA2',
'VoteNet',
'H3DNet',
'CenterPoint',
'SSD3DNet',
]
5 changes: 1 addition & 4 deletions mmdet3d/models/detectors/votenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

@DETECTORS.register_module()
class VoteNet(SingleStage3DDetector):
"""VoteNet model.

https://arxiv.org/pdf/1904.09664.pdf
"""
r"""`VoteNet <https://arxiv.org/pdf/1904.09664.pdf>`_ for 3D detection."""

def __init__(self,
backbone,
Expand Down
3 changes: 1 addition & 2 deletions tools/data_converter/sunrgbd_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ def process_single_scene(sample_idx):
osp.join(self.root_dir, 'points', f'{sample_idx:06d}.bin'))

info['pts_path'] = osp.join('points', f'{sample_idx:06d}.bin')
img_name = osp.join(self.image_dir, f'{sample_idx:06d}')
img_path = osp.join(self.image_dir, img_name)
img_path = osp.join('image', f'{sample_idx:06d}.jpg')
image_info = {
'image_idx': sample_idx,
'image_shape': self.get_image_shape(sample_idx),
Expand Down