From 42e78ab2512e8211a035603191a8239298cc1c24 Mon Sep 17 00:00:00 2001 From: Max Frei <36265931+maxfrei750@users.noreply.github.com> Date: Fri, 21 Sep 2018 04:41:38 +0200 Subject: [PATCH] Added automated epoch recognition for Windows. (#798) Unified regex expression for both, Linux and Windows. --- mrcnn/model.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mrcnn/model.py b/mrcnn/model.py index f58e2a6..ba557af 100644 --- a/mrcnn/model.py +++ b/mrcnn/model.py @@ -2259,8 +2259,11 @@ class MaskRCNN(): if model_path: # Continue from we left of. Get epoch and date from the file name # A sample model path might look like: - # /path/to/logs/coco20171029T2315/mask_rcnn_coco_0001.h5 - regex = r".*/[\w-]+(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})/mask\_rcnn\_[\w-]+(\d{4})\.h5" + # \path\to\logs\coco20171029T2315\mask_rcnn_coco_0001.h5 (Windows) + # /path/to/logs/coco20171029T2315/mask_rcnn_coco_0001.h5 (Linux) + + regex = r".*[/\\][\w-]+(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})[/\\]mask\_rcnn\_[\w-]+(\d{4})\.h5" + m = re.match(regex, model_path) if m: now = datetime.datetime(int(m.group(1)), int(m.group(2)), int(m.group(3)), -- GitLab