From a63a47d84e8b58dfe2c3e8e135749d005a96819a Mon Sep 17 00:00:00 2001 From: Hunor Laczko Date: Sat, 28 Jan 2023 19:12:34 +0000 Subject: [PATCH] generating more curvatures --- convert_to_uv_local_single.py | 17 +++++++++-------- curvature_label_parallel.py | 2 +- curvature_labels.py | 19 ++++++++++--------- run_parallel.py | 10 +++++----- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/convert_to_uv_local_single.py b/convert_to_uv_local_single.py index d023a4b..ea286fd 100644 --- a/convert_to_uv_local_single.py +++ b/convert_to_uv_local_single.py @@ -444,15 +444,16 @@ if __name__ == '__main__': frames_file = 'frames' + skirt_modifier + '_10p.txt' neighbourhood = 10 - frames = [] - with open(os.path.join(folder, frames_file), 'r') as f: - lines = f.readlines() - lines = [line.strip() for line in lines] - frames = lines[int(args.start):int(args.end)] + # frames = [] + # with open(os.path.join(folder, frames_file), 'r') as f: + # lines = f.readlines() + # lines = [line.strip() for line in lines] + # frames = lines[int(args.start):int(args.end)] + # ids = [frame.split('_')[0] for frame in frames] - # ids = os.listdir(os.path.join(local_folder, 'pose_shape')) - ids = [frame.split('_')[0] for frame in frames] - ids = sorted(list(set(ids)))#[int(args.start):int(args.end)] + ids = os.listdir(os.path.join(local_folder, 'pose_shape')) + ids = [id.split('_')[0] for id in ids] + ids = sorted(list(set(ids)))[int(args.start):int(args.end)] for id in tqdm.tqdm(ids): diff --git a/curvature_label_parallel.py b/curvature_label_parallel.py index b1da0a5..3baa8d9 100644 --- a/curvature_label_parallel.py +++ b/curvature_label_parallel.py @@ -14,6 +14,6 @@ if __name__ == '__main__': while count < len(ids): # while count < 30000: # os.system('nohup python MeshUtils/curvature_labels.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'curv_train_' + str(count) + '_' + str(count+step) + ' > curv_train_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') - os.system('nohup python curvature_labels.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'curv_gen_10_test_skirt_' + str(count) + '_' + str(count+step) + ' > nohup/curv_gen_10_test_skirt_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') + os.system('nohup python curvature_labels.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'curv_gen_10_label_test_skirt_' + str(count) + '_' + str(count+step) + ' > nohup/curv_gen_10_label_test_skirt_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') # os.system('python Data/convert_to_uv.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + '') count += step diff --git a/curvature_labels.py b/curvature_labels.py index 7b4b58d..3f7e534 100644 --- a/curvature_labels.py +++ b/curvature_labels.py @@ -251,9 +251,9 @@ def read_raw_curvatures(folder, frames, neighbourhood): if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument("-f", "--folder", help = "process the given folder", default=r'/home/workspace/data/dataset/test_skirt_ready_2') + parser.add_argument("-f", "--folder", help = "process the given folder", default=r'/home/workspace/data/dataset/local-cache/train_skirt') parser.add_argument("-s", "--start", help = "start of range", default=5000) - parser.add_argument("-e", "--end", help = "end of range", default=10000) + parser.add_argument("-e", "--end", help = "end of range", default=15000) parser.add_argument("-n", "--name", help = "end of range", default="lhunor") args = parser.parse_args() @@ -266,7 +266,7 @@ if __name__ == '__main__': frames_file = 'frames' + skirt_modifier + '_10p.txt' nr_of_labels = 6 - neighbourhood = 10 + neighbourhood = 100 temp_file = '/home/workspace/local-data/temp/' + ''.join(random.choice(string.ascii_lowercase) for i in range(10)) + '.ply' if not is_skirt: dist = np.load('custom_data/dijkstra.npy') @@ -275,13 +275,14 @@ if __name__ == '__main__': print('SKIRT' if is_skirt else 'NOT SKIRT') - frames = sorted(os.listdir(os.path.join(folder, 'mesh_posed')))[int(args.start):int(args.end)] + # frames = sorted(os.listdir(os.path.join(folder, 'mesh_posed')))[int(args.start):int(args.end)] + # frames = [frame.split('.')[0] for frame in frames] - # frames = [] - # with open(os.path.join(folder, frames_file), 'r') as f: - # lines = f.readlines() - # lines = [line.strip() for line in lines] - # frames = lines[int(args.start):int(args.end)] + frames = [] + with open(os.path.join(folder, frames_file), 'r') as f: + lines = f.readlines() + lines = [line.strip() for line in lines] + frames = lines[int(args.start):int(args.end)] generate_curvatures(folder, neighbourhood, frames) # curvatures = read_raw_curvatures(folder, frames, neighbourhood) diff --git a/run_parallel.py b/run_parallel.py index 2828f49..428b431 100644 --- a/run_parallel.py +++ b/run_parallel.py @@ -4,24 +4,24 @@ import os if __name__ == '__main__': - folder = '/home/workspace/data/dataset/local-cache/train_skirt' + folder = '/home/workspace/data/dataset/test_skirt_ready_2' # folder = '/home/workspace/local-data/cape_processed/train/male' # folder = '/home/workspace/local-data/valid_skirt' # folder = '/home/workspace/local-data/valid' # ids = os.listdir(folder) - ids = os.listdir(folder + '/mesh_posed_no_orient')#[280000:] + # ids = os.listdir(folder + '/mesh_posed_no_orient')#[280000:] skirt = 0 count = 0 - step = 5000 + step = 25 # !!!!!!! change skirt parameter in script - while count < 30000: + while count < 200: # os.system('nohup python convert_to_uv_cape.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_2_cape_train_male_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_2_cape_train_male_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') # os.system('nohup python convert_to_uv.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_train_unposed_onehot_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_train_unposed_onehot_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') # os.system('nohup python convert_to_uv_local.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_train_local_unposed_onehot_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_train_local_unposed_onehot_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') - os.system('nohup python convert_to_uv_local_single.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_curv_10_train_skirt_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_curv_10_train_skirt_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') + os.system('nohup python convert_to_uv_local_single.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_curv_10_test_skirt_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_curv_10_test_skirt_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') # os.system('nohup python convert_to_uv_local_single.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_train_skirt_local_unposed_onehot_3_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_train_skirt_local_unposed_onehot_3_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') # os.system('nohup python convert_to_uv_local_single.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'to_uv_valid_skirt_local_unposed_onehot_3_' + str(count) + '_' + str(count+step) + ' > nohup/to_uv_valid_skirt_local_unposed_onehot_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &') # os.system('nohup python downscale.py -f ' + folder + ' -s ' + str(count) + ' -e ' + str(count + step) + ' -n ' + 'downscale_valid_posed_no_orient_' + str(count) + '_' + str(count+step) + ' > nohup/downscale_valid_posed_no_orient_' + str(count) + '_' + str(count+step) + '.out' + ' 2>&1 &')