Skip to content
Snippets Groups Projects
Commit 04365787 authored by Guillaume Duret's avatar Guillaume Duret
Browse files

better look in folder than knowing the frame

parent 429855bd
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ if __name__ == '__main__': ...@@ -53,7 +53,7 @@ if __name__ == '__main__':
dataset_name = f"GUIMOD_{choice}" dataset_name = f"GUIMOD_{choice}"
list_categories = ["banana1", "kiwi1", "pear2", "strawberry1", "apricot", "orange2", "peach1", "lemon2", "apple2" ] list_categories = ["banana1", "kiwi1", "pear2", "strawberry1", "apricot", "orange2", "peach1", "lemon2", "apple2" ]
# frame = "1_600000000" # frame = "1_600000000"
frame = "1_926000000" #frame = "1_926000000"
Nb_camera = 15 Nb_camera = 15
#Nb_world = 2 #Nb_world = 2
...@@ -85,9 +85,9 @@ if __name__ == '__main__': ...@@ -85,9 +85,9 @@ if __name__ == '__main__':
np.savetxt(f'{dataset_name}/Generated/camera_{choice}.txt', camera) np.savetxt(f'{dataset_name}/Generated/camera_{choice}.txt', camera)
reform_data(dataset_src, dataset_name, dataset_type, frame, Nb_camera, args.World_begin, args.Nb_worlds) reform_data(dataset_src, dataset_name, dataset_type, Nb_camera, args.World_begin, args.Nb_worlds)
process_compute(dataset_name, camera, Nb_camera, args.World_begin, args.Nb_worlds, list_categories, occ_target, True) process_compute(dataset_name, camera, Nb_camera, args.World_begin, args.Nb_worlds, list_categories, occ_target, False)
#transform_pose(dataset_name, Nb_camera, Nb_world, list_categories, occ_target) #transform_pose(dataset_name, Nb_camera, Nb_world, list_categories, occ_target)
#generate_2d_bbox(dataset_name, Nb_camera, Nb_world, list_categories, occ_target) #generate_2d_bbox(dataset_name, Nb_camera, Nb_world, list_categories, occ_target)
#generate_instance_mask(dataset_name, Nb_camera, Nb_world, list_categories, occ_target) #generate_instance_mask(dataset_name, Nb_camera, Nb_world, list_categories, occ_target)
......
import shutil import shutil
import os
def reform_data(src, data_name, data_option, Nb_camera, World_begin, Nb_world):
def reform_data(src, data_name, data_option, frame, Nb_camera, World_begin, Nb_world):
for i in range(World_begin, World_begin + Nb_world): # worlds for i in range(World_begin, World_begin + Nb_world): # worlds
src_meta = f"{src}/{i}/meta.json" src_meta = f"{src}/{i}/meta.json"
dst_meta = f"{data_name}/Meta/{i}.json" dst_meta = f"{data_name}/Meta/{i}.json"
...@@ -9,38 +9,47 @@ def reform_data(src, data_name, data_option, frame, Nb_camera, World_begin, Nb_w ...@@ -9,38 +9,47 @@ def reform_data(src, data_name, data_option, frame, Nb_camera, World_begin, Nb_w
for j in range(1, Nb_camera+1): # cameras for j in range(1, Nb_camera+1): # cameras
count = ((i-1)*Nb_camera) + j count = ((i-1)*Nb_camera) + j
if data_option == "ground_truth_rgb": if data_option == "ground_truth_rgb":
src_img = f"{src}/{i}/grabber_{j}/color/image/{frame}.png" files_img = os.listdir(f"{src}/{i}/grabber_{j}/color/image/")
src_img = f"{src}/{i}/grabber_{j}/color/image/{files_img[0]}"
dst_img = f"{data_name}/RGB/{count}.png" dst_img = f"{data_name}/RGB/{count}.png"
else: else:
src_img = f"{src}/{i}/grabber_{j}/depth/image/{frame}.png" files_img = os.listdir(f"{src}/{i}/grabber_{j}/depth/image/")
src_img = f"{src}/{i}/grabber_{j}/depth/image/{files_img[0]}"
dst_img = f"{data_name}/RGB/{count}.png" dst_img = f"{data_name}/RGB/{count}.png"
shutil.copy(src_img, dst_img) shutil.copy(src_img, dst_img)
src_id = f"{src}/{i}/grabber_{j}/{data_option}/id_map/{frame}.png" files_id = os.listdir(f"{src}/{i}/grabber_{j}/{data_option}/id_map/")
src_id = f"{src}/{i}/grabber_{j}/{data_option}/id_map/{files_id[0]}"
dst_id = f"{data_name}/Instance_Segmentation/{count}.png" dst_id = f"{data_name}/Instance_Segmentation/{count}.png"
shutil.copy(src_id, dst_id) shutil.copy(src_id, dst_id)
src_semantic = f"{src}/{i}/grabber_{j}/{data_option}/semantic_map/{frame}.png" files_semantic = os.listdir(f"{src}/{i}/grabber_{j}/{data_option}/semantic_map/")
src_semantic = f"{src}/{i}/grabber_{j}/{data_option}/semantic_map/{files_semantic[0]}"
dst_semantic = f"{data_name}/Semantic_Segmentation/{count}.png" dst_semantic = f"{data_name}/Semantic_Segmentation/{count}.png"
shutil.copy(src_semantic, dst_semantic) shutil.copy(src_semantic, dst_semantic)
src_path_pose = f"{src}/{i}/grabber_{j}/{data_option}/3d_pose/{frame}.json" files_pose = os.listdir(f"{src}/{i}/grabber_{j}/{data_option}/3d_pose/")
src_path_pose = f"{src}/{i}/grabber_{j}/{data_option}/3d_pose/{files_pose[0]}"
dst_path_pose = f"{data_name}/Pose/{count}.json" dst_path_pose = f"{data_name}/Pose/{count}.json"
shutil.copy(src_path_pose, dst_path_pose) shutil.copy(src_path_pose, dst_path_pose)
src_path_occlusion = f"{src}/{i}/grabber_{j}/{data_option}/occlusion/{frame}.json" files_occlusion = os.listdir(f"{src}/{i}/grabber_{j}/{data_option}/occlusion/")
src_path_occlusion = f"{src}/{i}/grabber_{j}/{data_option}/occlusion/{files_occlusion[0]}"
dst_path_occlusion = f"{data_name}/Occlusion/{count}.json" dst_path_occlusion = f"{data_name}/Occlusion/{count}.json"
shutil.copy(src_path_occlusion, dst_path_occlusion) shutil.copy(src_path_occlusion, dst_path_occlusion)
src_depth = f"{src}/{i}/grabber_{j}/depth/depth_map/{frame}.tiff" files_depth = os.listdir(f"{src}/{i}/grabber_{j}/depth/depth_map/")
src_depth = f"{src}/{i}/grabber_{j}/depth/depth_map/{files_depth[0]}"
dst_depth = f"{data_name}/Depth/{count}.tiff" dst_depth = f"{data_name}/Depth/{count}.tiff"
shutil.copy(src_depth, dst_depth) shutil.copy(src_depth, dst_depth)
src_bbox = f"{src}/{i}/grabber_{j}/{data_option}/2d_detection/{frame}.json" files_bbox = os.listdir(f"{src}/{i}/grabber_{j}/{data_option}/2d_detection//")
src_bbox = f"{src}/{i}/grabber_{j}/{data_option}/2d_detection/{files_bbox[0]}"
dst_bbox = f"{data_name}/Bbox_2d/{count}.json" dst_bbox = f"{data_name}/Bbox_2d/{count}.json"
shutil.copy(src_bbox, dst_bbox) shutil.copy(src_bbox, dst_bbox)
src_bbox_loose = f"{src}/{i}/grabber_{j}/{data_option}/2d_detection_loose/{frame}.json" files_bbox_loose = os.listdir(f"{src}/{i}/grabber_{j}/{data_option}/2d_detection_loose/")
src_bbox_loose = f"{src}/{i}/grabber_{j}/{data_option}/2d_detection_loose/{files_bbox_loose[0]}"
dst_bbox_loose = f"{data_name}/Bbox_2d_loose/{count}.json" dst_bbox_loose = f"{data_name}/Bbox_2d_loose/{count}.json"
shutil.copy(src_bbox_loose, dst_bbox_loose) shutil.copy(src_bbox_loose, dst_bbox_loose)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment