From 6f72b5cec8ee7dea7a0b8afc2c84cb405b4ad8da Mon Sep 17 00:00:00 2001 From: "Zhai, Xiuchuan" Date: Fri, 21 Apr 2023 18:48:14 +0800 Subject: [PATCH] fix model search issue --- .../custom_evaluators/base_models.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_models.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_models.py index e98452c1b40..72adf1415e2 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_models.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_models.py @@ -165,17 +165,17 @@ def automatic_model_search(self, network_info): if model.is_dir(): is_blob = network_info.get('_model_is_blob') if is_blob: - model_list = list(model.glob('*{}.blob'.format(self.default_model_suffix))) + model_list = list(model.rglob('*{}.blob'.format(self.default_model_suffix))) if not model_list: - model_list = list(model.glob('*.blob')) + model_list = list(model.rglob('*.blob')) else: - model_list = list(model.glob('*{}*.xml'.format(self.default_model_suffix))) - blob_list = list(model.glob('*{}*.blob'.format(self.default_model_suffix))) - onnx_list = list(model.glob('*{}*.onnx'.format(self.default_model_suffix))) + model_list = list(model.rglob('*{}*.xml'.format(self.default_model_suffix))) + blob_list = list(model.rglob('*{}*.blob'.format(self.default_model_suffix))) + onnx_list = list(model.rglob('*{}*.onnx'.format(self.default_model_suffix))) if not model_list and not blob_list and not onnx_list: - model_list = list(model.glob('*.xml')) - blob_list = list(model.glob('*.blob')) - onnx_list = list(model.glob('*.onnx')) + model_list = list(model.rglob('*.xml')) + blob_list = list(model.rglob('*.blob')) + onnx_list = list(model.rglob('*.onnx')) if not model_list: model_list = blob_list if blob_list else onnx_list if not model_list: @@ -393,9 +393,9 @@ def release(self): def automatic_model_search(self, network_info): model = Path(network_info['model']) if model.is_dir(): - model_list = list(model.glob('*{}*.onnx'.format(self.default_model_suffix))) + model_list = list(model.rglob('*{}*.onnx'.format(self.default_model_suffix))) if not model_list: - model_list = list(model.glob('*.onnx')) + model_list = list(model.rglob('*.onnx')) if not model_list: raise ConfigError('Suitable model for {} not found'.format(self.default_model_suffix)) if len(model_list) > 1: @@ -472,9 +472,9 @@ def automatic_model_search(self, network_info): model = Path(network_info.get('model', '')) weights = network_info.get('weights') if model.is_dir(): - models_list = list(Path(model).glob('{}.prototxt'.format(self.default_model_name))) + models_list = list(Path(model).rglob('{}.prototxt'.format(self.default_model_name))) if not models_list: - models_list = list(Path(model).glob('*.prototxt')) + models_list = list(Path(model).rglob('*.prototxt')) if not models_list: raise ConfigError('Suitable model description is not detected') if len(models_list) != 1: @@ -484,7 +484,7 @@ def automatic_model_search(self, network_info): weights_dir = weights or model.parent weights = Path(weights_dir) / model.name.replace('prototxt', 'caffemodel') if not weights.exists(): - weights_list = list(weights_dir.glob('*.caffemodel')) + weights_list = list(weights_dir.rglob('*.caffemodel')) if not weights_list: raise ConfigError('Suitable weights is not detected') if len(weights_list) != 1: