From 951551b9bfa5a2fda74a6fea3b7dcf97a67d6bdf Mon Sep 17 00:00:00 2001 From: Guillaume-Duret <guillaume.duret@ec-lyon.fr> Date: Fri, 2 Jun 2023 08:01:08 +0200 Subject: [PATCH] some flexibility --- compute_features.py | 33 +++++++++++++++------------------ main.py | 12 ++++++------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/compute_features.py b/compute_features.py index 235079d..938487c 100644 --- a/compute_features.py +++ b/compute_features.py @@ -255,24 +255,21 @@ def process_compute(data_path, full_path, camera, camera_resized, new_size, Nb_c for scenario_loop in scenarios: if not destination_folders[scenario_loop] == "dont_save" : pose = np.load(f'{full_path}/{destination_folders[scenario_loop]}/{categories}/Pose_transformed/{p}.npy') - R_exp = pose[0:3, 0:3] - tVec = pose[0:3, 3] - - fps_points = np.loadtxt(f'{full_path}/Generated/{categories}/{categories}_fps_3d.txt') - center = fps_points.mean(0) - fps_points = np.append(fps_points, [center], axis=0) - points = process2(fps_points, R_exp, tVec, camera, img, vis) - out = [int(categories_array_filtered[categories][0])] #len have to be 1 - ind = 1 - for point in points: - x = point[0][0] / img.shape[1] - y = point[0][1] / img.shape[0] - out.append(x) - out.append(y) - ind += 2 - - for scenario_loop in scenarios: - if not destination_folders[scenario_loop] == "dont_save" : + R_exp = pose[0:3, 0:3] + tVec = pose[0:3, 3] + + fps_points = np.loadtxt(f'{full_path}/Generated/{categories}/{categories}_fps_3d.txt') + center = fps_points.mean(0) + fps_points = np.append(fps_points, [center], axis=0) + points = process2(fps_points, R_exp, tVec, camera, img, vis) + out = [int(categories_array_filtered[categories][0])] #len have to be 1 + ind = 1 + for point in points: + x = point[0][0] / img.shape[1] + y = point[0][1] / img.shape[0] + out.append(x) + out.append(y) + ind += 2 np.savetxt(f'{full_path}/{destination_folders[scenario_loop]}/{categories}/FPS/{p}.txt', np.array(out).reshape(1, len(out))) points_resized = process2(fps_points, R_exp, tVec, camera_resized, img_resized, vis) diff --git a/main.py b/main.py index f85ff2b..08fee91 100644 --- a/main.py +++ b/main.py @@ -10,7 +10,7 @@ import argparse def generate_folders( dataset_path, name, list_categories, scenario): - full_name = dataset_path + name + full_name = dataset_path + '/' + name is_exist = os.path.exists(full_name) if not is_exist: os.mkdir(full_name) @@ -81,16 +81,16 @@ if __name__ == '__main__': Nb_instance = 1 occ_target = args.occlusion_target - #dataset_src = f"/gpfsscratch/rech/uli/ubn15wo/data{args.dataset_id}" - dataset_src = "/media/gduret/DATA/dataset/s2rg/Fruits_all_medium/data" + dataset_src = f"/gpfsscratch/rech/uli/ubn15wo/DATA/data{args.dataset_id}" + #dataset_src = "/media/gduret/DATA/dataset/s2rg/Fruits_all_medium/data" choice = "low" # depth of rgb resolution datas data_options = {"high": "ground_truth_rgb", "low": "ground_truth_depth"} dataset_type = data_options[choice] - #dataset_name = f"/gpfsscratch/rech/uli/ubn15wo/GUIMOD_New_{choice}_{args.dataset_id}" - dataset_path = "/home/gduret/Documents/Datasets/" - dataset_name = f"FruitsBin_{choice}_{Nb_instance}_{occ_target}" + dataset_path = f"/gpfsscratch/rech/uli/ubn15wo/FruitBin{args.dataset_id}" #GUIMOD_New_{choice}_{args.dataset_id}" + #dataset_path = f"/home/gduret/Documents/FruitBin{args.dataset_id}/" + dataset_name = f"FruitBin_{choice}_{Nb_instance}_{occ_target}" #dataset_name = f"/gpfsscratch/rech/uli/ubn15wo/dataset_new{args.dataset_id}/s2rg/Fruits_all_medium/GUIMOD_{choice}" list_categories = ["banana1", "kiwi1", "pear2", "apricot", "orange2", "peach1", "lemon2", "apple2"] Nb_camera = 15 -- GitLab