---
title: CoreAIで約1000種類の花をオンデバイス識別する
tags: 
author: [Fumiya Yamanaka](https://image.docswell.com/user/mtfum)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/4JMYN4KQJW.jpg?width=480
description: CoreAIで約1000種類の花をオンデバイス識別するアプリ「花AIカメラ」を作りました。 CoreAIの使い方、CoreMLとの違い、モデルの読み込みにかかる時間を実機で測った結果を話します。 iOSDC Japan 2026 ルーキーズLTの発表資料です。
published: September 12, 26
canonical: https://image.docswell.com/s/mtfum/KVJYPP-iosdc2026
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/4JMYN4KQJW.jpg)

CoreAIで約1000種類の花をオンデバイス識別する
Fumiya Yamanaka / @mtfum
iOSDC Japan 2026 ルーキーズLT
#iosdc #a 1 / 10


# Page. 2

![Page Image](https://bcdn.docswell.com/page/PJR9DWXK79.jpg)

作ったアプリ: 花AIカメラ
撮影するだけで種類を判別する
約1000種類を見分ける
完全オフライン
モデル
野草に強いPlantNet-300K / ResNet50
1081種類 ／ 98MB
園芸種に強い自前学習のMobileNetV4
119種類 ／ 33MB
1枚の写真を両方に通して、確信度の高いほうを採用
#iosdc #a 2 / 10


# Page. 3

![Page Image](https://bcdn.docswell.com/page/PEXQ1P65JX.jpg)

CoreAIとは？
Core AI is the inference framework powering on-device Apple Intelligence.
And now, it&#039;s available for you to use.
— WWDC26, Meet Core AI
AIモデルを 端末内のみで動かす仕組み
iOS 27の新機能（9/15リリース）
Apple Intelligenceを動かしているものが、そのまま開発者に開放された
端末内で完結する
全Apple Silicon — iOS / iPadOS / macOS / tvOS / visionOS / watchOS
#iosdc #a 3 / 10


# Page. 4

![Page Image](https://bcdn.docswell.com/page/3EK92D1RED.jpg)

Appleの実サンプル
apple/coreai-models で変換済みモデルが配布されている
音声
画像認識
画像生成
Whisper
SAM 3
Stable Diffusion
Wav2Vec 2.0
CLIP
FLUX.2
Depth Anything
v3
LLM
Gemma 3
Qwen3
Mistral
#iosdc #a 4 / 10


# Page. 5

![Page Image](https://bcdn.docswell.com/page/L73W4RQG75.jpg)

使い方
1. モデルの用意
2. PyTorch: .aimodel への変換
prog = TorchConverter().add_exported_program(
exported, input_names=[&quot;image&quot;], output_names=[&quot;logits&quot;]
).to_coreai()
prog.save_asset(path, metadata)
3. アプリで推論
let model: AIModel = try await AIModel(contentsOf: url)
let fn: InferenceFunction? = try model.loadFunction(named: &quot;main&quot;)
let x: NDArray = NDArray(scalars: chw, shape: shape)
let out: InferenceFunction.Outputs = try await fn!.run(inputs: [&quot;image&quot;: x])
#iosdc #a 5 / 10


# Page. 6

![Page Image](https://bcdn.docswell.com/page/87DKQY9NJG.jpg)

CoreMLとの違い
モデルが実行できる形になるまで
Core ML
Core AI
PyTorch ─▶ .mlpackage ─[コンパイル]─▶ .mlmodelc ─[配布]─▶ 実行
PyTorch ─▶ .aimodel ────[配布]────▶ 端末で実行コード生成 ─▶ 実行
実装で変わるところ
Core ML
Core AI
いつ実行形式になるか ビルド時
端末内
入力の型
画像 or NDArray
NDArray固定
推論の結果
「バラ 87%」まで出る NDArrayのみ
シミュレータ
動く
#iosdc #a 6 / 10


# Page. 7

![Page Image](https://bcdn.docswell.com/page/VJPKL6ZNE8.jpg)

specialization
その端末のチップとOSバージョン専用の実行コードを生成する工程
初回だけ実行され、結果は端末にキャッシュされる
条件
98MB インストール直後
98MB 2回目以降
33MB インストール直後
33MB 2回目以降
モデルの読み込み 関数の読み込み
AIModel(contentsOf:)
518〜705ms
5〜6ms
191ms
1ms
合計
loadFunction
78〜101ms 596〜806ms
214〜291ms 219〜297ms
10ms
201ms
37〜43ms 38〜44ms
Q. 初回の待ちを減らしたい？
A. AOT(ahead-of-time)コンパイルで重い処理をMac側に前倒しできる
#iosdc #a 7 / 10


# Page. 8

![Page Image](https://bcdn.docswell.com/page/2EVVQ3WYEQ.jpg)

まとめ
サーバーなしで、約1000種類の花を識別できた
写真は端末から出ない、圏外でも動く
CoreAIがやるのは「読んで、走らせる」まで。前後の処理が必要
モデルは使う人の端末で実行形式になる。初回だけ待ち、2回目からはキャッシュ
#iosdc #a 8 / 10


# Page. 9

![Page Image](https://bcdn.docswell.com/page/57GLW3DWEL.jpg)

自己紹介
名前: Fumiya Yamanaka
所属: 合同会社クウソウ
職業: Software Engineer
X: https://x.com/mtfum
GitHub: https://github.com/mtfum
#iosdc #a 9 / 10


# Page. 10

![Page Image](https://bcdn.docswell.com/page/4EQY351QJP.jpg)

参考リンク
WWDC26
Meet Core AI
Dive into Core AI model authoring and optimization
Integrate on-device AI models into your app using Core AI
ドキュメント / リポジトリ
Core AI ／ Specialization &amp; caching ／ AOT compile
apple/coreai-models
plantnet/PlantNet-300K — 使用した学習済みResNet50の出典
Thank you! — Fumiya Yamanaka / @mtfum
#iosdc #a 10 / 10


