useClassifier<
L>(config,options?):object
Defined in: hooks/useClassifier.ts:23
React hook to load and run an image classification model.
This hook manages downloading (if remote URLs are provided) and loading the model assets, compiling them, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.
For imperative usage, see createClassifier.
L
The type representing the classification labels.
The image classification model configuration. See ClassifierModel.
Load and caching options. See ResourceOptions.
object
The same object as Classifier (without dispose),
combined with loading state, download progress, and labels.
classify: (
input,options?) =>Promise<Classification<L>[]> |undefined=model.classify
classifyWorklet: (
input,options?) =>Classification<L>[] |undefined=model.classifyWorklet
downloadProgress:
number
error:
Error|undefined
isReady:
boolean=!!model
labels: readonly
L[] =config.modelOpts.labels
resource:
ClassifierModel<L> |undefined