Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
関モバ_20261009.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
こむぎ
October 13, 2026
8
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
関モバ_20261009.pdf
こむぎ
October 13, 2026
Transcript
21 slides
オンデバイスでSNSアイコンを作りたい こむぎ
大学生の頃 大のNotionファンだった 2
社会人となり Notion好きが集まるSNSを発見 名前は覚えてない… 3
そのSNSには おしゃれなアイコンが作れるサービスがあった https://notion-avatar.app/ja 4
こうなったら 画像生成で自分好みのアイコンにしたい!! 選択式で候補が絞られる 5
iOSで画像生成 有料のAPI Image Playground Core ML Core AI • 高品質
• 無料 • 無料かつカスタム可 • 無料かつカスタム可 • 高価格 • スタイルが限定 • モデルの性能が低い • モデルの性能が高い 6
Core AIとは 使いやすくなったCore ML …のようなもの Apple Intelligenceと同様の感覚で オンデバイスAIを組み込める https://developer.apple.com/jp/videos/play/wwdc2026/324/ 7
8
実は… CoreAIで画像生成のモデルがある ここ!! https://github.com/apple/coreai-models/tree/main/models 9
学習ロードマップ まずはApple配布モデルで試してみる Pytorch(AIフレームワーク)で自作モデルを作成して変換 モデルの最適化 バグが出たら専用のデバッガーで原因を特定 https://developer.apple.com/jp/core-ai/ 10
自作モデルのメリット スタイル・性能・サイズをカスタム可能 Apple推奨は 2GB以下 ゴージャスに イラストに FLUX.2 Sana Sprint カスタム
3〜4GB 5〜GB ?GB 11
モデル変換の手順 カスタム ?GB 学習用画像 https://huggingface.co/ モデル 12
学習用画像 全て画像生成を使用(746枚) 13
モデル選定 サイズ・LoRAを加味してSD1.5に決定 Base Model 幅広い画像を生成 LoRA アイコンに特化した 追加学習データ Customized Model
幅広いアイコン生成 14
トラブル① 形が歪む・ノイズが入る 原因 対策 •LoRAによりノイズ除去能力が落ちた •画像の平滑化 •学習用画像の追加 •各画素を一番近いパレット色に変更 15
トラブル② 別の物体と誤認識してしまう 原因 対策 •モデル性能の限界 •フラットなアイコンでは難しいテーマ •輪郭を描く専用のモデルを組み込む •GoogleのMaterial Symbolsを参考に 16
最適化(Python) import torch import torch.nn as nn from torch.export import
export class OptimizedCoreAIModel(nn.Module): def __init__(self): super().__init__() # ANEのfp16計算誤差を防ぐため、nn.Linearの代わりに1x1 Conv2dを使用 self.conv1x1 = nn.Conv2d(in_channels=256, out_channels=512, kernel_size=1) def forward(self, x): # [B, C, H, W]の形状で処理 return self.conv1x1(x) model = OptimizedCoreAIModel() example_input = torch.randn(1, 256, 1, 1) # Core AIの入り口となるPyTorch標準のエクスポート exported_program = export(model, (example_input,)) 17
最適化(Script) # ターミナルで事前コンパイルを実行し、キャッシュを生成 coreai-build --model MyModel.aimodel --target ios --architecture h18p
18
モデル読み込み(Swift) import CoreAI func runCoreAIModel() async { do { //
1. モデル構成の設定 let config = AIModelConfiguration() // 2. 非同期ロード(AOTコンパイル済みなら即時に完了) let model = try await AIModel.load(contentsOf: modelURL, configuration: config) // 3. 入力データの作成(Core AI特有のNDArrayを使用) let inputNDArray = NDArray(myInputData) // 4. 非同期での推論実行 let output = try await model.prediction(from: inputNDArray) print("推論完了: \(output)") } catch { print("Core AI ロードエラー: \(error)") } } 19
結果 デバッガーの話もしたいが今回はここまで… 20
参考資料 リポジトリ 奮闘記録 リポジトリ 21
More Decks by こむぎ
See All by こむぎ
WWDC現地参加のススメ
komugi
1
160
UIの観点から見るWidget実装
komugi
0
50
今日から始める!iOSエンジニア向け画像認識入門【実践編】
komugi
0
56
今日から始める!iOSエンジニア向け画像認識入門
komugi
0
90
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.6k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
48k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
810
Discover your Explorer Soul
emna__ayadi
2
1.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Practical Orchestrator
shlominoach
192
12k
Deep Space Network (abreviated)
tonyrice
0
410
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
980