Package org.jetbrains.kotlinx.dl.onnx.inference.classification

Types

ImageRecognitionModel
Link copied to clipboard
open class ImageRecognitionModel(internalModel: OnnxInferenceModel, channelsFirst: Boolean, preprocessor: Operation<Pair<FloatArray, TensorShape>, Pair<FloatArray, TensorShape>>, modelKindDescription: String?, classLabels: Map<Int, String>) : ImageRecognitionModelBase<Bitmap> , ExecutionProviderCompatible, CameraXCompatibleModel

The light-weight API for Classification task with one of the Model Hub models.

Functions

predictObject
Link copied to clipboard
fun ImageRecognitionModelBase<Bitmap>.predictObject(imageProxy: ImageProxy): String

Predicts object for the given imageProxy. Internal preprocessing is updated to rotate image to match target orientation. After prediction, internal preprocessing is restored to the original state.

predictTopKObjects
Link copied to clipboard
fun ImageRecognitionModelBase<Bitmap>.predictTopKObjects(imageProxy: ImageProxy, topK: Int = 5): List<Pair<String, Float>>

Predicts topK objects for the given imageProxy. Internal preprocessing is updated to rotate image to match target orientation. After prediction, internal preprocessing is restored to the original state.