Shortcuts

mmcls.apis.inference_model

mmcls.apis.inference_model(model, img, device=None)[源代码]

Inference an image with the classifier.

参数
  • model (BaseModel | str | Config) – The loaded classifier or the model name or the config of the model.

  • img (str | ndarray) – The image filename or loaded image.

  • device (str, optional) – Device to run inference. If None, use CPU or the device of the input model. Defaults to None.

返回

The classification results that contains:

  • pred_scores: The classification scores of all categories.

  • pred_class: The predicted category.

  • pred_label: The predicted index of the category.

  • pred_score: The score of the predicted category.

返回类型

result (dict)

备注

This function is reserved for compatibility and demo on a single image. We suggest to use ImageClassificationInferencer, which is more powerful and configurable.

Read the Docs v: mmcls-1.x
Versions
latest
stable
mmcls-1.x
mmcls-0.x
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.