mmpretrain.apis.inference_model¶
- mmpretrain.apis.inference_model(model, *args, **kwargs)[source]¶
Inference an image with the inferencer.
Automatically select inferencer to inference according to the type of model. It’s a shortcut for a quick start, and for advanced usage, please use the correspondding inferencer class.
Here is the mapping from task to inferencer:
Image Classification:
ImageClassificationInferencer
Image Retrieval:
ImageRetrievalInferencer
Image Caption:
ImageCaptionInferencer
Visual Question Answering:
VisualQuestionAnsweringInferencer
Visual Grounding:
VisualGroundingInferencer
Text-To-Image Retrieval:
TextToImageRetrievalInferencer
Image-To-Text Retrieval:
ImageToTextRetrievalInferencer
NLVR:
NLVRInferencer
- Parameters:
model (BaseModel | str | Config) – The loaded model, the model name or the config of the model.
*args – Positional arguments to call the inferencer.
**kwargs – Other keyword arguments to initialize and call the correspondding inferencer.
- Returns:
The inference results.
- Return type:
result (dict)