Skip to main content
Version: Next

Function: useSemanticSegmentation()

useSemanticSegmentation<C>(props): SemanticSegmentationType<SegmentationLabels<ModelNameOf<C>>>

Defined in: hooks/computer_vision/useSemanticSegmentation.ts:29

React hook for managing a Semantic Segmentation model instance.

Type Parameters

C

C extends SemanticSegmentationModelSources

A SemanticSegmentationModelSources config specifying which built-in model to load.

Parameters

props

SemanticSegmentationProps<C>

Configuration object containing model config and optional preventLoad flag.

Returns

SemanticSegmentationType<SegmentationLabels<ModelNameOf<C>>>

An object with model state (error, isReady, isGenerating, downloadProgress) and a typed forward function.

Example

const { isReady, forward } = useSemanticSegmentation({
model: { modelName: 'deeplab-v3', modelSource: DEEPLAB_V3_RESNET50 },
});