Skip to content

DepthAnything V2 Small — Native Keras TFLite (v2.0)

Choose a tag to compare

@john-rocky john-rocky released this 02 Apr 05:53
· 305 commits to main since this release

DepthAnything V2 Small — Native Keras NHWC Models

Native Keras conversion with near-perfect PyTorch quality. Replaces v1.0 onnx2tf models.

Model Input Speed (Pixel 8a) Quality (vs PyTorch) Size
depth_anything_v2_keras.tflite 518x518 9ms corr=0.9995 99 MB
depth_anything_v2_keras_392x518.tflite 392x518 ~7ms corr=0.9999 98 MB

What's New (vs v1.0)

  • Quality: corr=0.845 → 0.9995 (native Keras, no onnx2tf conversion artifacts)
  • Speed: 575ms → 9ms (CompiledModel ML Drift GPU, was old Interpreter API)
  • Compatibility: Works on Pixel 6+ with LiteRT 2.1.3 CompiledModel API

Usage

implementation("com.google.ai.edge.litert:litert:2.1.3")

val options = CompiledModel.Options(Accelerator.GPU)
options.gpuOptions = CompiledModel.GpuOptions(
    precision = CompiledModel.GpuOptions.Precision.FP32
)
val model = CompiledModel.create(context.assets, "depth_anything_v2_keras.tflite", options, null)

Place model in sample-app/app/src/main/assets/ and see sample-app/ for full example.