Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP Kansai 2013 LT
Search
Hideo Hattori
June 01, 2013
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHP Kansai 2013 LT
php-otama
Hideo Hattori
June 01, 2013
More Decks by Hideo Hattori
See All by Hideo Hattori
gocloc
hhatto
0
580
RustとPython
hhatto
4
2.7k
PyCon APAC 2013 LT
hhatto
0
88
Other Decks in Programming
See All in Programming
初めての模倣学習とVLA
natsutan
0
220
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
280
「人を評価する AI」の設計と実装
ryoyanara
0
240
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
19k
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
370
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
540
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
370
VibeCodingからAgenticWorkflowへ
starfish719
0
820
My Marp Sample
sinoue0108
0
110
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
570
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Evolving SEO for Evolving Search Engines
ryanjones
0
260
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
660
Game over? The fight for quality and originality in the time of robots
wayneb77
1
250
Faster Mobile Websites
deanohume
310
32k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
400
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Transcript
OTAMA あるPHP拡張のお話 PHPカンファレンス関西2013 / HIDEO HATTORI
自己紹介 , , PHPがっつり使ったのはここ1年程度 CとかPythonとかZshとかが好き アプリケーション開発とか運営とかし ています Hideo Hattori @hhatto
Github Bitbucket
今日話すこと CBIRって? php-otamaの紹介
OTAMAとは いわゆるひとつのCBIR(Content-based image retrieval) 画像同士の類似度を出力できる 画像をクエリに画像が検索できる https://github.com/nagadomi/otama
OTAMAPYとは otamaのPythonインターフェース PythonのC拡張でotamaライブラリをた たけるようにしたもの https://github.com/hhatto/otamapy
得意な亊 CとかPython CとかPython CとかPython CとかPython CとかPython CとかPython CとかPython CとかPython
ある日言われました 「もう少しPHPにも興味持ってください よ」と。
興味ないわけじゃないよ!! 得意な亊(C/Python) × PHP = PHP拡張モジュールを書こう!!
PHP-OTAMAとは otamaのPHPインターフェース いわゆるPHP拡張モジュール
使い方(類似度を求める) lena.jpg lena-affine.jpg
使い方(類似度を求める) 設定ファイル(otama.conf) {'driver': {'name': 'vlad_nodb'}}
使い方(類似度を求める) Python 実行結果 from otama import Otama db = Otama()
db.open('./otama.conf') filename1 = 'images/lena.jpg' filename2 = 'images/lena-affine.jpg' print(db.similarity({'file': filename1}, {'file': filename2})) 0.362881481647
使い方(類似度を求める) PHP 実行結果 $db = new Otama(); $db->open("./otama.conf"); $filename1 =
"images/lena.jpg"; $filename2 = "images/lena-affine.jpg"; var_dump($db->similarity($filename1, $filename2)); double(0.36288148164749)
使い方(類似画像を検索) 設定ファイル(otama.conf) { 'namespace': 'testnamespace', 'driver': {'name': 'color', 'data_dir': './data',
'color_weight': 0.2}, 'database': {'driver': 'sqlite3', 'name': './data/otama.sqlite3'} }
使い方(類似画像を検索) Python import os from glob import glob from otama
import Otama db = Otama.open('test.conf') db.create_table() files = glob('images/*.jpg') + glob('images/*.png') kvs = {} for filename in files: kvs[db.insert(filename)] = filename db.pull() for result in db.search(5, 'lena.jpg'): print("file=%s, sim=%f" % (kvs[result['id']], result['similarity']))
使い方(類似画像を検索) 実行結果 file=image/lena.jpg, sim=1.000000 file=image/lena-768x768.jpg, sim=0.968963 file=image/lena-affine.jpg, sim=0.770081 file=image/lena-rotate.jpg, sim=0.747762
file=image/baboon.png, sim=0.303697
使い方(類似画像を検索) PHP まだ使えません!!
絶賛開発中 Pull-Requestお待ちしてます!! php-otama
参考資料 PHP Extension を作ろう第1回 - まず は Hello World 30分でわかる
PHP Extensionの作り方 を学べる記事をかいたよー \(^o^)/ mongo-php-driver php-memcached
ご清聴ありがとうございまし た!! m(_ _)m