imlab.classifier.Classifier

class imlab.classifier.Classifier(weight: ~typing.Optional[str] = None, model_type: str = 'MobileNetV2', image_size: int = 300, model: ~typing.Optional[object] = None, preprocess: callable = <function preprocess>, decode: callable = <function decode>, num_class: int = 0)[source]

Bases: Wrapper

Classifier.

__init__(weight: ~typing.Optional[str] = None, model_type: str = 'MobileNetV2', image_size: int = 300, model: ~typing.Optional[object] = None, preprocess: callable = <function preprocess>, decode: callable = <function decode>, num_class: int = 0)[source]

__init__.

Parameters
  • weight (str) –

  • model_type (str) –

  • image_size (int) –

  • model (object) –

  • preprocess (callable) –

  • decode (callable) –

  • num_class (int) –

Methods

__init__([weight, model_type, image_size, ...])

__init__.

dump(file_handler)

dump.

norm_input(image)

norm_input.

predict(image[, num])

predict.

dump(file_handler) None[source]

dump.

Parameters

file_handler

Return type

None

norm_input(image: object) ndarray

norm_input. normalize input

Parameters

image (object) –

Return type

np.ndarray

predict(image: object, num: int = 1) -> (<class 'str'>, <class 'float'>)[source]

predict. predict image classe

Parameters
  • image (object) –

  • num (int) – number of result, if num==0, return a generator

Return type

(str, float)