| import os |
| import glob |
| from natsort import natsorted |
| import shutil |
|
|
| |
| |
| |
| |
| |
|
|
|
|
| scene_name_idx = 6 |
| output_base_folder = "/mnt/seagate/workspace/ToF360_NeurIPS2024/" |
| scene_base_paths = [ |
| |
| |
| |
| |
| |
| "/mnt/seagate/workspace/data/Thierry/0713_DFKI_parking4/20230625_default_param_amp50/equi_viewpo_denoised"] |
|
|
| modality_dict = {"HHA": "HHA/*_equi_hha.png", |
| "RGB": "RGB_png/*_equi_rgb.png", |
| |
| "XYZ": "XYZ/*_equi_XYZ.npy", |
| "annotation": "coco_annotation/raw_json/*_coco.json", |
| "depth": "depth/*_equi_depth.png", |
| |
| "normal": "normal/*_equi_normal.png", |
| "pretty/instances": "coco_annotation/instances_pretty/*_instance_pretty.png", |
| |
| "pretty/semantics": "coco_annotation/semantics_pretty/*_semantic_pretty.png" |
| } |
|
|
| def import_file_list(scene_base_path, file_name_rule, scene_name_idx): |
| scene_name = scene_base_path.split("/")[scene_name_idx] |
| if scene_name == "221010_weingarten_hospital": |
| new_scene_name = "Hospital" |
| elif scene_name == "0602_DFKI4F": |
| new_scene_name = "Office_Room_2" |
| elif scene_name == "0605_DFKI_coffee_room": |
| new_scene_name = "Office_Room_1" |
| elif scene_name == "0520_DFKI_parking1" or "0713_DFKI_parking2" or "0713_DFKI_parking3" or "0713_DFKI_parking4": |
| new_scene_name = "Parking_Lot" |
|
|
| if new_scene_name == "Parking_Lot": |
| scene_base_paths_park = ["/mnt/seagate/workspace/data/Thierry/0520_DFKI_parking1/tripod/20230625_default_param_amp50/equi_viewpo_denoised/", |
| "/mnt/seagate/workspace/data/Thierry/0713_DFKI_parking2/20230625_default_param_amp50/equi_viewpo_denoised/", |
| "/mnt/seagate/workspace/data/Thierry/0713_DFKI_parking3/20230625_default_param_amp50/equi_viewpo_denoised/", |
| "/mnt/seagate/workspace/data/Thierry/0713_DFKI_parking4/20230625_default_param_amp50/equi_viewpo_denoised/"] |
| files = [] |
| for scene_base_path_park in scene_base_paths_park: |
| files += natsorted(glob.glob(scene_base_path_park + file_name_rule)) |
| else: |
| files = natsorted(glob.glob(scene_base_path + file_name_rule)) |
| return files, new_scene_name |
|
|
|
|
| for scene_base_path in scene_base_paths: |
| for modality in modality_dict.keys(): |
| input_files, new_scene_name = import_file_list(scene_base_path, modality_dict[modality], scene_name_idx) |
| os.makedirs(output_base_folder + new_scene_name + "/" + modality, exist_ok=True) |
| |
| for input_file_idx, input_file in enumerate(input_files): |
| |
| |
| |
| |
| |
| |
| input_file_format = input_file.split("/")[-1].split("_equi_")[-1] |
| output_file = f"{output_base_folder}{new_scene_name}/{modality}/{input_file_idx:03}_{new_scene_name}_equi_{input_file_format}" |
| print("input_file >> ", input_file) |
| print("output_file >> ", output_file) |
| print("--------------------------") |
| shutil.copy2(input_file, output_file) |
|
|