diff --git a/python/test/test_MaskRCNN.py b/python/test/test_MaskRCNN.py index bb78b4148..adf5c8a2a 100755 --- a/python/test/test_MaskRCNN.py +++ b/python/test/test_MaskRCNN.py @@ -82,6 +82,8 @@ def __init__(self, self.mode = mode.lower() self.path_yaml = path_yaml + if not os.path.exists(self.path_default_MaskRCNN_dataset): + assert 0, "[MaskRCNN-Error] for test_MaskRCNN.py npz/pt is loaded in only one way, 1st is NNMODELS_PATH for regression,please ensure {} exists, model-zoo never use this file!".format(self.path_default_MaskRCNN_dataset) if self.path_yaml is None: self.path_yaml = self.path_default_MaskRCNN_dataset + "CONFIG_MaskRCNN.yaml" assert os.path.exists(self.path_yaml), "[MaskRCNN-Test-Error] {} yaml path is not exist! There's example at tpu-mlir/regression/dataset/MaskRCNN/CONFIG_MaskRCNN.yaml".format(self.path_yaml,) diff --git a/python/tools/tool_maskrcnn.py b/python/tools/tool_maskrcnn.py index affec2774..f6ffa2fb2 100755 --- a/python/tools/tool_maskrcnn.py +++ b/python/tools/tool_maskrcnn.py @@ -34,12 +34,14 @@ def __init__(self, debug: bool = True, path_custom_dataset: str = None): self.print_debug("[Warning] path_default_MaskRCNN_dataset is changed from default path: {} to new path: {}".format(self.path_default_MaskRCNN_dataset, path_custom_dataset)) self.path_default_MaskRCNN_dataset = path_custom_dataset if not os.path.exists(self.path_default_MaskRCNN_dataset): + if os.getenv('NNMODELS_PATH') is not None: self.path_default_MaskRCNN_dataset = os.getenv('NNMODELS_PATH') + "/maskrcnn_models/" if not os.path.exists(self.path_default_MaskRCNN_dataset): git_command = 'git --git-dir={}/.git log'.format(os.getenv('NNMODELS_PATH')) os.system(git_command) assert 0, "[MaskRCNN-Error] dataset path not found, expect {}".format(self.path_default_MaskRCNN_dataset) - + else: + print("[MaskRCNN-Warning] NNMODELS_PATH is not exist, might used for model-zoo") def print_debug(self, *info): if self.DEBUG_MASKRCNN: print(*info)