[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-05-08 UTC."],[],[],null,["# tflite_support.task.vision.ImageSegmenter\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [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) |\n\nClass that performs segmentation on images. \n\n tflite_support.task.vision.ImageSegmenter(\n options: ../../../tflite_support/task/vision/ImageSegmenterOptions,\n segmenter: _CppImageSegmenter\n ) -\u003e None\n\nMethods\n-------\n\n### `create_from_file`\n\n[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/image_segmenter.py#L55-L70) \n\n @classmethod\n create_from_file(\n file_path: str\n ) -\u003e 'ImageSegmenter'\n\nCreates the `ImageSegmenter` object from a TensorFlow Lite model.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------|--------------------|\n| `file_path` | Path to the model. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `ImageSegmenter` object that's created from `options`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|----------------|------------------------------------------------------------------------------------------|\n| `ValueError` | If failed to create `ImageSegmenter` object from the provided file such as invalid file. |\n| `RuntimeError` | If other types of error occurred. |\n\n\u003cbr /\u003e\n\n### `create_from_options`\n\n[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/image_segmenter.py#L72-L88) \n\n @classmethod\n create_from_options(\n options: ../../../tflite_support/task/vision/ImageSegmenterOptions\n ) -\u003e 'ImageSegmenter'\n\nCreates the `ImageSegmenter` object from image segmenter options.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------|---------------------------------------|\n| `options` | Options for the image segmenter task. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `ImageSegmenter` object that's created from `options`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|----------------|-----------------------------------------------------------------------------------------------------|\n| `ValueError` | If failed to create `ImageSegmenter` object from `ImageSegmenterOptions` such as missing the model. |\n| `RuntimeError` | If other types of error occurred. |\n\n\u003cbr /\u003e\n\n### `segment`\n\n[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/vision/image_segmenter.py#L90-L107) \n\n segment(\n image: ../../../tflite_support/task/vision/TensorImage\n ) -\u003e ../../../tflite_support/task/processor/SegmentationResult\n\nPerforms segmentation on the provided TensorImage.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|---------|----------------------------------------------------|\n| `image` | Tensor image, used to extract the feature vectors. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| segmentation result. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|----------------|-------------------------------------------|\n| `ValueError` | If any of the input arguments is invalid. |\n| `RuntimeError` | If failed to run segmentation. |\n\n\u003cbr /\u003e"]]