Function: useClassifier()
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.
Type Parameters
L
L
The type representing the classification labels.
Parameters
config
The image classification model configuration. See ClassifierModel.
options?
Load and caching options. See ResourceOptions.
Returns
object
The same object as Classifier (without dispose),
combined with loading state, download progress, and labels.
classify
classify:
any=model.classify
classifyWorklet
classifyWorklet:
any=model.classifyWorklet
downloadProgress
downloadProgress:
any
error
error:
any
isReady
isReady:
boolean=!!model
labels
labels: readonly
L[] =config.modelOpts.labels
resource
resource:
any