Skip to content

Commit 04fff4c

Browse files
committed
fixed folder formatting and creation issues
1 parent 2b2afc6 commit 04fff4c

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

GEMstack/onboard/perception/sensorFusionDataPrep/rosbag_processor.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
class RosbagProcessor():
1717
# Pairs up and stores Image and PointCloud2 messages into their respective test (20%) and training (80%) png and bin files.
1818
def __init__(self, DATA_DIR: str, train_counter: int = 0, test_counter: int = 0) -> None:
19-
20-
self.__TEST_DIR = DATA_DIR / 'test'
21-
self.__TRAIN_DIR = DATA_DIR / 'train'
22-
TEST_IMG_DIR = self.__TEST_DIR / 'img'
23-
TEST_BIN_DIR = self.__TEST_DIR / 'bin'
24-
TRAIN_IMG_DIR = self.__TRAIN_DIR / 'img'
25-
TRAIN_BIN_DIR = self.__TRAIN_DIR / 'bin'
19+
self.__img_folder = 'image_2'
20+
self.__lidar_folder = 'velodyne'
21+
22+
self.__TEST_DIR = DATA_DIR / 'testing'
23+
self.__TRAIN_DIR = DATA_DIR / 'training'
24+
TEST_IMG_DIR = self.__TEST_DIR / self.__img_folder
25+
TEST_BIN_DIR = self.__TEST_DIR / self.__lidar_folder
26+
TRAIN_IMG_DIR = self.__TRAIN_DIR / self.__img_folder
27+
TRAIN_BIN_DIR = self.__TRAIN_DIR / self.__lidar_folder
2628

2729
# Create directories if they don't exist
2830
TEST_IMG_DIR.mkdir(parents=True, exist_ok=True)
@@ -53,8 +55,8 @@ def pair_data_callback(self, rgb_image_msg: Image, lidar_pc2_msg: PointCloud2):
5355
idx = self.__train_counter
5456

5557
# Store point cloud and image data with KITTI formatted filenames:
56-
image_filename = PARENT_FOLDER / 'img' / f"{idx:06d}.png"
57-
pc_filename = PARENT_FOLDER / 'bin' / f"{idx:06d}.bin"
58+
image_filename = PARENT_FOLDER / self.__img_folder / f"{idx:06d}.png"
59+
pc_filename = PARENT_FOLDER / self.__lidar_folder / f"{idx:06d}.bin"
5860
# image_filename = self.get_path(image_filename)
5961
# pc_filename = self.get_path(pc_filename)
6062

@@ -97,4 +99,5 @@ def pair_data_callback(self, rgb_image_msg: Image, lidar_pc2_msg: PointCloud2):
9799

98100
# Path to the destination folder (relative from this script)
99101
DATA_DIR = BASE_DIR.parent.parent.parent.parent / 'data' / 'sensorFusionData'
102+
DATA_DIR.mkdir(parents=True, exist_ok=True)
100103
bag_processor = RosbagProcessor(DATA_DIR=DATA_DIR)

0 commit comments

Comments
 (0)