Alexandre Brown
11/08/2022, 3:52 PMAlexandre Brown
11/08/2022, 3:54 PMAlexandre Brown
11/08/2022, 4:00 PMAlexandre Brown
11/08/2022, 4:26 PMtransformTensor {
normalize {
mean = normalizeOptions.channelsMean.toFloatArray()
std = normalizeOptions.channelsStd.toFloatArray()
}
}
Julia Beliaeva
11/08/2022, 4:31 PMkotlin-deeplearning-impl
artifact. Yes, it is multiplatform (with the jvm and android variants).Julia Beliaeva
11/08/2022, 4:44 PMBufferedImage
or Pair<FloatArray, TensorShape>
. You can use create your own Operation
which converts you custom type to one of these types (depending of which KotlinDL operations you want to use). You can write something like this:
val preprocessing = pipeline<CustomImageType>()
.toFloatArray()
.normalize {
// std =
// mean =
}
preprocessing.apply(loadImageAsCustomImageType("/path/to/image"))
(you'll have to implement toFloatArray
and loadImageAsCustomImageType
is your function that loads images.Alexandre Brown
11/08/2022, 4:46 PMAlexandre Brown
11/08/2022, 4:46 PMpreprocessing.apply(loadImageAsCustomImageType("/path/to/image"))
needed if my data is already a float array?Julia Beliaeva
11/08/2022, 4:51 PMnormalize
preprocessing to it? apply
applies preprocessing defined above to the data.Alexandre Brown
11/08/2022, 4:52 PMnormalize
, nevermind I didnt read the method name properly, I get it , loadImageAsCustomImageType
is just your way of saying whatever function that returns the custom type my badAlexandre Brown
11/08/2022, 4:53 PMAlexandre Brown
11/14/2022, 1:29 PMAlexandre Brown
11/14/2022, 1:38 PMJulia Beliaeva
11/14/2022, 8:04 PMnormalize
, or use call
to call your operation, like so:
val image: Image<Int> = //
val preprocessing = pipeline<Image<Int>>().call(ImageOperation()).normalize {
//
}
preprocessing.apply(image)
Julia Beliaeva
11/16/2022, 4:47 PM