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.5k
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
120
DroidKaigi 2023
keiji
0
1.4k
TechFeed Conference 2022
keiji
0
210
Android Bazaar and Conference Diverse 2021 Winter
keiji
0
820
ci-cd-conference-2021
keiji
1
1.2k
Android Bazaar and Conference 2021 Spring
keiji
3
740
TFUG KANSAI 20190928
keiji
0
89
Softpia Japan Seminar 20190724
keiji
1
140
pixiv App Night 20190611
keiji
1
550
Other Decks in Technology
See All in Technology
小さな勉強会の始め方、広げ方、あるいは友達の作り方 / How to Start, Grow, and Build Connections with Small Study Groups
ar_tama
2
1.3k
リスクから学ぶKubernetesコンテナセキュリティ/k8s-risk-and-security
mochizuki875
1
280
【shownet.conf_】革新と伝統を融合したファシリティ
shownet
PRO
0
250
XPを始める新人に伝えたい近道の鍵
nakasho
1
270
VS CodeでF1〜12キーつかってますか? / Do you use the F1-12 keys in VS Code?
74th
2
280
Rubyはなぜ「たのしい」のか? / Why is Ruby a programmers' best friend? #tqrk15
expajp
4
1.7k
OPENLOGI Company Profile for engineer
hr01
1
12k
DenoでもViteしたい!インポートパスのエイリアスを指定してラクラクアプリ開発
bengo4com
1
1.7k
入門 バックアップ
ryuichi1208
17
5.1k
k6を活用した再現性・拡張性の高い負荷試験基盤の構築
biwashi
11
3k
エムスリー全チーム紹介資料 / Introduction of M3 All Teams
m3_engineering
1
230
【shownet.conf_】コンピューティング資源を統合した分散コンテナ基盤の進化
shownet
PRO
0
300
Featured
See All Featured
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.9k
Producing Creativity
orderedlist
PRO
341
39k
From Idea to $5000 a Month in 5 Months
shpigford
380
46k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
6
230
Done Done
chrislema
181
16k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
230
17k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Speed Design
sergeychernyshev
22
470
Designing with Data
zakiwarfel
98
5.1k
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. ຊࢿྉɺ༗ݶձࣾγʔϦεͷஶ࡞Ͱ͢ɻܝࡌ͞Ε͍ͯΔΠϥετʹݸผʹஶ࡞ݖ͕͋Γ·͢ɻ ຊࢿྉͷશ෦ɺ·ͨҰ෦ʹ͍ͭͯɺஶ࡞ऀ͔ΒจॻʹΑΔڐΛಘͣʹෳ͢Δ͜ͱې͡ΒΕ͍ͯ·͢ɻ ໊֤ɾϒϥϯυ໊ɺձ໊ࣾͳͲɺҰൠʹ֤ࣾͷඪ·ͨొඪͰ͢ɻຊࢿྉதͰɺɺɺäΛׂѪͯ͠ ͍·͢ɻ