Skip to content

ImageClassifier

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:74

readonly inputSize: number

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:78

Width and height of the model input in pixels.


readonly labels: readonly string[]

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:76

The class names, by class index.


readonly schemas: object

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:82

Buffer layouts for encodeClassify, at this runner’s size: the model input, and the list with room for topk classes. Pass one to root.createBuffer to make a buffer of the right type and size.

readonly input: ClassifyInput

readonly output: (topk) => ClassificationList

number

ClassificationList

classify(image, options?): Promise<Classification & object[]>

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:87

Image in, its most likely classes out, best first.

ImageBuffer

ClassifyOptions

Promise<Classification & object[]>


dispose(): void

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:99

Frees the weights and every GPU buffer the runner holds.

void


encodeClassify(options): void

Defined in: packages/runntime/src/zoo/tasks/cv/imageClassification.ts:97

Records a classification from GPU memory into GPU memory, with no CPU copy. A texture source is fitted like an ImageBuffer; a buffer source is the model input as-is. The target gets the best classes, ranked on the GPU. Work submitted after it sees the result.

EncodeClassifyOptions

void

RunntimeError INVALID_ARGUMENT for a resource of the wrong format, usage or size, or a topk out of range.