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

new update in dev branch:Fix waymo converter to save img in .jpg(offical in waymo open) reduce dataset from 3.3T to 1.1T #1759

Merged
merged 1 commit into from
Oct 27, 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
4 changes: 3 additions & 1 deletion tools/data_converter/kitti_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def get_image_path(idx,
relative_path=True,
exist_check=True,
info_type='image_2',
file_tail='.png',
use_prefix_id=False):
return get_kitti_info_path(idx, prefix, info_type, '.png', training,
return get_kitti_info_path(idx, prefix, info_type, file_tail, training,
relative_path, exist_check, use_prefix_id)


Expand Down Expand Up @@ -378,6 +379,7 @@ def gather_single(self, idx):
self.training,
self.relative_path,
info_type='image_0',
file_tail='.jpg',
use_prefix_id=True)
if self.with_imageshape:
img_path = image_info['image_path']
Expand Down
10 changes: 6 additions & 4 deletions tools/data_converter/waymo_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def __len__(self):
return len(self.tfrecord_pathnames)

def save_image(self, frame, file_idx, frame_idx):
"""Parse and save the images in png format.
"""Parse and save the images in jpg format. Jpg is the original format
used by Waymo Open dataset. Saving in png format will cause huge (~3x)
unnesssary storage waste.

Args:
frame (:obj:`Frame`): Open dataset frame proto.
Expand All @@ -140,9 +142,9 @@ def save_image(self, frame, file_idx, frame_idx):
for img in frame.images:
img_path = f'{self.image_save_dir}{str(img.name - 1)}/' + \
f'{self.prefix}{str(file_idx).zfill(3)}' + \
f'{str(frame_idx).zfill(3)}.png'
img = mmcv.imfrombytes(img.image)
mmcv.imwrite(img, img_path)
f'{str(frame_idx).zfill(3)}.jpg'
with open(img_path, 'wb') as fp:
fp.write(img.image)

def save_calib(self, frame, file_idx, frame_idx):
"""Parse and save the calibration data.
Expand Down