Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AC]: fix model search issue #3750

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down