Skip to content

Commit

Permalink
[Fix] Fix waymo converter (open-mmlab#2040)
Browse files Browse the repository at this point in the history
* fix waymo converter

* [Fix] Update waymo converter and fix lint

* Update waymo_converter.py

* Update kitti_converter.py

* Update update_infos_to_v2.py

* revert
  • Loading branch information
Xiangxu-0103 authored and ZwwWayne committed Dec 3, 2022
1 parent feaa80c commit b1ace8e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
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
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

0 comments on commit b1ace8e

Please sign in to comment.