"git@developer.sourcefind.cn:change/sglang.git" did not exist on "621dfb88864c645ae4e6d41807c5ce6f78c33294"
Unverified Commit 9de2d966 authored by twang's avatar twang Committed by GitHub
Browse files

[Enhance] Reduce requirements if waymo dataset is not used (#121)

* Reduce requirements if waymo dataset is not used

* Update waymo.md

* Update optional.txt

* Update waymo.md

Add instructions of requirements/optional.txt related to waymo
parent 89cecc5e
...@@ -4,6 +4,23 @@ This page provides specific tutorials about the usage of MMDetection3D for waymo ...@@ -4,6 +4,23 @@ This page provides specific tutorials about the usage of MMDetection3D for waymo
## Prepare datasets ## Prepare datasets
Before preparing waymo dataset, if you only installed requirements in `requirements/build.txt` and `requirements/runtime.txt` before, please install the official package for this dataset at first by running
```
# tf 2.1.0.
pip install waymo-open-dataset-tf-2-1-0==1.2.0
# tf 2.0.0
# pip install waymo-open-dataset-tf-2-0-0==1.2.0
# tf 1.15.0
# pip install waymo-open-dataset-tf-1-15-0==1.2.0
```
or
```
pip install -r requirements/optional.txt
```
Like the general way to prepare dataset, it is recommended to symlink the dataset root to `$MMDETECTION3D/data`. Like the general way to prepare dataset, it is recommended to symlink the dataset root to `$MMDETECTION3D/data`.
Due to the original waymo data format is based on `tfrecord`, we need to preprocess the raw data for convenient usage in the training and evaluation procedure. Our approach is to convert them into KITTI format. Due to the original waymo data format is based on `tfrecord`, we need to preprocess the raw data for convenient usage in the training and evaluation procedure. Our approach is to convert them into KITTI format.
......
...@@ -2,12 +2,18 @@ r"""Adapted from `Waymo to KITTI converter ...@@ -2,12 +2,18 @@ r"""Adapted from `Waymo to KITTI converter
<https://github.com/caizhongang/waymo_kitti_converter>`_. <https://github.com/caizhongang/waymo_kitti_converter>`_.
""" """
try:
from waymo_open_dataset import dataset_pb2 as open_dataset
except ImportError:
raise ImportError(
'Please run "pip install waymo-open-dataset-tf-2-1-0==1.2.0" '
'to install the official devkit first.')
import mmcv import mmcv
import numpy as np import numpy as np
import tensorflow as tf import tensorflow as tf
from glob import glob from glob import glob
from os.path import join from os.path import join
from waymo_open_dataset import dataset_pb2 as open_dataset
from waymo_open_dataset import label_pb2 from waymo_open_dataset import label_pb2
from waymo_open_dataset.protos import metrics_pb2 from waymo_open_dataset.protos import metrics_pb2
...@@ -100,8 +106,8 @@ class KITTI2Waymo(object): ...@@ -100,8 +106,8 @@ class KITTI2Waymo(object):
""" """
def parse_one_object(instance_idx): def parse_one_object(instance_idx):
"""Parse one instance in kitti format and convert them to """Parse one instance in kitti format and convert them to `Object`
`Object` proto. proto.
Args: Args:
instance_idx (int): Index of the instance to be converted. instance_idx (int): Index of the instance to be converted.
......
...@@ -8,7 +8,6 @@ from os import path as osp ...@@ -8,7 +8,6 @@ from os import path as osp
from mmdet.datasets import DATASETS from mmdet.datasets import DATASETS
from ..core.bbox import Box3DMode, points_cam2img from ..core.bbox import Box3DMode, points_cam2img
from ..core.evaluation.waymo_utils.prediction_kitti_to_waymo import KITTI2Waymo
from .kitti_dataset import KittiDataset from .kitti_dataset import KittiDataset
...@@ -184,6 +183,8 @@ class WaymoDataset(KittiDataset): ...@@ -184,6 +183,8 @@ class WaymoDataset(KittiDataset):
pklfile_prefix, pklfile_prefix,
submission_prefix) submission_prefix)
if 'waymo' in data_format: if 'waymo' in data_format:
from ..core.evaluation.waymo_utils.prediction_kitti_to_waymo import \
KITTI2Waymo # noqa
waymo_root = osp.join( waymo_root = osp.join(
self.data_root.split('kitti_format')[0], 'waymo_format') self.data_root.split('kitti_format')[0], 'waymo_format')
if self.split == 'training': if self.split == 'training':
......
waymo-open-dataset-tf-2-1-0==1.2.0
...@@ -4,8 +4,7 @@ networkx>=2.2,<2.3 ...@@ -4,8 +4,7 @@ networkx>=2.2,<2.3
numba==0.48.0 numba==0.48.0
nuscenes-devkit nuscenes-devkit
plyfile plyfile
scikit-image
# by default we also use tensorboard to log results # by default we also use tensorboard to log results
tensorboard tensorboard
trimesh>=2.35.39,<2.35.40 trimesh>=2.35.39,<2.35.40
scikit-image
waymo-open-dataset-tf-2-1-0==1.2.0
...@@ -5,7 +5,6 @@ from tools.data_converter import indoor_converter as indoor ...@@ -5,7 +5,6 @@ from tools.data_converter import indoor_converter as indoor
from tools.data_converter import kitti_converter as kitti from tools.data_converter import kitti_converter as kitti
from tools.data_converter import lyft_converter as lyft_converter from tools.data_converter import lyft_converter as lyft_converter
from tools.data_converter import nuscenes_converter as nuscenes_converter from tools.data_converter import nuscenes_converter as nuscenes_converter
from tools.data_converter import waymo_converter as waymo
from tools.data_converter.create_gt_database import create_groundtruth_database from tools.data_converter.create_gt_database import create_groundtruth_database
...@@ -150,6 +149,8 @@ def waymo_data_prep(root_path, ...@@ -150,6 +149,8 @@ def waymo_data_prep(root_path,
max_sweeps (int): Number of input consecutive frames. Default: 5 \ max_sweeps (int): Number of input consecutive frames. Default: 5 \
Here we store pose information of these frames for later use. Here we store pose information of these frames for later use.
""" """
from tools.data_converter import waymo_converter as waymo
splits = ['training', 'validation', 'testing'] splits = ['training', 'validation', 'testing']
for i, split in enumerate(splits): for i, split in enumerate(splits):
load_dir = osp.join(root_path, 'waymo_format', split) load_dir = osp.join(root_path, 'waymo_format', split)
......
...@@ -2,13 +2,18 @@ r"""Adapted from `Waymo to KITTI converter ...@@ -2,13 +2,18 @@ r"""Adapted from `Waymo to KITTI converter
<https://github.com/caizhongang/waymo_kitti_converter>`_. <https://github.com/caizhongang/waymo_kitti_converter>`_.
""" """
try:
from waymo_open_dataset import dataset_pb2
except ImportError:
raise ImportError(
'Please run "pip install waymo-open-dataset-tf-2-1-0==1.2.0" '
'to install the official devkit first.')
import mmcv import mmcv
import numpy as np import numpy as np
import tensorflow as tf import tensorflow as tf
from glob import glob from glob import glob
from os.path import join from os.path import join
from waymo_open_dataset import dataset_pb2
from waymo_open_dataset import dataset_pb2 as open_dataset
from waymo_open_dataset.utils import range_image_utils, transform_utils from waymo_open_dataset.utils import range_image_utils, transform_utils
from waymo_open_dataset.utils.frame_utils import \ from waymo_open_dataset.utils.frame_utils import \
parse_range_image_and_camera_projection parse_range_image_and_camera_projection
...@@ -101,7 +106,7 @@ class Waymo2KITTI(object): ...@@ -101,7 +106,7 @@ class Waymo2KITTI(object):
for frame_idx, data in enumerate(dataset): for frame_idx, data in enumerate(dataset):
frame = open_dataset.Frame() frame = dataset_pb2.Frame()
frame.ParseFromString(bytearray(data.numpy())) frame.ParseFromString(bytearray(data.numpy()))
if (self.selected_waymo_locations is not None if (self.selected_waymo_locations is not None
and frame.context.stats.location and frame.context.stats.location
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment