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
ML Ops Study 2
Search
ARIYAMA Keiji
May 29, 2018
Technology
0
130
ML Ops Study 2
5月29日にクックパッド株式会社で開催されたML Ops Study #2の発表資料です。
ARIYAMA Keiji
May 29, 2018
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
90
Softpia Japan Seminar 20190724
keiji
1
140
pixiv App Night 20190611
keiji
1
560
Other Decks in Technology
See All in Technology
サイバーエージェントにおける生成AIのリスキリング施策の取り組み / cyber-ai-reskilling
cyberagentdevelopers
PRO
2
190
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
1
550
CyberAgent 生成AI Deep Dive with Amazon Web Services / genai-aws
cyberagentdevelopers
PRO
1
480
プロダクト成長に対応するプラットフォーム戦略:Authleteによる共通認証基盤の移行事例 / Building an authentication platform using Authlete and AWS
kakehashi
1
150
신뢰할 수 있는 AI 검색 엔진을 만들기 위한 Liner의 여정
huffon
0
290
一休.comレストランにおけるRustの活用
kymmt90
3
580
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
3
320
大規模データ基盤チームのオンプレTiDB運用への挑戦 / dpu-tidb
cyberagentdevelopers
PRO
1
110
10分でわかるfreeeのQA
freee
1
3.4k
君は隠しイベントを見つけれるか?
mujyun
0
280
ガバメントクラウド先行事業中間報告を読み解く
sugiim
1
1.2k
VPC間の接続方法を整理してみた #自治体クラウド勉強会
non97
1
800
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
290
A Tale of Four Properties
chriscoyier
156
23k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Adopting Sorbet at Scale
ufuk
73
9k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
For a Future-Friendly Web
brad_frost
175
9.4k
Testing 201, or: Great Expectations
jmmastey
38
7k
Music & Morning Musume
bryan
46
6.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
Transcript
C-LIS CO., LTD.
.-0QT4UVEZ BUΫοΫύουגࣜձࣾ 5FOTPS'MPXͷ܇࿅ࡁΈϞσϧΛ "OESPJEΞϓϦʹࡌͤΔͱ͖ʹ ۤ࿑ͨ͠ 5FOTPS'MPXͰझຯͷը૾ऩूαʔόʔΛ࡞Δ݄߸
C-LIS CO., LTD. ༗ࢁܓೋʢ,FJKJ"3*:"."ʣ $-*4$0 -5% Photo :
Koji MORIGUCHI (MORIGCHOWDER) "OESPJEΞϓϦ։ൃνϣοτσΩϧ ػցֶशͪΐͬͱͬͨ͜ͱ͋Γ·͢
C-LIS CO., LTD.
C-LIS CO., LTD. ͬ
ຊ൪ڥͷೖܦݧ͕ඞཁͳΒ ೖͯ͠͠·͍͍͑͡Όͳ͍
؟ ڸ ͬ ່ ࠜઇΕ͍
Έͷ؟ڸ່ͬը૾Λ ࣗಈͰऩू͍ͨ͠
̎Ϋϥεྨ 1 0
ݱࡏͷγεςϜ
ධՁ༻ αʔόʔ ܇࿅ɾֶश༻αʔόʔ σʔληοτసૹ ʢTFRecordʣ ֶशࡁΈ ύϥϝʔλʔऔಘ ը૾औಘ
ը૾औಘ ϥϕϧ ͚ σʔληοτཧ αʔόʔ σʔλऩूݩ αʔϏε ը૾औಘ ϥϕϧ ͚ Android ΞϓϦ
σʔληοτཧαʔόʔ $16"UISPO/FP()[ .FNPSZ(# 4UPSBHF44%(# )%%5# 3"*%
σʔληοτཧαʔόʔͷׂ ը૾σʔλͷऩू ϝλσʔλʢΞϊςʔγϣϯɾϥϕϧʣͷཧ "1*ͷఏڙ ֶश༻σʔλʢ5'3FDPSEʣͷੜ
ը૾σʔλͷऩू
ϝλσʔλͷཧ
ϝλσʔλͷཧ label: 2 left: 283 top: 190 right:
435 bottom:301 = 1.0
ϥϕϧͷछྨ PSJHJOBM@BSU OTGX GBWPSJUF QIPUP JMMVTU DPNJD GBDF
GFNBMF NFHBOF TDISPPM@VOJGPSN CMB[FS@VOJGPSN TBJMPS@VOJGPSN HM LFNPOP NBMF CM DBU EPH GPPE EJTMJLF
"1*ͷఏڙ ը૾Ϧετͷऔಘ ը૾ͷऔಘ ը૾ͷݕࡧʢϥϕϧʣ ϥϕϧͷઃఆ ϥϕϧະઃఆը૾ͷϦετΛऔಘ σʔλऔಘݩ5XJUUFS*%ͷՃɾআ
ֶश༻σʔλͷੜ 5'3FDPSEܗࣜPS+1&( $47ܗࣜ ը૾ͷϦαΠζ͜ͷஈ֊Ͱߦ͏ʢτϥϑΟοΫΛݮ $ python ./create_dataset.py \
--base_dir /dataset/source/ \ --output_dir ~/tfrecords_classifier \ --image_size 256 \ --tag_names megane,nsfw,favorite,illust
σʔλͷάϧʔϓԽ 0 1 2 3 4 5 6
7 8 9 σʔληοτ ςετσʔληοτ
ධՁ༻ αʔόʔ ܇࿅ɾֶश༻αʔόʔ σʔληοτసૹ ʢTFRecordʣ ֶशࡁΈ ύϥϝʔλʔऔಘ ը૾औಘ
ը૾औಘ ϥϕϧ ͚ σʔληοτཧ αʔόʔ σʔλऩूݩ αʔϏε ը૾औಘ ϥϕϧ ͚ Android ΞϓϦ
ֶश༻αʔόʔ
{ "tag_name": "megane", "train_catalog_numbers": "0,1,2,3,4,5,6,7,8", "eval_catalog_numbers": "9", "data_augmentation": { "random_crop":
false, "random_colorize": true } } ֶश༻ͷઃఆϑΝΠϧ
ֶशͱݕূͷ࣮ߦ $ CUDA_VISIBLE_DEVICES=0,1 python ./train.py \ --learning_config config_megane.json
\ --tfrecords_dir ~/tfrecords_classifier \ --train_dir ~/train_single_discriminator \ --summary_dir ~/summary_single_discriminator \ --batch_size 64 \ --learning_rate 0.0001 \ --num_gpus 2 \ --max_step 100000 $ CUDA_VISIBLE_DEVICES=2 python ./eval.py \ --learning_config config_megane.json \ --tfrecords_dir ~/tfrecords_classifier \ --train_dir ~/train_single_discriminator \ --summary_dir ~/summary_single_discriminator $ tensorboard \ --logdir ~/summary_single_discriminator/megane/
ධՁ༻ αʔόʔ ܇࿅ɾֶश༻αʔόʔ σʔληοτసૹ ʢTFRecordʣ ֶशࡁΈ ύϥϝʔλʔऔಘ ը૾औಘ
ը૾औಘ ϥϕϧ ͚ σʔληοτཧ αʔόʔ σʔλऩूݩ αʔϏε ը૾औಘ ϥϕϧ ͚ Android ΞϓϦ
ධՁ༻αʔόʔ
ධՁͷ࣮ߦ $ python3 client.py \ --tag_name megane \
--train_base_path ~/train_single_discriminator \ --train_file_name precision-0.956463/megane.ckpt-294000 \ --batch_size 16 \ --limit_batch 100
ධՁ༻ αʔόʔ ܇࿅ɾֶश༻αʔόʔ σʔληοτసૹ ʢTFRecordʣ ֶशࡁΈ ύϥϝʔλʔऔಘ ը૾औಘ
ը૾औಘ ϥϕϧ ͚ σʔληοτཧ αʔόʔ σʔλऩूݩ αʔϏε ը૾औಘ ϥϕϧ ͚ Android ΞϓϦ
"OESPJEΞϓϦ
ۙͷ՝
ෆదը૾͕ଟ͗͢Δ
ෆదʢ/4'8ʣը૾ͱ؟ڸը૾ /4'8 positive: 36,083 → 7.17% negative:
466,738 ؟ڸ positive: 23,559 → 2.44% negative: 938,563
ෆదը૾ϑΟϧλʔΛ ΞϓϦʹΈࠐΉ
NPEFM NSFW positive: 5,628 negative: 17,253
NPEFM ֶशࡁΈύϥϝʔλʔϑΝΠϧ ֶशࡁΈϞσϧ .pb 170MB
NPEFM@MJUF ֶशࡁΈύϥϝʔλʔϑΝΠϧ ֶशࡁΈϞσϧ .pb 10.7MB
NPEFM@MJUF
Ϟσϧͷߏ .pb input result 128x128x3 1
private val IMAGE_WIDTH = 128 private val IMAGE_HEIGHT = 128
private val IMAGE_CHANNEL = 3 private val IMAGE_BYTES_LENGTH = IMAGE_WIDTH * IMAGE_HEIGHT * IMAGE_CHANNEL val imageByteBuffer: ByteBuffer = ByteBuffer.allocate(IMAGE_BYTES_LENGTH) val scaledBitmap = Bitmap.createScaledBitmap(bitmap, IMAGE_WIDTH, IMAGE_HEIGHT, false) scaledBitmap.copyPixelsToBuffer(imageByteBuffer) ը૾ΛόοϑΝʹ֨ೲ
val resultArray = FloatArray(1) fun recognize(imageByteArray: ByteArray): Float { val
start = Debug.threadCpuTimeNanos() tfInference.feed("input", imageByteArray, imageByteArray.size.toLong()) tfInference.run(arrayOf("result")) tfInference.fetch("result", resultArray) val elapsed = Debug.threadCpuTimeNanos() - start Log.d(TAG, "Elapsed: %d ns".format(elapsed)) return resultArray[0] } GFFESVOGFUDI
private val IMAGE_WIDTH = 128 private val IMAGE_HEIGHT = 128
private val IMAGE_CHANNEL = 3 private val IMAGE_BYTES_LENGTH = IMAGE_WIDTH * IMAGE_HEIGHT * IMAGE_CHANNEL val imageByteBuffer: ByteBuffer = ByteBuffer.allocate(IMAGE_BYTES_LENGTH) val scaledBitmap = Bitmap.createScaledBitmap(bitmap, IMAGE_WIDTH, IMAGE_HEIGHT, false) scaledBitmap.copyPixelsToBuffer(imageByteBuffer) scaledBitmap.recycle() ݪҼΒ͖͠ͷ ˢ"MQIBνϟϯωϧ͕ೖ͍ͬͯΔ
Ϟσϧͷߏ .pb input result 128x128x4 1
with tf.Graph().as_default() as g: image_ph = tf.placeholder( tf.uint8, [model.IMAGE_SIZE *
model.IMAGE_SIZE * 4], name='input') image = tf.cast(image_ph, tf.float32) image = tf.reshape( image, [model.IMAGE_SIZE, model.IMAGE_SIZE, 4]) image = image[:, :, :3] QCग़ྗ࣌ʹDIΛड͚ೖΕΔΑ͏ʹάϥϑΛมߋ
σϞ
'PPE(BMMFSZ https://github.com/keiji/food_gallery_with_tensorflow ΪϟϥϦʔʹอଘ͞Ε͍ͯΔ৯ͷը૾Λදࣔ http://techlife.cookpad.com/entry/2017/09/14/161756 ΫοΫύου։ൃऀϒϩά ྉཧ͖Ζ͘ʹ͓͚ΔྉཧʗඇྉཧผϞσϧͷৄࡉ
ΈࠐΜͰΈ͚ͨΕͲɺ ਫ਼͋·Γߴ͘ͳ͍ʜʜ
ࠓޙͷ՝ 5FOTPS'MPX-JUFͷҠߦ ߴਫ਼ͷϞσϧͷѹॖʢল༰ྔԽʣ 1SVOJOH 2VBOUJ[BUJPO %JTUJMMBUJPO ML Kit:
Machine Learning SDK for mobile developers (Google I/O '18) https://youtu.be/Z-dqGRSsaBs?t=32m10s
ࠓޙͷ՝ ֶशαΠΫϧΛࣗಈԽ͍͖͍ͯͨ͠ɻ ʢఆظతʹֶशσʔλͷੜͱసૹΛߦ͍ɺ࠶ֶश͢ΔͳͲʣ σʔλϕʔεͷߴԽ ɹϥϕϧݕࡧ͕ඇৗʹ͍ͷ͕՝ɻઃܭΛݟ͢ඞཁ͋Γ ɹݕࡧΠϯσοΫεͷ(PPHMF$MPVE4UPSFҠߦΛݕ౼
ࠓޙͷ՝ σʔληοτཧαʔόʔͷߋ৽ 5FOTPS'MPXΑΓɺ$16ʹ*OUFM"79͕ඞਢʹͳͬͨʢQJQ൛ʣ
C-LIS CO., LTD. ຊࢿྉɺ༗ݶձࣾγʔϦεͷஶ࡞Ͱ͢ɻຊࢿྉͷશ෦ɺ·ͨҰ෦ʹ͍ͭͯɺஶ࡞ऀ͔ΒจॻʹΑΔڐΛಘͣʹෳ͢Δ͜ͱې͡ΒΕ͍ͯ·͢ɻ 5IF"OESPJE4UVEJPJDPOJTSFQSPEVDFEPSNPEJpFEGSPNXPSLDSFBUFEBOETIBSFECZ(PPHMFBOEVTFEBDDPSEJOHUPUFSNTEFTDSJCFEJOUIF$SFBUJWF$PNNPOT"UUSJCVUJPO-JDFOTF ໊֤ɾϒϥϯυ໊ɺձ໊ࣾͳͲɺҰൠʹ֤ࣾͷඪ·ͨొඪͰ͢ɻຊࢿྉதͰɺɺɺäΛׂѪ͍ͯ͠·͢ɻ 5IF"OESPJESPCPUJTSFQSPEVDFEPSNPEJpFEGSPNXPSLDSFBUFEBOETIBSFECZ(PPHMFBOEVTFEBDDPSEJOHUPUFSNTEFTDSJCFEJOUIF$SFBUJWF$PNNPOT"UUSJCVUJPO-JDFOTF