View Source Evision.Zoo.ImageClassification.MobileNetV1 (Evision v0.2.9)

MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications

Summary

Functions

Default configuration.

Docs in smart cell.

Initialize model.

Default label file URL and filename.

Model URL and filename of predefined model.

Preprocessing the input image.

Customizable parameters from smart cell.

Smart cell tasks.

Generate quoted code from smart cell attrs.

Functions

@spec default_config() :: map()

Default configuration.

@spec docs() :: String.t()

Docs in smart cell.

@spec get_labels(Keyword.t()) :: [binary()]

Get labels.

Keyword arguments
  • labels_path: String.t().

    Path to the label file. Defaults to nil.

    When labels_path is nil, get_labels/1 will try to download the default label file.

  • cache_dir: String.t().

    Path to the cache directory.

    Optional. Defaults to :filename.basedir(:user_cache, "", ...)

Returns

A list of labels.

Link to this function

infer(self, image, opts \\ [])

View Source

Inference.

Positional arguments
  • self: Evision.DNN.Net.t().

    An initialized MobileNetV1 model.

  • image: Evision.Mat.maybe_mat_in().

    Input image.

Keyword arguments
  • top_k: pos_integer().

    Get top k results.

    Optional. Defaults to 5.

Link to this function

init(model_path, opts \\ [])

View Source
@spec init(binary() | :default_model | :quant_model, nil | Keyword.t()) ::
  {:error, String.t()} | Evision.DNN.Net.t()

Initialize model.

Positional arguments
  • model: String.t() | :default_model | :quant_model.

    • When model is a string, it will be treat as the path to a weight file and init/2 will load the model from it.

    • When model is either :default_model or :quant_model, init/2 will download and load the predefined model.

Keyword arguments
  • cache_dir: String.t().

    Path to the cache directory.

    Optional. Defaults to :filename.basedir(:user_cache, "", ...)

  • backend: integer().

    Specify the backend.

    Optional. Defaults to Evision.Constant.cv_DNN_BACKEND_OPENCV().

  • target: integer().

    Specify the target.

    Optional. Defaults to Evision.Constant.cv_DNN_TARGET_CPU().

@spec labels() :: {String.t(), String.t()}

Default label file URL and filename.

@spec model_info(:default_model | :quant_model) :: {String.t(), String.t()}

Model URL and filename of predefined model.

@spec preprocess(Evision.Mat.maybe_mat_in()) :: Evision.Mat.t()

Preprocessing the input image.

infer/3 will call this function automatically.

Positional arguments
  • image: Evision.Mat.maybe_mat_in().

    Input image.

@spec smartcell_params() :: Evision.Zoo.smartcell_params()

Customizable parameters from smart cell.

@spec smartcell_tasks() :: Evision.Zoo.smartcell_tasks()

Smart cell tasks.

A list of variants of the current model.

@spec to_quoted(map()) :: list()

Generate quoted code from smart cell attrs.