I want to apply cartoon effect to picture in android (java/kotlin or c/c++) with tensorflow lite. (tflite model / dr, fp16, int8 quantization)
I found this tutorial.
This code is also based on it.
My demo app works on CPU with 4 threads but when I want to test it with GPU delegate gives an error.
I used several devices and the result was the same in all of them.
// Check if device supports GPU delegate
val compatList = CompatibilityList()
val isSupported = compatList.isDelegateSupportedOnThisDevice
// If device does not support, then it will be done on 4 CPU threads
val options = Model.Options.Builder().apply {
if(isSupported) setDevice(Model.Device.GPU)
else setNumThreads(4)
}.build()
val model = WhiteboxCartoonGanFp16.newInstance(this, options)
val process = model.process(picture)
val cartoon = process.cartoonizedImageAsTensorImage
val bitmap = image.bitmap
model.close()