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
ChainerとAnnoyを使った 類似画像検索
Search
takaaki shimbo
August 29, 2018
Technology
940
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ChainerとAnnoyを使った 類似画像検索
Qiita:
https://qiita.com/ta7uwtaka/items/9301eef7dd74a249d5ea
takaaki shimbo
August 29, 2018
Other Decks in Technology
See All in Technology
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
4
620
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
170
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.3k
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
200
Local CI × GitHub Actions
gogutan
3
230
WasmをRustにする
sansantech
PRO
0
290
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
1k
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
120
PHPカンファレンス関西の招待状 / Invitation to PHP Conference Kansai
ykanoh
0
210
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
350
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
310
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
630
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
From π to Pie charts
rasagy
1
400
Odyssey Design
rkendrick25
PRO
2
880
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Balancing Empowerment & Direction
lara
6
1.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Become a Pro
speakerdeck
PRO
31
6.3k
My Coaching Mixtape
mlcsv
0
360
Design in an AI World
tapps
1
350
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
480
Transcript
Chainer ͱAnnoyΛͬͨ ྨࣅը૾ݕࡧ ʙɹ͘͘Ռൃද + هɹʙ Shimbo Takaaki 2018 /
08 / 25 @Chainer mokumoku #2
ࣗݾհ • ໊લɿɹ৽อɹᠳཅ • 4݄͔Βࣾձਓ (ERPͷձࣾ ) • Twitter: @ta7uw
• GitHub: @takaaki82 • Qiita: https://qiita.com/ta7uwtaka
ྨࣅը૾ݕࡧͱ • ಛϕΫτϧ Ͱදݱ͞Εͨը૾ʹ͍ۙը૾Λ σʔλϕʔεͷத͔Β୳͢͜ͱ • σʔλϕʔεͷͯ͢ͷը૾ͱྨࣅΛൺֱ͠ ͍ͯΔͱେͳܭࢉྔʹͳΓ͕͔͔࣌ؒΔͷ ͰɺޮΑ͘ࣅ͍ͯΔը૾Λ୳ͩ͢͜͠ͱ͕ ٻΊΒΕΔɻ
Pinterest
Approach • ը૾ಛྔͷྨࣅܭࢉ ը૾͔ΒCNNͳͲͰಛྔΛநग़͠ɺίαΠϯྨࣅͳͲͷؔʹΑͬ ͯྨࣅܭࢉΛߦ͏͜ͱͰը૾ͷྨࣅΛٻΊΔ → ࠓճͪ͜ΒΛ࣮͢Δ • Deep LearningΛͬͨྨࣅֶश
ࣅ͍ͯΔը૾Ͱ͋Εɺྨࣅ͕େ͖ͳΔΑ͏ʹଛࣦΛઃఆֶͯ͠शΛ ߦ͏
ߏ ɾը૾ಛྔநग़ ֶशࡁΈը૾ೝࣝϞσϧͷதؒΛ͏ → Chainer ɾಛྔͷྨࣅܭࢉ ۙࣅ࠷ۙ୳ࡧ(ANN)Λ͏ → Annoy
ۙࣅ࠷ۙ୳ࡧϥΠϒϥϦ Annoy
Annoy • ࠷ۙ୳ࡧ(ANN)Λ࣮ͨ͠ϥΠϒϥϦ • Spotify͕։ൃ͢ΔOSS • ԻָͷϨίϝϯυػೳʹΘΕ͍ͯΔ • C++࣮ɹ-> PythonόΠϯσΟϯά
• PythonͰ؆୯ʹ͑Δ
MNISTͰྨࣅը૾Λ୳ͯ͠ΈΔ ݕࡧʹ ͬͨը૾
CIFAR-10ͷֶश • ࠓճσʔληοτʹCIFAR-10Λ༻͍Δ • ௨ৗͷը૾ྨͱಉ༷ʹChainerͰֶशΛߦ͏ • ֶशΛߦͬͨϞσϧΛಛྔநग़ʹ͏
ಛྔΛAnnoyʹՃ from annoy import AnnoyIndex train, test = chainer.datasets.get_cifar10() dim
= 1024 #தؒͷग़ྗͷཁૉ annoy_model = AnnoyIndex(dim) with chainer.using_config('train', False), chainer.using_config('enable_backprop', False): for i in range(len(train)): img, _ = train[i] # numpy -> cupy x = model.xp.asarray(img[None, ...]) # ֶशσʔλͷਪ݁Ռͷ͏ͪը૾ྨϞσϧͷ̍̌ͷग़ྗΛಘΔ x = get_hidden(model ,9 ,x=x).data x = x.reshape(-1) #cupy -> numpy x = chainer.cuda.to_cpu(x) annoy_model.add_item(i, x) # AnnoyϞσϧͷϏϧυ(ҎޙσʔλͷՃߦ͑ͳ͍) annoy_model.build(1000) annoy_model.save("cifar-10-1000tree.ann")
ۙࣅ࠷ۙ୳ࡧͷ࣮ߦ x = model.xp.asarray(x[None, …]) x = get_hidden(model ,9 ,x=
x).data x = x.reshape(-1) x = chainer.cuda.to_cpu(x) # ಛϕΫτϧxΛΘͨ͢ͱɺྨࣅܭࢉΛߦ͍ɺྨࣅͷେ͖͍ͷΛฦ͢ɹɹɹɹɹɹɹɹɹɹɹ predict_indexes = annoy_model.get_nns_by_vector(x, 5, search_k=-1)
݁Ռ ը૾ΫΤϦ
ը૾ΫΤϦ
·ͱΊ • Chainerͱۙࣅ࠷ۙ୳ࡧϥΠϒϥϦAnnoyΛ ͏ͱྨࣅը૾ݕࡧͰ͖Δ • ࣍Deep LearningͷྨࣅֶशΛͬͨྨ ࣅը૾ݕࡧΛ࣮ͯ͠ΈΔ
ࢀߟ • Start Today Technologies TECH BLOG (https://tech.starttoday-tech.com/entry/detection_and_retrieval) • ݪాୡ
(2017) , ը૾ೝࣝɹػցֶशϓϩϑΣογϣφϧ γϦʔζ • Deep metric learning using Triplet network (https://arxiv.org/pdf/1412.6622.pdf)
ৄࡉQiitaʹॻ͖·ͨ͠ɻ Α͔ͬͨΒͲ͏ͧ Qiita
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠