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] Remove exporting 2D annotations on Lyft #867

Merged
merged 1 commit into from
Aug 18, 2021
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
38 changes: 6 additions & 32 deletions tools/create_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,45 +81,23 @@ def nuscenes_data_prep(root_path,
f'{out_dir}/{info_prefix}_infos_train.pkl')


def lyft_data_prep(root_path,
info_prefix,
version,
dataset_name,
out_dir,
max_sweeps=10):
def lyft_data_prep(root_path, info_prefix, version, max_sweeps=10):
"""Prepare data related to Lyft dataset.

Related data consists of '.pkl' files recording basic infos,
and 2D annotations.
Although the ground truth database is not used in Lyft, it can also be
generated like nuScenes.
Related data consists of '.pkl' files recording basic infos.
Although the ground truth database and 2D annotations are not used in
Lyft, it can also be generated like nuScenes.

Args:
root_path (str): Path of dataset root.
info_prefix (str): The prefix of info filenames.
version (str): Dataset version.
dataset_name (str): The dataset class name.
out_dir (str): Output directory of the groundtruth database info.
Not used here if the groundtruth database is not generated.
max_sweeps (int): Number of input consecutive frames. Default: 10
max_sweeps (int, optional): Number of input consecutive frames.
Defaults to 10.
"""
lyft_converter.create_lyft_infos(
root_path, info_prefix, version=version, max_sweeps=max_sweeps)

if version == 'v1.01-test':
return

train_info_name = f'{info_prefix}_infos_train'
val_info_name = f'{info_prefix}_infos_val'

info_train_path = osp.join(root_path, f'{train_info_name}.pkl')
info_val_path = osp.join(root_path, f'{val_info_name}.pkl')

lyft_converter.export_2d_annotation(
root_path, info_train_path, version=version)
lyft_converter.export_2d_annotation(
root_path, info_val_path, version=version)


def scannet_data_prep(root_path, info_prefix, out_dir, workers):
"""Prepare the info file for scannet dataset.
Expand Down Expand Up @@ -273,16 +251,12 @@ def waymo_data_prep(root_path,
root_path=args.root_path,
info_prefix=args.extra_tag,
version=train_version,
dataset_name='LyftDataset',
out_dir=args.out_dir,
max_sweeps=args.max_sweeps)
test_version = f'{args.version}-test'
lyft_data_prep(
root_path=args.root_path,
info_prefix=args.extra_tag,
version=test_version,
dataset_name='LyftDataset',
out_dir=args.out_dir,
max_sweeps=args.max_sweeps)
elif args.dataset == 'waymo':
waymo_data_prep(
Expand Down
4 changes: 4 additions & 0 deletions tools/data_converter/lyft_converter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import mmcv
import numpy as np
import os
from logging import warning
from lyft_dataset_sdk.lyftdataset import LyftDataset as Lyft
from os import path as osp
from pyquaternion import Quaternion
Expand Down Expand Up @@ -217,6 +218,9 @@ def export_2d_annotation(root_path, info_path, version):
info_path (str): Path of the info file.
version (str): Dataset version.
"""
warning.warn('DeprecationWarning: 2D annotations are not used on the '
'Lyft dataset. The function export_2d_annotation will be '
'deprecated.')
# get bbox annotations for camera
camera_types = [
'CAM_FRONT',
Expand Down