---
title: "VisionModel"
sidebar_label: "VisionModel"
description: "Kotlin binding reference: VisionModel."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.modelverse](../index.md)/[VisionModel](index.md)

# VisionModel

[common]\
class [VisionModel](index.md) : [PreTrainedModel](../PreTrainedModel/index.md)

A vision model loaded from its files on disk, on the CPU: a detector, a depth estimator, a text reader, or an embedding model (a model that embeds text and pictures in one space also classifies against labels).

Open it with [open](Companion/open.md) from a snapshot directory; [capabilities](capabilities.md) says which tasks the model serves ([Capabilities.visionTasks](../Capabilities/visionTasks.md)). Hand it a picture with the task's call; the result arrives through the listener on the model's own worker thread, one request at a time per model. [close](close.md) frees the weights.

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Properties

| Name | Summary |
|---|---|
| [capabilities](capabilities.md) | [common]<br>val [capabilities](capabilities.md): [Capabilities](../Capabilities/index.md)<br>What the model takes and gives, read when it opened. |
| [config](config.md) | [common]<br>open override val [config](config.md): [PretrainedConfig](../PretrainedConfig/index.md)<br>The checkpoint's identity, read when the model opened. |

## Functions

| Name | Summary |
|---|---|
| [classify](classify.md) | [common]<br>fun [classify](classify.md)(image: [ImageInput](../ImageInput/index.md), labels: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)&gt;, listener: [VisionListener](../VisionListener/index.md)): [VisionHandle](../VisionHandle/index.md)<br>Score [image](classify.md) against [labels](classify.md) on a model that embeds text and pictures in one space; [VisionListener.onScores](../VisionListener/onScores.md) gets one score per label, descending. |
| [close](close.md) | [common]<br>open fun [close](close.md)() |
| [depth](depth.md) | [common]<br>fun [depth](depth.md)(image: [ImageInput](../ImageInput/index.md), listener: [VisionListener](../VisionListener/index.md)): [VisionHandle](../VisionHandle/index.md)<br>Estimate the depth of every pixel of [image](depth.md); [VisionListener.onDepth](../VisionListener/onDepth.md) gets the map at the picture's resolution. |
| [detect](detect.md) | [common]<br>fun [detect](detect.md)(image: [ImageInput](../ImageInput/index.md), options: [DetectOptions](../DetectOptions/index.md), listener: [VisionListener](../VisionListener/index.md)): [VisionHandle](../VisionHandle/index.md)<br>Find the objects in [image](detect.md) under [options](detect.md); [VisionListener.onDetections](../VisionListener/onDetections.md) gets the boxes in the picture's pixels, score-descending, then [VisionListener.onDone](../VisionListener/onDone.md). A model without [VisionTask.DETECT](../VisionTask/DETECT.md), labels given to a detector with its own table, or none given to an open-vocabulary one end in [VisionListener.onError](../VisionListener/onError.md). |
| [embed](embed.md) | [common]<br>fun [embed](embed.md)(image: [ImageInput](../ImageInput/index.md), listener: [VisionListener](../VisionListener/index.md)): [VisionHandle](../VisionHandle/index.md)<br>Embed [image](embed.md); [VisionListener.onEmbedding](../VisionListener/onEmbedding.md) gets its vector of [Capabilities.embeddingDim](../Capabilities/embeddingDim.md) values. |
| [recognizeText](recognizeText.md) | [common]<br>fun [recognizeText](recognizeText.md)(image: [ImageInput](../ImageInput/index.md), options: [OcrOptions](../OcrOptions/index.md), listener: [VisionListener](../VisionListener/index.md)): [VisionHandle](../VisionHandle/index.md)<br>Read the text written in [image](recognizeText.md); [VisionListener.onText](../VisionListener/onText.md) gets it whole. |
| [residency](residency.md) | [common]<br>open override fun [residency](residency.md)(): [ResidencyReport](../ResidencyReport/index.md)<br>Free the model. A running request is canceled first and the call waits for it to return; called from inside a listener callback, the free runs right after that callback's request ends instead. Idempotent. |