<br />

Performs classification on images.

**Signature:**

    export declare class ImageClassifier extends VisionTaskRunner 

## Methods

| Method | Modifiers | Description |
|---|---|---|
| [createFromOptions(wasmFileset, imageClassifierOptions)](https://developers.google.com/edge/api/mediapipe/js/tasks-vision.imageclassifier#imageclassifiercreatefromoptions) | `static` | Initializes the Wasm runtime and creates a new image classifier from the provided options. |
| [createFromModelBuffer(wasmFileset, modelAssetBuffer)](https://developers.google.com/edge/api/mediapipe/js/tasks-vision.imageclassifier#imageclassifiercreatefrommodelbuffer) | `static` | Initializes the Wasm runtime and creates a new image classifier based on the provided model asset buffer. |
| [createFromModelPath(wasmFileset, modelAssetPath)](https://developers.google.com/edge/api/mediapipe/js/tasks-vision.imageclassifier#imageclassifiercreatefrommodelpath) | `static` | Initializes the Wasm runtime and creates a new image classifier based on the path to the model asset. |
| [setOptions(options)](https://developers.google.com/edge/api/mediapipe/js/tasks-vision.imageclassifier#imageclassifiersetoptions) |   | Sets new options for the image classifier. Calling `setOptions()` with a subset of options only affects those options. You can reset an option back to its default value by explicitly setting it to `undefined`. |
| [classify(image, imageProcessingOptions)](https://developers.google.com/edge/api/mediapipe/js/tasks-vision.imageclassifier#imageclassifierclassify) |   | Performs image classification on the provided single image and waits synchronously for the response. Only use this method when the ImageClassifier is created with running mode `image`. |
| [classifyForVideo(videoFrame, timestamp, imageProcessingOptions)](https://developers.google.com/edge/api/mediapipe/js/tasks-vision.imageclassifier#imageclassifierclassifyforvideo) |   | Performs image classification on the provided video frame and waits synchronously for the response. Only use this method when the ImageClassifier is created with running mode `video`. |

## ImageClassifier.createFromOptions() {#imageclassifiercreatefromoptions}

Initializes the Wasm runtime and creates a new image classifier from the provided options.

**Signature:**

    static createFromOptions(wasmFileset: WasmFileset, imageClassifierOptions: ImageClassifierOptions): Promise<ImageClassifier>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location Wasm binary and its loader. |
| imageClassifierOptions | ImageClassifierOptions | The options for the image classifier. Note that either a path to the model asset or a model buffer needs to be provided (via `baseOptions`). |

**Returns:**

Promise\<ImageClassifier\>

## ImageClassifier.createFromModelBuffer() {#imageclassifiercreatefrommodelbuffer}

Initializes the Wasm runtime and creates a new image classifier based on the provided model asset buffer.

**Signature:**

    static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array | ReadableStreamDefaultReader): Promise<ImageClassifier>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetBuffer | Uint8Array \| ReadableStreamDefaultReader | An array or a stream containing a binary representation of the model. |

**Returns:**

Promise\<ImageClassifier\>

## ImageClassifier.createFromModelPath() {#imageclassifiercreatefrommodelpath}

Initializes the Wasm runtime and creates a new image classifier based on the path to the model asset.

**Signature:**

    static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<ImageClassifier>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetPath | string | The path to the model asset. |

**Returns:**

Promise\<ImageClassifier\>

## ImageClassifier.setOptions() {#imageclassifiersetoptions}

Sets new options for the image classifier. Calling `setOptions()` with a subset of options only affects those options. You can reset an option back to its default value by explicitly setting it to `undefined`.

**Signature:**

    setOptions(options: ImageClassifierOptions): Promise<void>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| options | ImageClassifierOptions | The options for the image classifier. |

**Returns:**

Promise\<void\>

## ImageClassifier.classify() {#imageclassifierclassify}

Performs image classification on the provided single image and waits synchronously for the response. Only use this method when the ImageClassifier is created with running mode `image`.

**Signature:**

    classify(image: ImageSource, imageProcessingOptions?: ImageProcessingOptions): ImageClassifierResult;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| image | ImageSource | An image to process. |
| imageProcessingOptions | ImageProcessingOptions | the `ImageProcessingOptions` specifying how to process the input image before running inference. |

**Returns:**

ImageClassifierResult

## ImageClassifier.classifyForVideo() {#imageclassifierclassifyforvideo}

Performs image classification on the provided video frame and waits synchronously for the response. Only use this method when the ImageClassifier is created with running mode `video`.

**Signature:**

    classifyForVideo(videoFrame: ImageSource, timestamp: number, imageProcessingOptions?: ImageProcessingOptions): ImageClassifierResult;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| videoFrame | ImageSource | A video frame to process. |
| timestamp | number | The timestamp of the current frame, in ms. |
| imageProcessingOptions | ImageProcessingOptions | the `ImageProcessingOptions` specifying how to process the input image before running inference. |

**Returns:**

ImageClassifierResult