DaisyKit: AI for Everyone
9 / 10
Lesson 9 of 10

Lesson 09: Mobile Deployment

5 min readViet-Anh NguyenViet-Anh Nguyen

DaisyKit's C++ core compiles to native code for Android and iOS. The same NCNN model weights that run in Python work on mobile without modification. All inference is on-device — no internet required after the initial model download.

DaisyKit Android demo: all six AI flows running on a mobile device

Android Deployment

Prerequisites

  • Android Studio (Arctic Fox or later)
  • Android SDK API 24+ (Android 7.0)
  • NDK r21+ (installed via SDK Manager)
  • A physical device or emulator with Camera2 API support

Setup

# Clone the Android example repository
git clone --recursive https://github.com/Daisykit-AI/daisykit-android

cd daisykit-android

The repository contains all six DaisyKit flows as separate Android Activities inside one app.

Download Dependencies

Follow the README to download:

  1. Prebuilt OpenCV Android SDK — place in app/sdk/OpenCV-android-sdk/
  2. Prebuilt NCNN library — place in app/sdk/ncnn-android-vulkan/

Links are provided in the repository README.

Build and Run

  1. Open daisykit-android/ in Android Studio
  2. Let Gradle sync and download dependencies
  3. Connect your device (USB debugging enabled)
  4. Press Run ▶ — Android Studio builds the APK and installs it

The app launches with a menu of all available flows:

  • Face Detection & Landmarks
  • Human Pose Estimation
  • Background Matting
  • Hand Pose Detection
  • Object Detection
  • Barcode Scanner

Integrating a Flow into Your Own App

The core pattern in Java/Kotlin:

// Kotlin example — Face Detection Flow
import ai.daisykit.android.FaceDetectorFlow

class MainActivity : AppCompatActivity() {
    private lateinit var flow: FaceDetectorFlow

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val config = """
        {
            "face_detection_model": {
                "model": "models/face_detection/yolo_fastest_with_mask/yolo-fastest-opt.param",
                "weights": "models/face_detection/yolo_fastest_with_mask/yolo-fastest-opt.bin",
                "input_width": 320, "input_height": 320,
                "score_threshold": 0.7, "iou_threshold": 0.5,
                "use_gpu": false
            },
            "with_landmark": true,
            "facial_landmark_model": {
                "model": "models/facial_landmark/pfld-sim.param",
                "weights": "models/facial_landmark/pfld-sim.bin",
                "input_width": 112, "input_height": 112, "use_gpu": false
            }
        }
        """.trimIndent()

        flow = FaceDetectorFlow(config)
    }

    fun processFrame(bitmap: Bitmap): Bitmap {
        // Flow processes and draws results directly on the bitmap
        return flow.process(bitmap)
    }
}

Model .param and .bin files go in the app's assets/ directory — Android packages them into the APK.

Enabling GPU (Vulkan)

Most Android devices support Vulkan (API 24+). Enable it in the config:

"use_gpu": true

This offloads computation to the GPU, giving 2–5× speedup depending on the device and model size.

Performance on Android

Measured on a mid-range Android phone (Snapdragon 778G):

FlowCPU (FPS)GPU/Vulkan (FPS)
Face + Landmarks~18 FPS~35 FPS
Human Pose~12 FPS~25 FPS
Background Matting~10 FPS~22 FPS
Object Detection~15 FPS~30 FPS

iOS Deployment

Prerequisites

  • macOS with Xcode 13+
  • iPhone or iPad running iOS 14+
  • Apple Developer account (for device deployment)

Setup

git clone --recursive https://github.com/Daisykit-AI/daisykit-ios

cd daisykit-ios

Build

  1. Open daisykit-ios/DaisykitExample.xcodeproj in Xcode
  2. Select your development team in Signing & Capabilities
  3. Download the required OpenCV and NCNN iOS frameworks (links in README)
  4. Build and run on your device

SwiftUI Integration

import DaisykitSDK
import UIKit

class FaceDetectionProcessor {
    private let flow: DKFaceDetectorFlow

    init() {
        let config = """
        {
            "face_detection_model": {
                "model": "models/face_detection/...",
                ...
            },
            "with_landmark": true,
            ...
        }
        """
        flow = DKFaceDetectorFlow(config: config)
    }

    func process(image: UIImage) -> UIImage {
        return flow.process(image) ?? image
    }
}

Model files are added to the Xcode project as resource bundles.

Cross-Platform Strategy

One of DaisyKit's key strengths is that the same model weights, same config format, same output structure work across all platforms:

PlatformLanguageInference Engine
DesktopPythonNCNN (CPU/Vulkan)
DesktopC++NCNN (CPU/Vulkan)
AndroidKotlin/JavaNCNN (CPU/Vulkan)
iOSSwiftNCNN (CPU)
WebWASMNCNN (planned)

Once you prototype a flow in Python (the easiest environment), deploying it on Android or iOS is a matter of wiring up the native SDK to your camera pipeline — the AI logic is identical.

Conclusion

DaisyKit makes mobile AI deployment straightforward: clone the example repo, drop your model files in assets/, configure, and run. GPU acceleration via Vulkan is a single config flag away. In the final lesson we look at integrating custom NCNN models and using the low-level C++ graph API.