ImageRecognitionModel

class ImageRecognitionModel(internalModel: InferenceModel, inputColorMode: ColorMode, channelsFirst: Boolean, preprocessor: Operation<Pair<FloatArray, TensorShape>, Pair<FloatArray, TensorShape>>, modelKindDescription: String?) : ImageRecognitionModelBase<BufferedImage>

The light-weight API for solving Image Recognition task with one of the Model Hub models trained on ImageNet dataset.

Constructors

ImageRecognitionModel
Link copied to clipboard
fun ImageRecognitionModel(internalModel: InferenceModel, inputColorMode: ColorMode, channelsFirst: Boolean, preprocessor: Operation<Pair<FloatArray, TensorShape>, Pair<FloatArray, TensorShape>> = Identity(), modelKindDescription: String? = null)

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): ImageRecognitionModel
predict
Link copied to clipboard
open override fun predict(inputData: FloatArray): Int
predictObject
Link copied to clipboard
fun predictObject(imageFile: File): String

Predicts object for the given imageFile. Default preprocessing Operation is applied to an image.

fun predictObject(image: BufferedImage): String

Predicts object for the given image. Default preprocessing Operation is applied to an image.

predictSoftly
Link copied to clipboard
open override fun predictSoftly(inputData: FloatArray, predictionTensorName: String): FloatArray
predictTopKObjects
Link copied to clipboard
fun predictTopKObjects(imageFile: File, topK: Int): List<Pair<String, Float>>

Predicts topK objects for the given imageFile. Default preprocessing Operation is applied to an image.

fun predictTopKObjects(image: BufferedImage, topK: Int = 5): List<Pair<String, Float>>

Predicts topK objects for the given image. Default preprocessing Operation is applied to an image.

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