Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[GDG DevFest Seoul 2018] Browsing Modern Tensor...

Joongi Kim
November 10, 2018

[GDG DevFest Seoul 2018] Browsing Modern TensorFlow

Joongi Kim

November 10, 2018
Tweet

More Decks by Joongi Kim

Other Decks in Programming

Transcript

  1. #FGPSF5FOTPS'MPX § 삲퍟 칺푷핞 헏 싳얺삫  홂핺퐢픚 § $BGGF

     § 펾묺핞슲픒 퓒 핊짦쇪 옪믆앦짛 짷쩣 헪뫃 § 컲헣핊 엶 뻞 슪 § 5IFBOP _ § 칺푷핞 슪 1ZUIPO픊옪 핟컿쇪 컲헣 § ,FSBT _ § .FUBGSBNFXPSL ˊ ˑ엖핒풚픦 엖핒풚˒ § 4VQQPSUFE CBDLFOET § 5IFBOP EFGBVMU 5FOTPS'MPX _ .9/FU _ $/5, _ § FUD § 1BEEMF $IBJOFS %-+ ˘
  2. 5FOTPS'MPX § 삲퍟 믾몒킃 핟펓픒 퓒 폲콚큲 엖핒풚 짝 않핂쯚얺읺

    § (PPHMF펞컪 맪짪몮 뫃맪 뼒 풢 _ § 힣 § 1ZUIPO"1* MJLF5IFBOP §  핂 +BWB $ 슿뫊 맧픎 펆펂픦 OBUJWFCJOEJOH 헪뫃 § 솧핟 몋 § -JOVY NBD04 § /7*%*"(16T 1BTDBM핂캏 ".%(16T 'JKJ핂캏
  3. 5FOTPS'MPX팒쫂믾 § 훊푢 몒 뼒 풢 믾훎 §  DPNNJUTTJODF%FD

    §  DPOUSJCVUPST §  QVMMSFRVFTUT §  GPSLT 믊 맪풢 § #PPUTUSBQ쫂삲 잜픚   §  5FOTPS'MPX 뫎엶 (JU)VC 헎핳콚 § 핺 캏 § $PNQMFUF.-NPEFMQSPUPUZQJOH § %JTUSJCVUFEUSBJOJOH § $16(16516.PCJMFTVQQPSU § 5FOTPS'MPX4FSWJOH § 쫂삲 퀺풂 옮 컪찒큲 묺 § 9-"DPNQJMFS _ § 삲퍟 멭 짾 몋 짝 컿쁳 캏 헪뫃 § ,FSBT "1*4VQQPSU _ § 몮쿦훎 옪믆앦짛 "1* ,FSBT  § &BHFS&YFDVUJPO _ § *OUFSBDUJWFNPEF § 칺푷핞 슪읊 펾칾믆앦많 팒삚 킲헪 1ZUIPO 슪옪 믗 § 5FOTPS'MPX%BUBTFUT _ § 섾핂 콚큲읊 삲욶믾 퓒 핂않핆 헪뫃
  4. 2016 2017 ⏤ TensorFlow Serving ⏤ Keras API ⏤ Eager

    Execution ⏤ TensorFlow Lite ⏤ XLA ⏤ OpenCL w/ OpenCompute ⏤ Distributed TensorFlow ⏤ Multi GPU support ⏤ Mobile TensorFlow ⏤ TensorFlow Datasets ⏤ SKLearn (contrib) ⏤ TensorFlow Slim ⏤ SyntaxNet ⏤ DRAGNN ⏤ TFLearn (contrib) ⏤ TensorFlow TimeSeries 2018 ⏤ TensorFlow Hub ⏤ Swift for TensorFlow ⏤ TensorFlow Models ⏤ ROCm TensorFlow (Test) 5FOTPS'MPX펻칺 ⏤ TensorRT integration
  5. 5FOTPS'MPX솧핟 짷킫 § $16 § .VMUJQSPDFTTPS § "79CBTFEBDDFMFSBUJPO § (16QBSUJODIJQ

    § 0QFO.1 § (16 § $6%" /7JEJB ➜ DV%// § 0QFO"- ".% ➜ $PNQVUF$11 § 516 TU _ SE HFO § "4*$GPSNBUSJYDBMDVMBUJPO § *OIPVTFEFWFMPQNFOUCZ(PPHMF        
  6. 5FOTPS'MPX 솧핟 짷킫 § 1ZUIPOCVUOPU1ZUIPO § 1ZUIPO핂 믾쫆 "1* 펆펂

    § 펂쁢 $ 옪 핟컿 (16 많콛픒 퓒 DV%// 푷 § 몒칾 믆앦 $PNQVUBUJPO(SBQI § 칺푷핞 슪쁢 칺킲 슪많 팒삖않 몒칾 믆앦 캫컿픒 퓒 컲헣핊 춞 § 켆켦  믆앦읊 캫컿  믆멑픒 $ 펂옪 킲 § 싢쩒밓핂 펂엲풎
  7. 5FOTPS'MPX믊 많쇪 훊푢 믾쁳슲 § 5FOTPS'MPX&TUJNBUPST W뼒 풢 § )JHIMFWFM"1*GPSVTJOH

    NPEFMJOHXFMMLOPXOFTUJNBUPST § 5FOTPS'MPX4FSWJOH 쪒솒 옪헫 § 5FOTPS'MPX,FSBTDPNQBUJCMF"1* W뼒 풢 § 5FOTPS'MPX%BUBTFUT W뼒 풢 § 5FOTPS'MPXFBHFSFYFDVUJPO W<뼒 풢> 콚맪 W<뼒 풢> 헣킫핺 § 5FOTPS'MPXKT W뼒 풢 § 4XJGUMBOHVBHFGPS5FOTPS'MPX W<뼒 풢> 콚맪 뼒 헣킫핺 § 5FOTPS'MPX)VC 뫃맪 쩮 § 5FOTPS35 JOUFHSBUJPO § 'BTUFSUSBJOJOHPO/7*%*"(16T
  8. TensorFlow Serving § 옮 컪찒큲 엖핒풚 § 뻚 § Servables

    § Loaders § Managers § 훊푢 믾쁳 § Model building § Model versioning § Model saving / loading § Online inference support with RPC
  9. Keras-compatible API for TensorFlow § Keras ( https://keras.io ) §

    High-level API — Focus on user experience § “Deep learning accessible to everyone” § 펻칺 § 2017뼒 2풢 짪 § TensorFlow 1.2펞컪 contributor 힎옪  § TensorFlow 1.4쭎 헣킫 힎옪 킇멷 § 힣 § “Simplified workflow for TensorFlow users, more powerful features to Keras users” § 샎쭎쭒픦 Keras 슪많 믆샎옪  (keras. ̔ tf.keras.) § TensorFlow 슪퐎 Keras 슪읊 컬펂컪 칺푷 많쁳 § tf.keras. 쁢 2.0쭎 팒폖 UG많 쇮 폖헣
  10. &BHFSFYFDVUJPO § 뼒 풢 핊 짪 뼒 풢 핊 헣킫핺

    § 5FOTPS'MPX 펾칾핞슲픒 슪많 킲쇮 쌚 흗킪 많 § 맏 펾칾핞슲픎 짢옪 킲쇪 쿦읊 짦 § 헪뫃 § /VN1Z퐎 퓮칺 쿦 펾칾 슪 핟컿 많쁳 § 핞솧 짆쭒 짝 (16 많콛 힎풞 § 믾몒킃 킲v맪짪픒 퓒 퓮펾 앹 § 핳헞 § 1ZUIPO싢쩒밓 솒묺 칺푷 많쁳 § 찮읆 폲윦 쫂몮 § 헪펂묺혾 믆샎옪 헏푷 § 1ZUIPO섾핂묺혾 푷
  11. files = tf.data.Dataset.list_files(file_pattern) dataset = tf.data.TFRecordDataset(files) dataset = dataset.shuffle(10000) dataset

    = dataset.repeat(NUM_EPOCHS) dataset = dataset.map(lambda x: tf.parse_single_example(x, features)) dataset = dataset.batch(BATCH_SIZE) iterator = dataset.make_one_shot_iterator() features = iterator.get_next() E T L
  12. files = tf.data.Dataset.list_files(file_pattern) dataset = tf.data.TFRecordDataset(files) dataset = dataset.shuffle(10000) dataset

    = dataset.repeat(NUM_EPOCHS) dataset = dataset.map(lambda x: tf.parse_single_example(x, features)) dataset = dataset.batch(BATCH_SIZE) iterator = dataset.make_one_shot_iterator() features = iterator.get_next()
  13. files = tf.data.Dataset.list_files(file_pattern) dataset = tf.data.TFRecordDataset(files, num_parallel_reads=32) dataset = dataset.shuffle(10000)

    dataset = dataset.repeat(NUM_EPOCHS) dataset = dataset.map(lambda x: tf.parse_single_example(x, features)) dataset = dataset.batch(BATCH_SIZE) iterator = dataset.make_one_shot_iterator() features = iterator.get_next()
  14. files = tf.data.Dataset.list_files(file_pattern) dataset = tf.data.TFRecordDataset(files, num_parallel_reads=32) dataset = dataset.apply(

    tf.contrib.data.shuffle_and_repeat(10000, NUM_EPOCHS)) dataset = dataset.apply( tf.contrib.data.map_and_batch(lambda x: ..., BATCH_SIZE)) iterator = dataset.make_one_shot_iterator() features = iterator.get_next()
  15. files = tf.data.Dataset.list_files(file_pattern) dataset = tf.data.TFRecordDataset(files, num_parallel_reads=32) dataset = dataset.apply(

    tf.contrib.data.shuffle_and_repeat(10000, NUM_EPOCHS)) dataset = dataset.apply( tf.contrib.data.map_and_batch(lambda x: ..., BATCH_SIZE)) dataset = dataset.apply(tf.contrib.data.prefetch_to_device("/gpu:0")) iterator = dataset.make_one_shot_iterator() features = iterator.get_next()
  16. files = tf.data.Dataset.list_files(file_pattern) dataset = tf.data.TFRecordDataset(files, num_parallel_reads=32) dataset = dataset.apply(

    tf.contrib.data.shuffle_and_repeat(10000, NUM_EPOCHS)) dataset = dataset.apply( tf.contrib.data.map_and_batch(lambda x: ..., BATCH_SIZE)) dataset = dataset.apply(tf.contrib.data.prefetch_to_device("/gpu:0")) iterator = dataset.make_one_shot_iterator() features = iterator.get_next() Check out Brennan’s talk to learn more! https://www.youtube.com/watch?v=SxOsJPaxHME
  17. # Download and use NASNet feature vector module. module =

    hub.Module( "https://tfhub.dev/google/imagenet/nasnet_large/feature_vector/1") features = module(my_images) logits = tf.layers.dense(features, NUM_CLASSES) probabilities = tf.nn.softmax(logits) 62,000+ GPU 시간! 젆킮얺삫 뫃퓮*NBHF/FU
  18. # Download and use NASNet feature vector module. module =

    hub.Module( "https://tfhub.dev/google/imagenet/nasnet_large/feature_vector/1", trainable=True, tags={“train”}) features = module(my_images) logits = tf.layers.dense(features, NUM_CLASSES) probabilities = tf.nn.softmax(logits)
  19. # Use pre-trained universal sentence encoder to build text vector

    column. review = hub.text_embedding_column( "review", "https://tfhub.dev/google/universal-sentence-encoder/1") features = { "review": np.array(["an arugula masterpiece", "inedible shoe leather", ...]) } labels = np.array([[1], [0], ...]) input_fn = tf.estimator.input.numpy_input_fn(features, labels, shuffle=True) estimator = tf.estimator.DNNClassifier(hidden_units, [review]) estimator.train(input_fn, max_steps=100) 젆킮얺삫 뫃퓮6OJWFSTBM4FOUFODF&ODPEFS
  20. # Use pre-trained universal sentence encoder to build text vector

    column. review = hub.text_embedding_column( "review", "https://tfhub.dev/google/universal-sentence-encoder/1", trainable=True) features = { "review": np.array(["an arugula masterpiece", "inedible shoe leather", ...]) } labels = np.array([[1], [0], ...]) input_fn = tf.estimator.input.numpy_input_fn(features, labels, shuffle=True) estimator = tf.estimator.DNNClassifier(hidden_units, [review]) estimator.train(input_fn, max_steps=100) 젆킮얺삫 뫃퓮6OJWFSTBM4FOUFODF&ODPEFS
  21. # Use pre-trained universal sentence encoder to build text vector

    column. review = hub.text_embedding_column( "review", "https://tfhub.dev/google/universal-sentence-encoder/1") features = { "review": np.array(["an arugula masterpiece", "inedible shoe leather", ...]) } labels = np.array([[1], [0], ...]) input_fn = tf.estimator.input.numpy_input_fn(features, labels, shuffle=True) estimator = tf.estimator.DNNClassifier(hidden_units, [review]) estimator.train(input_fn, max_steps=100) 젆킮얺삫 뫃퓮6OJWFSTBM4FOUFODF&ODPEFS
  22. 쯚않푾헎 믾몒킃 § 쩖먾옪풎핂 펔쁢 젆킮얺삫 § 젆킮얺삫픒 퓒 핺욚

     몒칾 섾핂 팚몮읺흦 § 9-"삲퍟 몋펞컪픦 짢핂뻖읺 엖쩶 헏 힎풞 § 옪큲 앹  몋핂 핖픒밚 § +BWB 퓇쯚않푾헎 § 믊픦 퓇쯚않푾헎 짪헒슲 § 8FC(- § 삲퍟 (16믾믾슲펞 샎픟쁢 핊쇪 옪믆앦짛 몋 § 8FC"TTFNCMZ § 짢핂뻖읺 엖쩶 헏 § 졶슮 훊푢 쯚않푾헎펞 핺
  23. 5FOTPS'MPXKT § 뼒 풢 핊 뫃맪 § %FFQMFBSOKT ̔ 5FOTPS'MPXKT

    § 1ZUIPO 쩒헒뫊 퓮칺 "1* 헪뫃 § 훊푢 믾쁳 § 쯚않푾헎펞컪 옮 펾칾 § 믾홂 5' 졶셆픒 5'KT 졶셆옪 쪎 § pip install tensorflowjs § OPEFKT 믾짦 TDBMJOH
  24. ONNX (Open Neural Network Exchange) Microsoft / Facebook (Sep. 2017)

    Caffe 2 + PyTorch (Facebook), CNTK (Microsoft) MLMODEL (Code ML model, Machine Learning Model) Apple (Aug. 2017) Caffe, Keras, scikit-learn, LIBSVM (Open Source) Provides Core ML converter / specification
  25. .-,JU픎 J04 짝 팖슪옪핂슪 4%, 믾쫆 "1*슲 짝 재 졶셆

    힎풞 믾믾펞컪 짢옪 킲 짝 묺믎 않푾슪 "*옮 "1* 'JSFCBTF퐎픦 맣 
  26. 큲 핆킫 핂짆힎 않쩶잏 짢슪 큲 펊뭂 핆킫 앪슪잖 핆킫

    믾쫆 "1*슲 킲푷헏픊옪 튾핂쁢 맒삶 "1*
  27. 재 졶셆 힎풞 솧헏 졶셆 삲풂옪슪 'JSFCBTF믾짦픦 "# 큲 졶셆

    쪎 짝 팣 킪 폖헣 큲 졶셆픒 맒삶멚 칺푷믾
  28. 5FOTPS'MPX § 뼒 풢 핊 옪슪쟃 뫃맪 § 맪짪 

    칺푷 퍟펞컪픦 칺푷컿 맪컮핂 졷 § 맪짪 픦컿 맪컮 § &BHFS 졶슪많 믾쫆 줆쩣핂 쇶 믾홂 슪읊 퓒 쪎 솒묺 힎풞 § 뻲핒큲핂큲픦 핊뫎컿 퓮힎 § tf.contrib 많 펔펂힞 § 훊푢 슪슲픎 tf. 퓒옪 슲펂퐎컪 킺 슪옪 뫎읺 § 믆 짤픦 슪슲픎 젢핆 슪펞컪 헪먾 § "1* 샎샎헏 헣읺 § 삲퍟 슪슲픒 짩팒슲핂젾 솧핊 믾쁳픒 쁢 펺얺 "1*많 홂핺 § 빦틷잚 빶믾몮 졶숞 헪먾 § 펆헪 § 폺 팖펞˘
  29. 믆읺몮˘ § 5FOTPS'MPXKT OPEFKT 5FOTPS'MPX 1ZUIPO § 삶잞 싢짢핂큲펞컪쁢 +BWB4DSJQU옪

    핂푷 § 컪쩒옪 뻦밆 쌚쁢 OPEFKT 믾짦픦 컪쩒읊 몋퓮펺 5FOTPS'MPX컪쩒펞 푢 § .-,JU 'JSF#BTF § 큲잖펞컪쁢 .-,JU 믾짦픊옪 5FOTPS'MPXMJUF졶셆 킲 § 푢펞 싾않 컪쩒칺핂슪 펾칾 짝 졶셆 펓섾핂읊 'JSF#BTF읊  킲
  30.  폖 짝 핂큖슲 § 6OJUZ*OUFHSBUJPOGPS3-FOWJSPONFOU § 맣킃픒 퓒 킪쥺엖핂켦

    몋픊옪 6OJUZ 칺푷 믾쁳  § 옪쫕 짝 킇푷 싢짢핂큲슿픦 엶 몋 § 폶않핆 멚핒 뺂픦 "* 몋 슿 § 1Z5PSDI퐎픦 훊솒뭚 몋햏 § 뿒많뿒많 섢 많 § 칺푷컿  졶셆 맪짪펞 멆읺쁢 킪맒 § 핳컿  졶짢핊컪쩒맒  § 폖캏  펾묺쭒퍊펞컪쁢 1Z5PSDI 픟푷맪짪 쭒퍊펞컪쁢 5FOTPS'MPX