update reg test (#1440)

* give model path if stead of 'x' when conversion failed

* set --models with default value ['all']

* fix mmseg yml
pull/1447/head
RunningLeon 2022-11-25 21:16:22 +08:00 committed by GitHub
parent 0d16f6ec30
commit 10e5cf6e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 23 deletions

View File

@ -194,7 +194,6 @@ models:
- *pipeline_trt_dynamic_fp16
- *pipeline_ncnn_static_fp32
- *pipeline_pplnn_dynamic_fp32
- *pipeline_openvino_dynamic_fp32
- name: ANN
metafile: configs/ann/ann.yml
@ -379,4 +378,3 @@ models:
- *pipeline_trt_static_fp32_512x512
- *pipeline_openvino_static_fp32_512x512
- *pipeline_ncnn_static_fp32
- *pipeline_ts_fp32

View File

@ -36,7 +36,8 @@ def parse_args():
help='test performance if it set')
parser.add_argument(
'--backends', nargs='+', help='test specific backend(s)')
parser.add_argument('--models', nargs='+', help='test specific model(s)')
parser.add_argument(
'--models', nargs='+', default=['all'], help='test specific model(s)')
parser.add_argument(
'--work-dir',
type=str,
@ -230,20 +231,16 @@ def update_report(report_dict: dict, model_name: str, model_config: str,
checkpoint = str(checkpoint).split(f'/{codebase_name}/')[-1]
checkpoint = '${CHECKPOINT_DIR}' + f'/{codebase_name}/{checkpoint}'
else:
if Path(checkpoint).exists():
# To invoice the path which is 'A.a B.b' when test sdk.
checkpoint = Path(checkpoint).absolute().resolve()
elif backend_name == 'ncnn':
# ncnn have 2 backend file but only need xxx.param
checkpoint = checkpoint.split('.param')[0] + '.param'
parent_dir, filename = os.path.split(checkpoint)
parent_dir = os.path.abspath(parent_dir)
work_dir = report_txt_path.parent.absolute().resolve()
checkpoint = str(checkpoint).replace(str(work_dir), '${WORK_DIR}')
parent_dir = parent_dir.replace(str(work_dir), '${WORK_DIR}')
checkpoint = os.path.join(parent_dir, filename)
# save to tmp file
tmp_str = f'{model_name},{model_config},{task_name},{checkpoint},' \
f'{dataset},{backend_name},{deploy_config},' \
f'{static_or_dynamic},{precision_type},{conversion_result},' \
f'{fps},'
f'{static_or_dynamic},{precision_type},{conversion_result},'
# save to report
report_dict.get('Model').append(model_name)
@ -725,12 +722,14 @@ def get_backend_result(pipeline_info: dict, model_cfg_path: Path,
logger.info(f'Got convert_result = {convert_result}')
if isinstance(backend_file_name, list):
report_checkpoint = backend_output_path.joinpath(backend_file_name[0])
convert_checkpoint_path = ''
for backend_file in backend_file_name:
backend_path = backend_output_path.joinpath(backend_file)
backend_path = str(backend_path.absolute().resolve())
convert_checkpoint_path += f'{str(backend_path)} '
else:
report_checkpoint = backend_output_path.joinpath(backend_file_name)
convert_checkpoint_path = \
str(backend_output_path.joinpath(backend_file_name))
@ -787,10 +786,6 @@ def get_backend_result(pipeline_info: dict, model_cfg_path: Path,
metric_list = [{metric: '-'} for metric in metric_info]
fps = '-'
test_pass = convert_result
if convert_result:
report_checkpoint = convert_checkpoint_path
else:
report_checkpoint = 'x'
dataset_type = metafile_dataset['dataset']
task_name = metafile_dataset['task']
# update the report
@ -799,7 +794,7 @@ def get_backend_result(pipeline_info: dict, model_cfg_path: Path,
model_name=model_name,
model_config=str(model_cfg_path),
task_name=task_name,
checkpoint=report_checkpoint,
checkpoint=str(report_checkpoint),
dataset=dataset_type,
backend_name=backend_name,
deploy_config=str(deploy_cfg_path),
@ -873,10 +868,7 @@ def main():
assert isinstance(backend_list, list)
logger.info(f'Regression test backend list = {backend_list}')
if args.models is None:
logger.info('Regression test for all models in test yaml.')
else:
args.models = tuple([_filter_string(s) for s in args.models])
args.models = [_filter_string(s) for s in args.models]
logger.info(f'Regression test models list = {args.models}')
assert ' ' not in args.work_dir, \
@ -944,7 +936,7 @@ def main():
f'skipping {model_name_origin}...')
continue
if args.models is not None and model_name_new not in args.models:
if args.models != ['all'] and model_name_new not in args.models:
logger.info(
f'Test specific model mode, skip {model_name_origin}...')
continue