# `TFLiteElixir.ObjectDetection`
[🔗](https://github.com/cocoa-xu/tflite_elixir/blob/main/lib/tflite_elixir/high-level-api/detect_image.ex#L1)

Experimental object detection module.

# `detection`

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

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `predict`

```elixir
@spec predict(
  pid(),
  binary()
  | %StbImage{data: term(), shape: term(), type: term()}
  | %Nx.Tensor{
      data: term(),
      donatable?: 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.

# `set_label`

```elixir
@spec set_label(pid(), String.t() | [String.t()]) :: :ok
```

Give the detector its labels, either as a list or as the path to a file
holding one label per line.

# `start`

```elixir
@spec start(any(), any()) :: :ignore | {:error, any()} | {:ok, pid()}
```

Start a detector for `model`, a path to a `.tflite` file or its contents.

Options, all optional: `:threshold` (0.4) the score below which a detection is
dropped, `:labels` (nil) a list of labels or the path to a file holding one per
line, `:jobs` (`System.schedulers_online/0`) the interpreter's thread count,
`:use_tpu` (false) and `:tpu` ("") to run on a named Edge TPU.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
