From 8e3536c63154952b6b76cbc0407280c17de25ea7 Mon Sep 17 00:00:00 2001 From: Mahmoud Ahmed Ali <mahmoudali2929@gmail.com> Date: Tue, 14 Feb 2023 17:59:05 +0000 Subject: [PATCH] Add prepare dataset file --- prepare_data.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 prepare_data.py diff --git a/prepare_data.py b/prepare_data.py new file mode 100644 index 0000000..394d8bf --- /dev/null +++ b/prepare_data.py @@ -0,0 +1,39 @@ +import shutil + + +def reform_data(src, data_name, data_option): + k = 0 + for i in range(1, 1000): + g = 0 + for j in range(1, 6): + count = (k*5) + g + + if data_option == "ground_truth_rgb": + src_img = f"{src}/{i}/grabber_{j}/color/image/0_0.png" + dst_img = f"{data_name}/RGB/{count}.png" + else: + src_img = f"{src}/{i}/grabber_{j}/depth/image/0_0.png" + dst_img = f"{data_name}/RGB/{count}.png" + shutil.copy(src_img, dst_img) + + src_mask = f"{src}/{i}/grabber_{j}/{data_option}/semantic_map/0_0.png" + dst_mask = f"{data_name}/Mask/{count}.png" + shutil.copy(src_mask, dst_mask) + + src_path_pose = f"{src}/{i}/grabber_{j}/{data_option}/3d_pose/0_0.json" + dst_path_pose = f"{data_name}/Pose/{count}.json" + shutil.copy(src_path_pose, dst_path_pose) + + src_depth = f"{src}/{i}/grabber_{j}/depth/depth_map/0_0.tiff" + dst_depth = f"{data_name}/Depth/{count}.tiff" + shutil.copy(src_depth, dst_depth) + + src_bbox = f"{src}/{i}/grabber_{j}/{data_option}/2d_detection/0_0.json" + dst_bbox = f"{data_name}/Bbox_2d/{count}.json" + shutil.copy(src_bbox, dst_bbox) + + g += 1 + k += 1 + + + -- GitLab