diff --git a/prepare_data.py b/prepare_data.py new file mode 100644 index 0000000000000000000000000000000000000000..394d8bf83c939a7adcefc60b91ff857c101d871d --- /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 + + +