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

[Fix] Fix waymo converter #2040

Merged
merged 6 commits into from
Nov 22, 2022
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
2 changes: 1 addition & 1 deletion mmdet3d/datasets/convert_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def get_kitti_style_2d_boxes(info: dict,
repro_rec['velocity'] = -1 # no velocity in KITTI

center_3d = np.array(loc).reshape([1, 3])
center_2d_with_depth = box_np_ops.points_cam2img(
center_2d_with_depth = points_cam2img(
center_3d, camera_intrinsic, with_depth=True)
center_2d_with_depth = center_2d_with_depth.squeeze().tolist()

Expand Down
4 changes: 2 additions & 2 deletions mmdet3d/models/roi_heads/bbox_heads/pv_rcnn_bbox_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import numpy as np
import torch
from mmcv.cnn import ConvModule
from mmdet.models.task_modules.samplers import SamplingResult
from mmdet.models.utils import multi_apply
from mmengine.model import BaseModule
from mmengine.structures import InstanceData
from torch import nn as nn
Expand All @@ -14,8 +16,6 @@
from mmdet3d.structures.bbox_3d import (LiDARInstance3DBoxes,
rotation_3d_in_axis, xywhr2xyxyr)
from mmdet3d.utils import InstanceList
from mmdet.models.task_modules.samplers import SamplingResult
from mmdet.models.utils import multi_apply


@MODELS.register_module()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import torch
from mmcv.cnn.bricks import build_norm_layer
from mmdet.models.utils import multi_apply
from mmengine.model import BaseModule
from mmengine.structures import InstanceData
from torch import nn as nn

from mmdet3d.models.builder import build_loss
from mmdet3d.registry import MODELS
from mmdet3d.utils import InstanceList
from mmdet.models.utils import multi_apply


@MODELS.register_module()
Expand Down
4 changes: 2 additions & 2 deletions mmdet3d/models/roi_heads/pv_rcnn_roi_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from typing import List, Optional

import torch
from mmdet.models.task_modules import AssignResult
from mmdet.models.task_modules.samplers import SamplingResult
from torch.nn import functional as F

from mmdet3d.models.roi_heads.base_3droi_head import Base3DRoIHead
from mmdet3d.registry import MODELS
from mmdet3d.structures import bbox3d2roi
from mmdet3d.structures.det3d_data_sample import SampleList
from mmdet3d.utils import InstanceList
from mmdet.models.task_modules import AssignResult
from mmdet.models.task_modules.samplers import SamplingResult


@MODELS.register_module()
Expand Down
8 changes: 4 additions & 4 deletions tools/dataset_converters/update_infos_to_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ def get_empty_lidar_points():
num_pts_feats=None,
# (str, optional): Path of LiDAR data file.
lidar_path=None,
# (list[list[float]]): Transformation matrix from lidar
# or depth to image with shape [4, 4].
lidar2img=None,
# (list[list[float]], optional): Transformation matrix
# from lidar to ego-vehicle
# with shape [4, 4].
Expand Down Expand Up @@ -120,6 +117,9 @@ def get_empty_img_info():
# matrix from camera to image with
# shape [3, 3], [3, 4] or [4, 4].
cam2img=None,
# (list[list[float]]): Transformation matrix from lidar
# or depth to image with shape [4, 4].
lidar2img=None,
# (list[list[float]], optional) : Transformation
# matrix from camera to ego-vehicle
# with shape [4, 4].
Expand Down Expand Up @@ -159,7 +159,7 @@ def get_empty_standard_data_info(

data_info = dict(
# (str): Sample id of the frame.
sample_id=None,
sample_idx=None,
# (str, optional): '000010'
token=None,
**get_single_image_sweep(camera_types),
Expand Down
15 changes: 7 additions & 8 deletions tools/dataset_converters/waymo_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def __init__(self,
'_SIDE_LEFT',
'_SIDE_RIGHT',
]
self.lidar_list = [
'_FRONT', '_FRONT_RIGHT', '_FRONT_LEFT', '_SIDE_RIGHT',
'_SIDE_LEFT'
]
self.lidar_list = ['TOP', 'FRONT', 'SIDE_LEFT', 'SIDE_RIGHT', 'REAR']
self.type_list = [
'UNKNOWN', 'VEHICLE', 'PEDESTRIAN', 'SIGN', 'CYCLIST'
]
Expand Down Expand Up @@ -135,7 +132,8 @@ def convert_one(self, file_idx):

self.save_image(frame, file_idx, frame_idx)
self.save_calib(frame, file_idx, frame_idx)
self.save_lidar(frame, file_idx, frame_idx)
if 'testing_3d_camera_only_detection' not in self.load_dir:
self.save_lidar(frame, file_idx, frame_idx)
self.save_pose(frame, file_idx, frame_idx)
self.save_timestamp(frame, file_idx, frame_idx)

Expand Down Expand Up @@ -441,7 +439,6 @@ def create_folder(self):
dir_list1 = [
self.label_all_save_dir,
self.calib_save_dir,
self.point_cloud_save_dir,
self.pose_save_dir,
self.timestamp_save_dir,
]
Expand All @@ -451,10 +448,12 @@ def create_folder(self):
dir_list2.append(self.cam_sync_label_save_dir)
else:
dir_list1 = [
self.calib_save_dir, self.point_cloud_save_dir,
self.pose_save_dir, self.timestamp_save_dir
self.calib_save_dir, self.pose_save_dir,
self.timestamp_save_dir
]
dir_list2 = [self.image_save_dir]
if 'testing_3d_camera_only_detection' not in self.load_dir:
dir_list1.append(self.point_cloud_save_dir)
for d in dir_list1:
mmengine.mkdir_or_exist(d)
for d in dir_list2:
Expand Down