Upgrade to Pro — share decks privately, control downloads, hide ads and more …

On Device AI with Google AI Edge

Darshan Parikh
October 21, 2024
7

On Device AI with Google AI Edge

Darshan Parikh

October 21, 2024
Tweet

Transcript

  1. Agenda • On-device AI • Google AI Edge ◦ Gemini

    Nano ◦ ML Kit ◦ MediaPipe Solutions • Live demo ◦ MediaPipe Tasks ◦ MediaPipe Model Maker • Summary
  2. On-device AI • AI processing and computations performed on a

    device • For ex, smartphone, wearable, IoT device etc. • Does not rely on cloud servers
  3. On-device AI • Advantages ◦ Low latency ◦ Privacy ◦

    Offline functionality ◦ Reduced reliance on cloud infrastructure • Challenges ◦ Limited computational power compared to cloud ◦ Model size limitations
  4. Google AI Edge • Platform that enables developers to build

    and deploy AI models directly on devices • On-device AI for mobile, web, and embedded applications
  5. • Android’s foundation model for building on-device GenAI applications •

    Integrated to the Android OS via AICore in Android 14+ • Google AI Edge SDK provides access to APIs • Application examples such as, ◦ Speech transcription ◦ Smart reply ◦ Text summarization • Available on Pixel 8 series and Samsung S24 series 1.0 Nano
  6. • Focused on on-device machine learning tasks • Image recognition,

    Text recognition, Face detection etc. • Designed for real-time applications with limited computational resources • ML Kit is not designed for GenAI tasks • Android & iOS
  7. // Vision APIs implementation("com.google.mlkit:image-labeling:version") implementation("com.google.mlkit:object-detection:version") implementation("com.google.mlkit:pose-detection:version") implementation("com.google.mlkit:face-mesh-detection:version") implementation("com.google.mlkit:barcode-scanning:version") implementation("com.google.mlkit:text-recognition:version") //

    Natural Language APIs implementation("com.google.mlkit:mlkit-language-id:version") implementation("com.google.mlkit:translate:version") implementation("com.google.mlkit:entity-extraction:version") implementation("com.google.mlkit:mlkit-smart-reply:version")
  8. • MediaPipe Solutions provides a suite of libraries and tools

    • Apply AI and ML techniques in apps • Initially designed for real-time processing of image and video data • Expanded capabilities to include generative AI functions • Android, Python, Web, iOS (coming soon)
  9. MediaPipe LLM Inference • Available on-device LLMs ◦ Gemma 2B

    ◦ Gemma 7B ◦ Falcon 1B ◦ StableLM 3B ◦ Phi-2 (2.7B)
  10. MediaPipe LLM Inference process • Download the model from HuggingFace

    • Convert the model to MediaPipe-friendly format • Save the model to /data/local/tmp/llm/ directory on device • Run the app
  11. Result • Download the model from HuggingFace • Convert the

    model to MediaPipe-friendly format • Save the model to /data/local/tmp/llm/ directory on device • Run the app
  12. • Low-level component to build efficient on-device machine learning pipelines,

    similar to the premade MediaPipe Solutions • For ex, Augmented Reality application ◦ Face filters ◦ Hand tracking ◦ Object recognition MediaPipe Framework