-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathrun_testing.py
More file actions
executable file
·49 lines (41 loc) · 1.48 KB
/
Copy pathrun_testing.py
File metadata and controls
executable file
·49 lines (41 loc) · 1.48 KB
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
44
45
46
47
48
49
###################################################
#
# Script to execute the prediction
#
##################################################
import os, sys, time
import configparser
start = time.time()
config_name = None
if len(sys.argv) == 2:
config_name = sys.argv[1]
else:
print("Wrong Augment!")
exit(1)
# config file to read from
config = configparser.RawConfigParser()
config.readfp(open(r'./' + config_name))
# ===========================================
# name of the experiment!!
name_experiment = config.get('experiment name', 'name')
nohup = config.getboolean('testing settings', 'nohup') #std output on log file?
run_GPU = '' if sys.platform == 'win32' else ' THEANO_FLAGS=device=gpu,floatX=float32 '
#create a folder for the results if not existing already
result_dir = name_experiment
print("\n1. Create directory for the results (if not already existing)")
if os.path.exists(result_dir):
pass
elif sys.platform=='win32':
os.system('md ' + result_dir)
else:
os.system('mkdir -p ' + result_dir)
# finally run the prediction
if nohup:
print("\n2. Run the prediction on GPU with nohup")
os.system(run_GPU + ' nohup python -u ./src/retina_unet_predict.py ' + config_name +
' > ' + './'+name_experiment+'/'+name_experiment+'_prediction.nohup')
else:
print("\n2. Run the prediction on GPU (no nohup)")
os.system(run_GPU + ' python ./src/retina_unet_predict.py ' + config_name)
end = time.time()
print("Running time (in sed): ", end-start)