Commit 0fc880b7 authored by Patrick Wieschollek's avatar Patrick Wieschollek Committed by Yuxin Wu

minsaver bugfix (#265)

parent ca16fb7e
...@@ -116,6 +116,7 @@ def get_config(): ...@@ -116,6 +116,7 @@ def get_config():
dataflow=dataset_train, # the DataFlow instance for training dataflow=dataset_train, # the DataFlow instance for training
callbacks=[ callbacks=[
ModelSaver(), # save the model after every epoch ModelSaver(), # save the model after every epoch
MaxSaver('validation_accuracy'), # save the model with highest accuracy (prefix 'validation_')
InferenceRunner( # run inference(for validation) after every epoch InferenceRunner( # run inference(for validation) after every epoch
dataset_test, # the DataFlow instance used for validation dataset_test, # the DataFlow instance used for validation
# Calculate both the cost and the error for this DataFlow # Calculate both the cost and the error for this DataFlow
......
...@@ -126,7 +126,7 @@ class MinSaver(Callback): ...@@ -126,7 +126,7 @@ class MinSaver(Callback):
newname = os.path.join(logger.LOG_DIR, newname = os.path.join(logger.LOG_DIR,
self.filename or self.filename or
('max-' if self.reverse else 'min-' + self.monitor_stat)) ('max-' + self.monitor_stat if self.reverse else 'min-' + self.monitor_stat))
files_to_copy = glob.glob(path + '*') files_to_copy = glob.glob(path + '*')
for file_to_copy in files_to_copy: for file_to_copy in files_to_copy:
shutil.copy(file_to_copy, file_to_copy.replace(path, newname)) shutil.copy(file_to_copy, file_to_copy.replace(path, newname))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment