Train in R, run on Android: Image segmentation with torch

This is a companion discussion topic for the original entry at https://blogs.rstudio.com/tensorflow/posts/2021-10-29-segmentation-torch-android


We train a model for image segmentation in R, using torch together with luz, its high-level interface. We then JIT-trace the model on example input, so as to obtain an optimized representation that can run with no R installed. Finally, we show the model being run on Android.