Hello everyone! KTensorFlow 2.0 is out :tada: — a ...
# feed
s
Hello everyone! KTensorFlow 2.0 is out 🎉 — a Kotlin Multiplatform library for running TensorFlow Lite (LiteRT) models on Android and iOS from shared code. Some of you may remember 1.x. Version 2.0 grew from a thin wrapper into a toolkit for on-device ML, all in common Kotlin: New in 2.0 • Vision module — a cross-platform
Image
(
Bitmap
on Android,
CGImage
on iOS) with resizing, cropping, rotation and letterboxing done by native platform APIs, plus conversion to tensors, bounding boxes and NMS • Coroutines module —
runSuspend
,
processFlow
and
processFlowDropping
, which skips camera frames while the model is busy, so live detection doesn't fall behind • Zero-copy tensor views —
reshape
,
transpose
,
slice
and others share memory instead of copying it • Model metadata — signature names, named outputs and
resizeInput
• Thread safety — interpreters and delegates are
AutoCloseable
, safe to call from several threads and safe to close while running Still there from 1.x • Loading
.tflite
models from the shared module, with Compose Resources and Moko Resources support • GPU and NPU acceleration • Tensors with arithmetic, casting,
argmax
/
argmin
• Declarative pipelines for preprocessing and postprocessing The repo includes a sample that runs live object detection from the camera on both platforms with the same shared code. Next on the roadmap • Converting camera frames into existing tensors, so live inference allocates no memory per frame • Passing context such as letterbox info through pipelines • More built-in pipeline stages and tensor operations • Text processing utilities 👉 github.com/kursor1337/KTensorFlow What started as my graduation project has become a real passion. I'd love to hear your feedback and ideas, and contributions are welcome — and a ⭐ helps a lot!
🤖 3