From 2c03d6e61b3e3bb9f2ac919461ce863afc55a2a3 Mon Sep 17 00:00:00 2001 From: zzj403 Date: Tue, 23 Aug 2022 19:57:33 +0800 Subject: [PATCH] new update in dev branch --- tools/data_converter/kitti_data_utils.py | 4 +++- tools/data_converter/waymo_converter.py | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/data_converter/kitti_data_utils.py b/tools/data_converter/kitti_data_utils.py index cae84cc6ea..40e8b81596 100644 --- a/tools/data_converter/kitti_data_utils.py +++ b/tools/data_converter/kitti_data_utils.py @@ -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) @@ -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'] diff --git a/tools/data_converter/waymo_converter.py b/tools/data_converter/waymo_converter.py index f991514bd0..dae5dec236 100644 --- a/tools/data_converter/waymo_converter.py +++ b/tools/data_converter/waymo_converter.py @@ -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. @@ -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.