EDGE FDE
IntermediatePyTorch to Android with LiteRT
Train a small Fashion-MNIST clothing classifier on a Mac. Use MPS if you have it, or CPU if you do not. Then export the model, convert it to LiteRT/TFLite, and show clothing labels in a Kotlin Android app.
For someone who can write Python and Kotlin and is new to LiteRT. Convert on Linux. The official LiteRT Torch converter currently says it supports Linux. Android is where the finished app runs.
Lessons
Key concepts
- Train a Fashion-MNIST clothing classifier on a Mac with MPS or CPU. No CUDA.
- Convert on Linux with
litert-torchintoclothing.tflite. - Ship the
.tflitefile in an Android APK and run LiteRTCompiledModel. - One contract: NCHW
[1, 1, 28, 28]float32 in,[1, 10]logits out, ten fixed labels.
Takeaways
- You can train on a Mac, convert on Linux, and show a clothing label in Kotlin.
- You use
CompiledModel, not the olderInterpreter, for new code. - You can keep the same
ClothingCNNcontract as the Core AI course on a different device.
Agent briefs
Related courses
PyTorch to Core AI in Xcode · Model architectures in plain English