ImageRecognitionModel

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.

Constructors

ImageRecognitionModel
Link copied to clipboard
fun ImageRecognitionModel(internalModel: OnnxInferenceModel, channelsFirst: Boolean, preprocessor: Operation<Pair<FloatArray, TensorShape>, Pair<FloatArray, TensorShape>> = Identity(), modelKindDescription: String? = null, classLabels: Map<Int, String> = Imagenet.V1k.labels())

Functions

close
Link copied to clipboard
open override fun close()
copy
Link copied to clipboard
open override fun copy(copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean): InferenceModel
initializeWith
Link copied to clipboard
open override fun initializeWith(vararg executionProviders: ExecutionProvider)

Initialize the model with the specified executions providers.

predict
Link copied to clipboard
open override fun predict(inputData: FloatArray): Int
predictObject
Link copied to clipboard
fun predictObject(image: Bitmap): String
predictSoftly
Link copied to clipboard
open override fun predictSoftly(inputData: FloatArray, predictionTensorName: String): FloatArray
predictTopKObjects
Link copied to clipboard
fun predictTopKObjects(image: Bitmap, topK: Int): List<Pair<String, Float>>
reshape
Link copied to clipboard
open override fun reshape(vararg dims: Long)
summary
Link copied to clipboard
open override fun summary(): ModelSummary

Properties

inputDimensions
Link copied to clipboard
open override val inputDimensions: LongArray
targetRotation
Link copied to clipboard
open override var targetRotation: Int = 0

Target image rotation.