From a5bb2cde3ab733ca890d4fe7efb1a1bc48feef86 Mon Sep 17 00:00:00 2001 From: Jingwei Zhang Date: Thu, 3 Nov 2022 16:33:30 +0800 Subject: [PATCH] [Fix]: fix image conversion of Waymo to avoid information loss (#1979) --- tools/dataset_converters/waymo_converter.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/dataset_converters/waymo_converter.py b/tools/dataset_converters/waymo_converter.py index b9e8ee488..e03d748e5 100644 --- a/tools/dataset_converters/waymo_converter.py +++ b/tools/dataset_converters/waymo_converter.py @@ -12,7 +12,6 @@ from glob import glob from os.path import join -import mmcv import mmengine import numpy as np import tensorflow as tf @@ -162,8 +161,8 @@ def save_image(self, frame, file_idx, frame_idx): 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)}.jpg' - img = mmcv.imfrombytes(img.image) - mmcv.imwrite(img, img_path) + 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.