(cfg, model, eval_mode)
| 77 | |
| 78 | |
| 79 | def quantize_eval(cfg, model, eval_mode): |
| 80 | for eval_pipe in cfg.eval_pipelines: |
| 81 | eval_data = eval_pipe.data |
| 82 | # build the dataloader |
| 83 | imgs_per_gpu = eval_data.pop('imgs_per_gpu', cfg.data.imgs_per_gpu) |
| 84 | |
| 85 | dataset = build_dataset(eval_data) |
| 86 | data_loader = build_dataloader( |
| 87 | dataset, |
| 88 | imgs_per_gpu=imgs_per_gpu, |
| 89 | workers_per_gpu=cfg.data.workers_per_gpu, |
| 90 | dist=False, |
| 91 | shuffle=False) |
| 92 | |
| 93 | if eval_mode == 'cuda': |
| 94 | outputs = single_gpu_test(model, data_loader, mode=eval_pipe.mode) |
| 95 | elif eval_mode == 'cpu': |
| 96 | outputs = single_cpu_test(model, data_loader, mode=eval_pipe.mode) |
| 97 | |
| 98 | rank, _ = get_dist_info() |
| 99 | if rank == 0: |
| 100 | for t in eval_pipe.evaluators: |
| 101 | if 'metric_type' in t: |
| 102 | t.pop('metric_type') |
| 103 | evaluators = build_evaluator(eval_pipe.evaluators) |
| 104 | eval_result = dataset.evaluate(outputs, evaluators=evaluators) |
| 105 | print(f'\n eval_result {eval_result}') |
| 106 | |
| 107 | |
| 108 | def main(): |
no test coverage detected