Skip to content

Commit d0c52d7

Browse files
julienrwaleedka
authored andcommitted
Allow dashes in model name.
Print a message when re-starting from saved epoch
1 parent e0d1539 commit d0c52d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mrcnn/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,14 +2222,15 @@ def set_log_dir(self, model_path=None):
22222222
# Continue from we left of. Get epoch and date from the file name
22232223
# A sample model path might look like:
22242224
# /path/to/logs/coco20171029T2315/mask_rcnn_coco_0001.h5
2225-
regex = r".*/\w+(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})/mask\_rcnn\_\w+(\d{4})\.h5"
2225+
regex = r".*/[\w-]+(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})/mask\_rcnn\_[\w-]+(\d{4})\.h5"
22262226
m = re.match(regex, model_path)
22272227
if m:
22282228
now = datetime.datetime(int(m.group(1)), int(m.group(2)), int(m.group(3)),
22292229
int(m.group(4)), int(m.group(5)))
22302230
# Epoch number in file is 1-based, and in Keras code it's 0-based.
22312231
# So, adjust for that then increment by one to start from the next epoch
22322232
self.epoch = int(m.group(6)) - 1 + 1
2233+
print('Re-starting from epoch %d' % self.epoch)
22332234

22342235
# Directory for training logs
22352236
self.log_dir = os.path.join(self.model_dir, "{}{:%Y%m%dT%H%M}".format(

0 commit comments

Comments
 (0)