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
こむぎ
October 13, 2026
9
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
57
今日から始める!iOSエンジニア向け画像認識入門
komugi
0
91
Featured
See All Featured
Scaling GitHub
holman
464
140k
The Cult of Friendly URLs
andyhume
79
7.1k
WCS-LA-2024
lcolladotor
0
1k
Visualization
eitanlees
153
17k
Claude Code のすすめ
schroneko
67
230k
Ruling the World: When Life Gets Gamed
codingconduct
0
450
Exploring anti-patterns in Rails
aemeredith
4
590
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
310
It's Worth the Effort
3n
188
30k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
480
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
590
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k