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
20160928-meganeco
Search
ARIYAMA Keiji
September 28, 2016
Technology
2
3.6k
20160928-meganeco
「TensorFlowで趣味の画像収集サーバーを作る9月特大号」
TensorFlowによる認識処理の高速化と新データセットでの訓練・評価検証
ARIYAMA Keiji
September 28, 2016
Tweet
Share
More Decks by ARIYAMA Keiji
See All by ARIYAMA Keiji
Build with AI
keiji
0
140
DroidKaigi 2023
keiji
0
1.5k
TechFeed Conference 2022
keiji
0
220
Android Bazaar and Conference Diverse 2021 Winter
keiji
0
830
ci-cd-conference-2021
keiji
1
1.2k
Android Bazaar and Conference 2021 Spring
keiji
3
750
TFUG KANSAI 20190928
keiji
0
92
Softpia Japan Seminar 20190724
keiji
1
150
pixiv App Night 20190611
keiji
1
560
Other Decks in Technology
See All in Technology
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
170
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
590
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
380
dev 補講: プロダクトセキュリティ / Product security overview
wa6sn
1
2.3k
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
Can We Measure Developer Productivity?
ewolff
1
150
Lexical Analysis
shigashiyama
1
150
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
Featured
See All Featured
Building an army of robots
kneath
302
43k
Making Projects Easy
brettharned
115
5.9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
The Invisible Side of Design
smashingmag
298
50k
The Language of Interfaces
destraynor
154
24k
How GitHub (no longer) Works
holman
310
140k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Transcript
C-LIS CO., LTD.
5FOTPS'MPXͰ झຯͷը૾ऩूαʔόʔΛ࡞Δ ݄̕ಛେ߸
C-LIS CO., LTD. ༗ࢁܓೋʢ,FJKJ"3*:"."ʣ C-LIS CO., LTD. AndroidΞϓϦ։ൃऀ ػցֶशॳ৺ऀ
ͬͯ·ͤΜ 1IPUP,PKJ.03*(6$)* "6/$3&"5*7&'*3.
C-LIS CO., LTD.
C-LIS CO., LTD.
લճ·Ͱͷ͓
IUUQTUFDICPPLGFTUPSH"
C-LIS CO., LTD.
C-LIS CO., LTD. IUUQBN[OUPC,3N
C-LIS CO., LTD. .FHBOF /PU
Έͷ؟ڸ່ͬը૾ΛࣗಈͰऩू͍ͨ͠
C-LIS CO., LTD. Ϟσϧ 7((/FUΛࢀߟʹΈࠐΈͷ࿈ଓΛ༻͍ͨ$// ʢ$POWPMVUJPOBM/FVSBM/FUXPSLʣϞσϧ DPO YY DPO
YY GD QPPM Y DPO YY DPO YY QPPM Y GD GD PVUQVU
C-LIS CO., LTD. %BUB"VHNFOUBUJPO ը૾Λ ʜ·ͰɺͦΕͧΕճసͨ͠ը૾Λ࡞ ಡΈࠐΈ࣌ͷॲཧ 3BOEPN$SPQʢQYதɺQYྖҬΛ͘Γൈ͘ʣ 3BOEPN'MJQʢԣ࣠ํʹసʣ
3BOEPN6Q%PXOʢॎ࣠ํʹసʣ 3BOEPN#SJHIUOFTT 3BOEPN$POUSBTU
C-LIS CO., LTD. ܇࿅ ֶशΞϧΰϦζϜ"EBN ֶश ϛχόον
C-LIS CO., LTD. ݕূ σʔληοτ͔ΒΛςετ༻ͱͯ͠ ਖ਼ʙ
Πϥετإݕग़ثʢ'BDF%FUFDUPSʣ
C-LIS CO., LTD. Πϥετإσʔληοτ ؟ڸ່ͬͱͦ͏Ͱͳ͍ͷɻ߹Θͤͯ ຕΛ ਖ਼ྫʢʹإʣͱ͢Δʢ͏ͪςετσʔλຕʣ ෛྫɺطଘͷը૾ΛࡉΕʹͯ͠ɺإ͕ͳ͍෦ ຕΛෛྫͱ͢Δʢ͏ͪςετσʔλຕʣ
C-LIS CO., LTD. Πϥετσʔληοτ ਖ਼ྫ ෛྫ ߹ܭ ܇࿅σʔλ 1,600
3,200 4,800 ςετσʔλ 400 800 1,200 ߹ܭ 2,000 4,005 6,000
C-LIS CO., LTD. Ϟσϧ $*'"3νϡʔτϦΞϧͷϞσϧΛࢀߟʹ υϩοϓΞτʢˋʣΛՃͨ͠$//ʢ$POWPMVUJPOBM/FVSBM /FUXPSLʣ DPO YY
GD QPPM Y DPO YY GD PVUQVU MSO MSO QPPM Y
C-LIS CO., LTD. %BUB"VHNFOUBUJPO ը૾Yʹॖখ ը૾Λ ʜɺͦΕͧΕճసͨ͠ը૾Λ࡞ ಡΈࠐΈ࣌ͷॲཧ 3BOEPN$SPQʢQYதɺQYྖҬͰ͘Γൈ͘ʣ
3BOEPN'MJQʢԣ࣠ํʹసʣ 3BOEPN6Q%PXOʢॎ࣠ํʹసʣ 3BOEPN#SJHIUOFTT 3BOEPN$POUSBTU
C-LIS CO., LTD. ܇࿅ ֶशΞϧΰϦζϜ"EBN ֶश ϛχόον
C-LIS CO., LTD. ܇࿅ ϛχόονɺສεςοϓͷ܇࿅Ͱ ϩε͕·ͰԼ ςετσʔλͰͷਖ਼ղ
إݕग़
C-LIS CO., LTD. إͲ͜ʹ͋Δʁ
C-LIS CO., LTD. 4FMFDUJWF4FBSDI 35$PSQPSBUJPOͷʮ༲͛ϩϘοτʯ 5FOTPS'MPXษڧձʢ̐ʣ݄Ͱൃද IUUQXXXTMJEFTIBSFOFU:VLJ/BLBHBXBUFOTPSqPXSFW
C-LIS CO., LTD. 4FMFDUJWF4FBSDI "MQBDBࣾʹΑΔ࣮ IUUQCMPHKQBMQBDBBJFOUSZ EMJCͷ࣮ IUUQTHJUIVCDPNEBWJTLJOHEMJCCMPCNBTUFS QZUIPO@FYBNQMFTpOE@DBOEJEBUF@PCKFDU@MPDBUJPOTQZ
C-LIS CO., LTD. લճͷ՝ ݕग़࣌ؒͷॖ ೝࣝਫ਼ͷ্
ݕग़࣌ؒͷॖ
C-LIS CO., LTD. إݕग़ͷखॱ ީิྖҬͷΓग़͠ SelectiveSearch
C-LIS CO., LTD. إݕग़ͷखॱ إೝࣝ TensorFlow ީิྖҬͷΓग़͠ SelectiveSearch OݸͷީิྖҬ
C-LIS CO., LTD. άϥϑͱηογϣϯΛҙࣝ͢Δ ީิྖҬͷΓग़͠ SelectiveSearch إೝࣝ TensorFlow άϥϑͷ࡞
ηογϣϯͷ։࢝ tf.Session() άϥϑͷ࣮ߦ run OݸͷީิྖҬ ը૾σʔλʴ ը૾σʔλ
C-LIS CO., LTD. إೝࣝ TensorFlow άϥϑͱηογϣϯΛҙࣝ͢Δ άϥϑͷ࡞ ηογϣϯͷ։࢝ tf.Session()
άϥϑͷ࣮ߦ run άϥϑ Ϧηοτ OݸͷྖҬΛͯ͢ධՁ OݸͷީิྖҬ ը૾σʔλʴ
C-LIS CO., LTD. ࠷దͳྖҬΛ୳ࡧʢ3FHSFTTJPOʣ
C-LIS CO., LTD. إೝࣝ TensorFlow ຖճάϥϑΛ࡞ɾηογϣϯΛ։࢝ άϥϑͷ࡞ ηογϣϯͷ։࢝ άϥϑͷ࣮ߦ
run άϥϑ Ϧηοτ OݸͷྖҬΛͯ͢ධՁ OݸͷީิྖҬ ը૾σʔλʴ
class FaceDetector(object): image_path = None original_image = None graph
= None sess = None queue = None top_k_indices = None top_k_values = None region_batch = None coord = None configuration = None def __init__(self, image_path, batch_size, train_dir): self.image_path = image_path self.original_image = Image.open(image_path) self.original_image = self.original_image.convert('RGB') checkpoint = tf.train.get_checkpoint_state(train_dir) if not (checkpoint and checkpoint.model_checkpoint_path): print('νΣοΫϙΠϯτϑΝΠϧ͕ݟ͔ͭΓ·ͤΜ') return self.graph, self.queue, self.top_k_indices, self.top_k_values, self.region_batch = \ self._init_graph(self.original_image, batch_size) with self.graph.as_default() as g: self.sess = tf.Session() saver = tf.train.Saver() saver.restore(self.sess, checkpoint.model_checkpoint_path) self.coord = tf.train.Coordinator()
def _init_graph(self, image, batch_size): reshaped_image = np.array(image.getdata()).reshape(image.height, image.width, 3).astype(
np.float32) graph = tf.Graph() with graph.as_default() as g: queue = tf.FIFOQueue(3000, tf.int32, shapes=[4]) region = queue.dequeue() whitten_image = self._load_image(reshaped_image, region) image_batch, region_batch = tf.train.batch( [whitten_image, region], batch_size=batch_size, capacity=10000) logits = tf.nn.softmax(model.inference(image_batch, tf.constant(1.0), batch_size)) top_k_values, top_k_indices = tf.nn.top_k(logits, 2, sorted=True) return graph, queue, top_k_indices, top_k_values, region_batch
def _eval(self, region_list, batch_size): result = [] with
graph.as_default() as g: threads = tf.train.start_queue_runners(sess=sess, coord=coord) step = 0 try: # όοναΠζʹ߹ΘͤͯΛௐ while len(region_list) < batch_size or len(region_list) % batch_size != 0: add = region_list[0:(batch_size - (len(region_list) % batch_size))] region_list = region_list + add region_list = np.array(region_list) enqueue = queue.enqueue_many(region_list) sess.run(enqueue) num_iter = int(math.ceil(len(region_list) / batch_size)) while step < num_iter and not coord.should_stop(): # ҎԼུ
C-LIS CO., LTD. إೝࣝ TensorFlow ީิྖҬͷΈ༩͑Δ άϥϑͷ࡞ ηογϣϯͷ։࢝ άϥϑͷ࣮ߦ
run άϥϑ Ϧηοτ OݸͷྖҬΛͯ͢ධՁ ը૾σʔλ OݸͷީิྖҬ
ೝࣝਫ਼ͷ্ σʔληοτͷ֦ॆ
C-LIS CO., LTD. 5XJUUFS"1* ಛఆͷϢʔβʔͷλΠϜϥΠϯʹߘ͞ΕͨϝσΟΞ ʢը૾ʣΛμϯϩʔυ ϋογϡΛܭࢉͯ͠ॏෳը૾ΛϑΟϧλϦϯά ʢαΠζҧ͍ͳͲͷྨࣅը૾ফ͖͠Εͳ͍ʣ
C-LIS CO., LTD. Πϥετإσʔλऩूʹ ࠷దͳΞΧϯτ !CPU@FSFDUJPO IUUQTUXJUUFSDPNCPU@FSFDUJPO
C-LIS CO., LTD. ࿐ࠎʹੑతͳը૾ɺ΄΅ଘࡏ͠ͳ͍ πΠʔτʹඞͣը૾͕ఴ͞Ε͍ͯΔ ը૾ʹਓҎ্ͷঁͷࢠͷإؚ͕·Ε͍ͯΔ
5XJUUFS͔Βऔಘͨ͠ϑΝΠϧ ݕग़ͨ͠إྖҬͷɹɹɹɹɹɹɹɹ
C-LIS CO., LTD. { "detected_faces": { "mode": "selective_search", "regions": [
{ "label": 1, "rect": { "left": 212.0, "bottom": 654.0, "top": 94.0, "right": 483.0 }, "probability": 0.9994481205940247 } ] }, "created_at": "2016-09-28T03:37:16.223942", "file_name": "kage_maturi-CAARxE8UwAEzAjJ.jpg", "generator": "Megane Co" } ݁ՌΛ+40/Ͱॻ͖ग़͠
C-LIS CO., LTD. 3FHJPO$SPQQFS +BWB'9 ,PUMJO IUUQTHJUIVCDPNLFJKJSFHJPO@DSPQQFS
%FNP
C-LIS CO., LTD. 3FHJPO$SPQQFS /FXGFBUVSF ɾબதͷྖҬΛϑΥʔΧε ɾ6OEP ɾTFUUJOHTKTPOʹΑΔઃఆ ɹϥϕϧ͝ͱͷઢ৭ ɹฤूɺআͷՄ൱
IUUQTHJUIVCDPNLFJKJSFHJPO@DSPQQFS
C-LIS CO., LTD. ݕग़ͨ͠إྖҬͷʢॏෳΛআʣɹɹɹɹɹɹɹɹ إʢਖ਼ྫʣ ޡݕग़ʢෛྫʣ
C-LIS CO., LTD. ৽σʔληοτ ਖ਼ྫ ෛྫ ߹ܭ ܇࿅σʔλ 10,453
10,792 21,245 ςετσʔλ 2,619 2,703 5,322 ߹ܭ 13,072 13,495 26,567
C-LIS CO., LTD. ৽σʔληοτʹΑΔ܇࿅ ϛχόονɺສεςοϓͷ܇࿅Ͱ ϩε͕·ͰԼ ςετσʔλʹΑΔݕূͰͷਖ਼ղ
C-LIS CO., LTD. چσʔληοτ ਖ਼ྫ ෛྫ ߹ܭ ܇࿅σʔλ 1,600
3,200 4,800 ςετσʔλ 400 800 1,200 ߹ܭ 2,000 4,005 6,000
C-LIS CO., LTD. چσʔληοτͷ܇࿅ ϛχόονɺສεςοϓͷ܇࿅Ͱ ϩε͕·ͰԼ ςετσʔλͰͷݕূͰͷਖ਼ղ
C-LIS CO., LTD. ৽Ϟσϧੑೳ͕ѱ͍ʁ چςετσʔλ چϞσϧ ৽ςετσʔλ ৽Ϟσϧ
C-LIS CO., LTD. ৽چͷςετσʔλΛަ چϞσϧ ৽ςετσʔλ چςετσʔλ ৽Ϟσϧ
C-LIS CO., LTD. ৽چͷςετσʔλΛݕূ چϞσϧ ৽ςετσʔλ چςετσʔλ ৽Ϟσϧ
چςετσʔλ چϞσϧ ৽ςετσʔλ ৽Ϟσϧ
C-LIS CO., LTD. إೝࣝʹࣦഊͨ͠σʔλΛݕূ ʢچςετσʔλʣ OPU@GBDF GBDF
C-LIS CO., LTD. إೝࣝʹࣦഊͨ͠σʔλΛݕূ ʢ৽ςετσʔλʣ OPU@GBDF GBDF
࣍ճ༧ࠂ
C-LIS CO., LTD. σʔλͷΫϨϯδϯάʹΑΔೝࣝਫ਼ͷมԽΛݟΔ ݕग़Λ͞Βʹվળ͢Δ ࣍ճ༧ࠂ IUUQTXXXTBLVSBBEKQLPVLBSZPLV
C-LIS CO., LTD. C-LIS CO., LTD. ຊࢿྉɺ༗ݶձࣾγʔϦεͷஶ࡞Ͱ͢ɻܝࡌ͞Ε͍ͯΔΠϥετʹݸผʹஶ࡞ݖ͕͋Γ·͢ɻ ຊࢿྉͷશ෦ɺ·ͨҰ෦ʹ͍ͭͯɺஶ࡞ऀ͔ΒจॻʹΑΔڐΛಘͣʹෳ͢Δ͜ͱې͡ΒΕ͍ͯ·͢ɻ ໊֤ɾϒϥϯυ໊ɺձ໊ࣾͳͲɺҰൠʹ֤ࣾͷඪ·ͨొඪͰ͢ɻຊࢿྉதͰɺɺɺäΛׂѪͯ͠ ͍·͢ɻ