Skip to content

Commit

Permalink
[python] distinguish data path model-zoo from regression
Browse files Browse the repository at this point in the history
Change-Id: I98fa0df1524f0b38d91cda02ab5d49876f7caee8
(cherry picked from commit fa082d0)
  • Loading branch information
seriphdog authored and charlesxzb committed Sep 26, 2024
1 parent 975c7f2 commit 029d83a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/test/test_MaskRCNN.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down
4 changes: 3 additions & 1 deletion python/tools/tool_maskrcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 029d83a

Please sign in to comment.