Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import subprocess
import time
import os
# Start measuring script execution time
start_time = time.time()
# --------------------------------------------------------------------------
current_file_directory = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(current_file_directory, "data")
# weights_file = "model_weights_exp_synth_class_unet_6.h5"
# weights_file = "model_weights_exp_synth_class_unet_crpr_2.h5"
# weights_file = "model_weights_exp_synth_class_unet_pores_2.h5"
# weights_file = "model_weights_exp_synth_real_mix_class_unet_6.h5"
weights_file = "model_weights_exp_synth_real_mix_class_unet_crpr_2.h5"
# weights_file = "model_weights_exp_synth_real_mix_class_unet_pores_2.h5"
synth_images_path = os.path.join(data_dir, "synth_data/synth_images")
# synth_masks_path = os.path.join(data_dir, "synth_data/synth_masks")
synth_masks_path = os.path.join(data_dir, "synth_data/synth_masks_crpr")
# synth_masks_path = os.path.join(data_dir, "synth_data/synth_masks_pores")
real_images_path = os.path.join(data_dir, "real_data/real_images")
# real_masks_path = os.path.join(data_dir, "real_data/real_masks")
real_masks_path = os.path.join(data_dir, "real_data/real_masks_crpr")
# real_masks_path = os.path.join(data_dir, "real_data/real_masks_pores")
load_synth_data = True
load_real_data = True
# --------------------------------------------------------------------------
experiment_name = weights_file.replace("model_weights_", "").replace(".h5", "")
# Use subprocess to run the test.py script
script_path = "scripts/train.py"
subprocess.run(["python", script_path, "--synth_images_path", synth_images_path, "--synth_masks_path", synth_masks_path, "--real_images_path", real_images_path, "--real_masks_path", real_masks_path, "--experiment_name", experiment_name, "--load_synth_data", str(load_synth_data), "--load_real_data", str(load_real_data)])
# Calculate and print the total time taken
end_time = time.time()
execution_time = end_time - start_time
minutes = int(execution_time / 60)
seconds = int(execution_time % 60)
print(f"Total time taken: {minutes} minutes and {seconds} seconds")
# --------------------------------------------------------------------------