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
130
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
91
Softpia Japan Seminar 20190724
keiji
1
140
pixiv App Night 20190611
keiji
1
560
Other Decks in Technology
See All in Technology
Exadata Database Service on Cloud@Customer セキュリティ、ネットワーク、および管理について
oracle4engineer
PRO
0
1.1k
VPC間の接続方法を整理してみた #自治体クラウド勉強会
non97
1
970
軽量DDDはもういらない! スタイルガイド本で OOPの実装パターンを学ぼう
panda_program
12
3.4k
日経電子版におけるリアルタイムレコメンドシステム開発の事例紹介/nikkei-realtime-recommender-system
yng87
2
610
初心者に Vue.js を 教えるには
tsukuha
5
400
運用イベント対応への生成AIの活用 with Failure Analysis Assistant
suzukyz
0
160
Amazon_CloudWatch_ログ異常検出_導入ガイド
tsujiba
4
1.7k
Forget efficiency – Become more productive without the stress
ufried
0
170
バクラクにおける可観測性向上の取り組み
yuu26
3
440
Gradle: The Build System That Loves To Hate You
aurimas
2
170
Vueで Webコンポーネントを作って Reactで使う / 20241030-cloudsign-vuefes_after_night
bengo4com
4
2.5k
家具家電付アパートの冷蔵庫をIoT化してみた!
scbc1167
0
130
Featured
See All Featured
Ruby is Unlike a Banana
tanoku
96
11k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Unsuck your backbone
ammeep
668
57k
Documentation Writing (for coders)
carmenintech
65
4.4k
What's new in Ruby 2.0
geeforr
343
31k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
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. ຊࢿྉɺ༗ݶձࣾγʔϦεͷஶ࡞Ͱ͢ɻܝࡌ͞Ε͍ͯΔΠϥετʹݸผʹஶ࡞ݖ͕͋Γ·͢ɻ ຊࢿྉͷશ෦ɺ·ͨҰ෦ʹ͍ͭͯɺஶ࡞ऀ͔ΒจॻʹΑΔڐΛಘͣʹෳ͢Δ͜ͱې͡ΒΕ͍ͯ·͢ɻ ໊֤ɾϒϥϯυ໊ɺձ໊ࣾͳͲɺҰൠʹ֤ࣾͷඪ·ͨొඪͰ͢ɻຊࢿྉதͰɺɺɺäΛׂѪͯ͠ ͍·͢ɻ