<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/object_detector.py#L45-L110) |

Class that performs object detection on images.

    tflite_support.task.vision.ObjectDetector(
        options: https://developers.google.com/edge/api/tflite/python/tflite_support/task/vision/ObjectDetectorOptions,
        detector: _CppObjectDetector
    ) -> None

## Methods

### `create_from_file`

[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/object_detector.py#L55-L72)

    @classmethod
    create_from_file(
        file_path: str
    ) -> 'ObjectDetector'

Creates the `ObjectDetector` object from a TensorFlow Lite model.

<br />

<br />

<br />

| Args ||
|---|---|
| `file_path` | Path to the model. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `ObjectDetector` object that's created from the model file. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | if failed to create `ObjectDetector` object from the provided file such as invalid file. |
| `RuntimeError` | If other types of error occurred. |

<br />

### `create_from_options`

[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/object_detector.py#L74-L92)

    @classmethod
    create_from_options(
        options: https://developers.google.com/edge/api/tflite/python/tflite_support/task/vision/ObjectDetectorOptions
    ) -> 'ObjectDetector'

Creates the `ObjectDetector` object from object detector options.

<br />

<br />

<br />

| Args ||
|---|---|
| `options` | Options for the object detector task. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `ObjectDetector` object that's created from `options`. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If failed to create `ObjectDetector` object from `ObjectDetectorOptions` such as missing the model. |
| `RuntimeError` | If other types of error occurred. |

<br />

### `detect`

[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/object_detector.py#L94-L110)

    detect(
        image: https://developers.google.com/edge/api/tflite/python/tflite_support/task/vision/TensorImage
    ) -> https://developers.google.com/edge/api/tflite/python/tflite_support/task/processor/DetectionResult

Performs object detection on the provided TensorImage.

<br />

<br />

<br />

| Args ||
|---|---|
| `image` | Tensor image, used to extract the feature vectors. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| detection result. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If any of the input arguments is invalid. |
| `RuntimeError` | If object detection failed to run. |

<br />