View Source TFLiteElixir.ObjectDetection (tflite_elixir v1.0.0-rc2)

Experimental object detection module.

Summary

Functions

Returns a specification to start this module under a supervisor.

Run the model against an image.

Types

@type detection() :: %{
  class_id: integer(),
  score: float(),
  label: String.t() | nil,
  bbox: [integer()]
}

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

predict(pid, input_path, opts \\ [])

View Source
@spec predict(
  pid(),
  binary()
  | %StbImage{data: term(), shape: term(), type: term()}
  | %Nx.Tensor{
      data: term(),
      names: term(),
      shape: term(),
      type: term(),
      vectorized_axes: term()
    },
  Keyword.t()
) :: [detection()]

Run the model against an image.

Options

  • :timeout - how long to wait for the answer, in milliseconds, or :infinity. Defaults to 30000. Raise it for a large model or a slow board; inference is local and bounded, so waiting is the right answer more often than giving up.
Link to this function

set_label(pid, label_file)

View Source
@spec set_label(pid(), String.t() | [String.t()]) :: :ok
Link to this function

start(model, opts \\ [])

View Source
@spec start(any(), any()) :: :ignore | {:error, any()} | {:ok, pid()}