Package org.jetbrains.kotlinx.dl.api.core.util

Types

TF
Link copied to clipboard
class TF

Helper class that emulates Keras functions from tensorflow.keras.

Functions

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

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

mapOfNotNull
Link copied to clipboard
fun <K, V> mapOfNotNull(vararg mapping: Pair<K?, V?>): Map<K, V>

Create a new read-only map from a list of pairs, if both values in the pair are not null.

predictTopNLabels
Link copied to clipboard
fun predictTopNLabels(it: InferenceModel, floatArray: FloatArray, labels: MutableMap<Int, String>, topN: Int = 5): MutableMap<Int, Pair<String, Float>>

Returns top-N labels for the given floatArray encoded with mapping labels.

serializeLabelsToBuffer
Link copied to clipboard
fun serializeLabelsToBuffer(src: FloatArray, amountOfClasses: Long): FloatBuffer

Converts src to FloatBuffer.

serializeToBuffer
Link copied to clipboard
fun serializeToBuffer(src: Array<FloatArray>): FloatBuffer
fun serializeToBuffer(src: FloatArray): FloatBuffer

Converts src to FloatBuffer.

fun serializeToBuffer(src: Array<FloatArray>, start: Int, length: Int): FloatBuffer

Converts src to FloatBuffer from start position for the next length positions.