Package org.jetbrains.kotlinx.dl.api.inference.keras.loaders

Types

InputType
Link copied to clipboard
enum InputType : Enum<InputType>

Different Neural Networks were trained on ImageNet dataset with different image preprocessing. The main types of preprocessing widely used in keras.applications are presented in this enumeration.

LoadingMode
Link copied to clipboard
enum LoadingMode : Enum<LoadingMode>

Loading strategy for remote loading.

ModelHub
Link copied to clipboard
abstract class ModelHub(cacheDirectory: File)

This is an abstract class which provides methods for loading models, its weights and labels (for prediction purposes) to the local cacheDirectory.

ModelType
Link copied to clipboard
interface ModelType<T : InferenceModel, U : InferenceModel>

Basic interface for models loaded from S3.

TFModelHub
Link copied to clipboard
class TFModelHub(cacheDirectory: File) : ModelHub

This class provides methods for loading Keras models, its weights and ImageNet labels (for prediction purposes) to the local cacheDirectory.

TFModels
Link copied to clipboard
object TFModels

Supported models for inference and transfer learning, trained on ImageNet dataset.

Functions

caffeStylePreprocessing
Link copied to clipboard
fun caffeStylePreprocessing(input: FloatArray, imageShape: LongArray, channelsLast: Boolean = true): FloatArray

Caffe-style preprocessing.

predictTop5ImageNetLabels
Link copied to clipboard
fun predictTop5ImageNetLabels(it: TensorFlowInferenceModel, data: FloatArray, imageNetClassLabels: MutableMap<Int, String>): List<Pair<String, Float>>

Returns top-5 labels for the given data encoded with mapping imageNetClassLabels.

predictTopKImageNetLabels
Link copied to clipboard
fun predictTopKImageNetLabels(it: InferenceModel, data: FloatArray, imageNetClassLabels: MutableMap<Int, String>, topK: Int = 5): List<Pair<String, Float>>

Returns topK labels for the given data encoded with mapping imageNetClassLabels.

prepareImageNetHumanReadableClassLabels
Link copied to clipboard
fun prepareImageNetHumanReadableClassLabels(): MutableMap<Int, String>

Forms mapping of class label to class name for the ImageNet dataset.

preprocessInput
Link copied to clipboard
fun preprocessInput(floatArray: FloatArray, tensorShape: LongArray? = null, inputType: InputType, channelsLast: Boolean = true): FloatArray

Common preprocessing functions for the Neural Networks trained on ImageNet and whose weights are available with the keras.application.

reshapeInput
Link copied to clipboard
fun reshapeInput(inputData: FloatArray, imageShape: LongArray): Array<Array<FloatArray>>

Reshapes inputData according imageShape.

torchStylePreprocessing
Link copied to clipboard
fun torchStylePreprocessing(input: FloatArray, imageShape: LongArray, channelsLast: Boolean = true): FloatArray

Torch-style preprocessing.