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

[Fix] set default topk for dump info #702

Merged
merged 6 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
13 changes: 9 additions & 4 deletions mmdeploy/codebase/mmcls/deploy/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import mmcv
import numpy as np
import torch
from importlib_metadata import warnings
hanrui1sensetime marked this conversation as resolved.
Show resolved Hide resolved
hanrui1sensetime marked this conversation as resolved.
Show resolved Hide resolved
hanrui1sensetime marked this conversation as resolved.
Show resolved Hide resolved
from torch.utils.data import Dataset

from mmdeploy.codebase.base import BaseTask
Expand Down Expand Up @@ -233,8 +234,6 @@ def evaluate_outputs(model_cfg: mmcv.Config,
log_file (str | None): The file to write the evaluation results.
Defaults to `None` and the results will only print on stdout.
"""
import warnings

from mmcv.utils import get_logger
logger = get_logger('test', log_file=log_file, log_level=logging.INFO)

Expand Down Expand Up @@ -281,8 +280,14 @@ def get_postprocess(self) -> Dict:
dict: Composed of the postprocess information.
"""
postprocess = self.model_cfg.model.head
assert 'topk' in postprocess, 'model config lack topk'
postprocess.topk = max(postprocess.topk)
if 'topk' not in postprocess:
topk = (1, )
logger = get_root_logger()
logger.warning('no topk in postprocess config, using default \
topk value.')
else:
topk = postprocess.topk
postprocess.topk = max(topk)
return postprocess

def get_model_name(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mmcls>=0.21.0,<=0.22.1
mmcls>=0.23.0
hanrui1sensetime marked this conversation as resolved.
Show resolved Hide resolved
mmdet>=2.19.0,<=2.20.0
mmedit
mmocr>=0.3.0,<=0.4.1
Expand Down
12 changes: 12 additions & 0 deletions tests/regression/mmcls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ models:
- *pipeline_pplnn_dynamic_fp32
- *pipeline_openvino_dynamic_fp32

- name: DenseNet
metafile: configs/densenet/metafile.yml
model_configs:
- configs/densenet/densenet121_4xb256_in1k.py
pipelines:
- *pipeline_ts_fp32
- *pipeline_ort_dynamic_fp32
- *pipeline_trt_dynamic_fp16
- *pipeline_ncnn_static_fp32
- *pipeline_pplnn_dynamic_fp32
- *pipeline_openvino_dynamic_fp32

- name: SE-ResNet
metafile: configs/seresnet/metafile.yml
model_configs:
Expand Down