<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/image_segmenter.py#L45-L107) |

Class that performs segmentation on images.

    tflite_support.task.vision.ImageSegmenter(
        options: https://developers.google.com/edge/api/tflite/python/tflite_support/task/vision/ImageSegmenterOptions,
        segmenter: _CppImageSegmenter
    ) -> None

## Methods

### `create_from_file`

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

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

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

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If failed to create `ImageSegmenter` 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/image_segmenter.py#L72-L88)

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

Creates the `ImageSegmenter` object from image segmenter options.

<br />

<br />

<br />

| Args ||
|---|---|
| `options` | Options for the image segmenter task. |

<br />

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

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

<br />

### `segment`

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

    segment(
        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/SegmentationResult

Performs segmentation on the provided TensorImage.

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| segmentation result. ||

<br />

<br />

<br />

<br />

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

<br />