Deep Dive Into Deep Learning With KotlinDL
Deep Dive Into Deep Learning With KotlinDL
with KotlinDL
Aleksei Zinovev, JetBrains
@zaleslaw
KotlinConf’23
Amsterdam
Bio
● Java & Kotlin developer
● Distributed ML enthusiast
● Apache Ignite PMC
● TensorFlow Contributor
● JetBrains, Kotlin for Data Science
● Happy father and husband
● https://github.com/zaleslaw
● https://twitter.com/zaleslaw
Agenda
● The KotlinDL Intro
● Demo (4 use cases):
○ Object Detection
○ Pose Estimation
○ Face Detection
○ Image Recognition
AI
Python market:
● Notebooks with
spaghetti-code
● No Kotlin API in DL
frameworks
● A lot of models
Python market:
● Notebooks with
spaghetti-code
● No Kotlin API in DL
frameworks
● A lot of models
Kotlin market:
● Outdated examples
● Abandoned libraries
● No documentation
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
● Model Hub with the pretrained models in the Computer Vision Domain
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
● Model Hub with the pretrained models in the Computer Vision Domain
● Embedded datasets
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
● Model Hub with the pretrained models in the Computer Vision Domain
● Embedded datasets
● Kotlin DSL for Image Preprocessing
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
● Model Hub with the pretrained models in the Computer Vision Domain
● Embedded datasets
● Kotlin DSL for Image Preprocessing
● A lot of tutorials and examples
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
● Model Hub with the pretrained models in the Computer Vision Domain
● Embedded datasets
● Kotlin DSL for Image Preprocessing
● A lot of tutorials and examples
● Integration with Keras, TensorFlow and ONNX Runtime
KotlinDL = Deep Learning Library for Kotliners
● Nice Kotlin-idiomatic API for beginners
● Model Hub with the pretrained models in the Computer Vision Domain
● Embedded datasets
● Kotlin DSL for Image Preprocessing
● A lot of tutorials and examples
● Integration with Keras, TensorFlow and ONNX Runtime
● Android support
How it works?
Kotlin Application
How it works?
Kotlin Application
KotlinDL
How it works?
Kotlin Application
KotlinDL
ONNX Runtime
via Java API
How it works?
Kotlin Application
KotlinDL
ONNX Runtime
via Java API
What if I have a PyTorch-trained model?
What if I have a PyTorch-trained model?
Demo
What about Android Apps?
https://github.com/Kotlin/kotlindl-app-sample
But sometimes you need to train your own models
Transfer Learning: fine-tune the model
Transfer Learning: fine-tune the model
Frozen layers
Transfer Learning: fine-tune the model
New
layers
Trainable layers
Transfer Learning: Demo
You can build your own Neural Network (ref)
Summary
● Prediction is easy with KotlinDL
● Fine-tuning of the model is possible
● Training from scratch is possible
● We have other items in the box (DataFrame, plotting and Notebooks)
● Share your case and get the help from the KDS team
Follow me and KDS team
● GitHub: @zaleslaw
● Twitter: @zaleslaw
● YouTube: KotlinDL playlist
● Medium: @zaleslaw
● Project GitHub - Kotlin/kotlindl
● Team Twitter: @KotlinForData
Thank you,
and don’t forget
to vote
@twitter
KotlinConf’23
Amsterdam