geenrate curv based on frames file

This commit is contained in:
2023-01-27 19:55:58 +00:00
parent 22f77aba6a
commit 4bc57b6067
2 changed files with 20 additions and 9 deletions
+4 -3
View File
@@ -9,10 +9,11 @@ if __name__ == '__main__':
ids = os.listdir(folder + '/mesh_posed')
count = 0
step = 15000
step = 5000
while count < len(ids):
# 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_50_train_nons_' + str(count) + '_' + str(count+step) + ' > nohup/curv_gen_50_train_nons_' + 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_50_train_' + str(count) + '_' + str(count+step) + ' > nohup/curv_gen_50_train_' + 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
+16 -6
View File
@@ -83,9 +83,9 @@ def k_neighbours(k):
pass
def calculate_dist(folder, neighbourhood):
def calculate_dist(folder, neighbourhood, frames):
out = dict()
frames = sorted(os.listdir(os.path.join(folder, 'mesh_posed')))[int(args.start):int(args.end)]
# frames = frames[int(args.start):int(args.end)]
for frame in tqdm.tqdm(frames):
id = frame.split('_')[0]
@@ -98,13 +98,13 @@ def calculate_dist(folder, neighbourhood):
return out
def generate_curvatures(folder, neighbourhood):
def generate_curvatures(folder, neighbourhood, frames):
# ids = os.listdir(folder)[int(args.start):int(args.end)]
frames = sorted(os.listdir(os.path.join(folder, 'mesh_posed')))[int(args.start):int(args.end)]
# frames = frames[int(args.start):int(args.end)]
os.makedirs(os.path.join(folder, f'mesh_curvature_raw_{neighbourhood}'), exist_ok=True)
k_neighbors_cache = calculate_dist(folder, neighbourhood)
k_neighbors_cache = calculate_dist(folder, neighbourhood, frames)
for frame in tqdm.tqdm(frames):
@@ -295,6 +295,8 @@ if __name__ == '__main__':
# k_neighbours(k=25)
folder = args.folder
frames_file = 'frames' + skirt_modifier + '_10p.txt'
nr_of_labels = 6
neighbourhood = 50
temp_file = '/home/workspace/local-data/temp/' + ''.join(random.choice(string.ascii_lowercase) for i in range(10)) + '.ply'
@@ -305,7 +307,15 @@ if __name__ == '__main__':
print('SKIRT' if is_skirt else 'NOT SKIRT')
generate_curvatures(folder, neighbourhood)
# frames = sorted(os.listdir(os.path.join(folder, 'mesh_posed')))[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)
# bins = get_bins(curvatures, nr_of_labels)
# np.save('train_bins_skirt.npy', bins)