ImageToTensor
class ImageToTensor(ctx: ExecutionContext) : Transform<PlatformBitmapImage, Tensor<FP16, Float>> (source)
Converts a platform image to a tensor.
Uses SKaiNET's platformImageToArgb function to convert the image to a tensor with shape (1, 3, H, W) and float values in 0, 255 range.
Usage
val toTensor = ImageToTensor(executionContext)
val tensor = toTensor.apply(image) // Shape: (1, 3, H, W)Content copied to clipboard
Parameters
ctx
The execution context for tensor creation