ImageRecognitionModel

class ImageRecognitionModel(internalModel: InferenceModel, modelType: ModelType<out InferenceModel, out InferenceModel>) : InferenceModel

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, modelType: ModelType<out InferenceModel, out InferenceModel>)

Functions

close
Link copied to clipboard
open override fun close()

Releases internal resources.

copy
Link copied to clipboard
open override fun copy(copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean): TensorFlowInferenceModel

Creates a copy.

evaluate
Link copied to clipboard
fun evaluate(dataset: Dataset, metric: Metrics): Double

Evaluates dataset via metric.

predict
Link copied to clipboard
open override fun predict(inputData: FloatArray): Int

Predicts the class of inputData.

fun predict(dataset: Dataset): List<Int>

Predicts labels for all observation in dataset.

predictObject
Link copied to clipboard
fun predictObject(imageFile: File): String

Predicts object for the given imageFile.

predictSoftly
Link copied to clipboard
open override fun predictSoftly(inputData: FloatArray, predictionTensorName: String): FloatArray

Predicts vector of probabilities instead of specific class in predict method.

predictTopKObjects
Link copied to clipboard
fun predictTopKObjects(imageFile: File, topK: Int = 5): List<Pair<String, Float>>

Predicts topK objects for the given imageFile.

reshape
Link copied to clipboard
open override fun reshape(vararg dims: Long)

Chain-like setter to set up input shape.

Properties

imageNetClassLabels
Link copied to clipboard
val imageNetClassLabels: MutableMap<Int, String>

Class labels for ImageNet dataset.

inputDimensions
Link copied to clipboard
open override val inputDimensions: LongArray

Input specification for this model.

name
Link copied to clipboard
var name: String? = null

Model name.