Skip to content

Commit 8e387a7

Browse files
committed
update train.py and predict.py
Confirm that the configuration file exists
1 parent cae464b commit 8e387a7

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

pymic/net_run/agent_cls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ def infer(self):
327327

328328
if(self.config['testing'].get('evaluation_mode', True)):
329329
self.net.eval()
330-
331-
output_csv = self.config['testing']['output_csv']
330+
331+
output_csv = self.config['testing']['output_dir'] + '/' + self.config['testing']['output_csv']
332332
class_num = self.config['network']['class_num']
333333
save_probability = self.config['testing'].get('save_probability', False)
334334

pymic/net_run/predict.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def main():
1717
print(' pymic_test config.cfg')
1818
exit()
1919
cfg_file = str(sys.argv[1])
20+
if(not os.path.isfile(cfg_file)):
21+
raise ValueError("The config file does not exist: " + cfg_file)
2022
config = parse_config(cfg_file)
2123
config = synchronize_config(config)
2224
log_dir = config['testing']['output_dir']

pymic/net_run/train.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def main():
6868
print(' pymic_train config.cfg')
6969
exit()
7070
cfg_file = str(sys.argv[1])
71+
if(not os.path.isfile(cfg_file)):
72+
raise ValueError("The config file does not exist: " + cfg_file)
7173
config = parse_config(cfg_file)
7274
config = synchronize_config(config)
7375
log_dir = config['training']['ckpt_save_dir']

0 commit comments

Comments
 (0)