[Alpha] Text-Guided Segmentation
Last updated
Last updated
Warning: Text-Guided Segmentation is available as an alpha feature.
This means that the feature (or parts of it) might be deprecated with two week warning.
Text-Guided Segmentation allows you to have more control over which parts of the input image should be kept by the segmentation mode and which parts should be removed.
Text-Guided segmentation is controlled through 3 parameters:
segmentation.prompt
: A textual description of what the segmentation should keep. (required, comma separated values are allowed, use singular rather than plural)
segmentation.negativePrompt
: A textual description of what the segmentation should remove. (optional, comma separated values are allowed, use singular rather than plural)
segmentation.keepSalientObject
: When set to true
, the salient object of the image (i.e. what the default segmentation would have kept) will also be kept by the segmentation. (optional)
For the arguments segmentation.prompt
and segmentation.negativePrompt
, please use the singular rather than the plural. (e.g. laptop
rather than laptops
)
If you want the segmentation to keep a person, we recommend setting segmentation.keepSalientObject=true
rather than
segmentation.prompt=person
. (the reason why is that the prompt
is currently is less performant when dealing with fine details, like hair)
To help better understand how the feature works, here are some examples:
If you want to give it a try, here are some code snippets to reproduce the examples above:
(original image)
(default segmentation)
segmentation.prompt=laptop
segmentation.prompt=memory card
(original image)
(default segmentation)
segmentation.prompt=tee-shirt
and
segmentation.negativePrompt=hanger
segmentation.prompt=laptop, hand, arm