{"id":38800,"date":"2018-09-16T23:10:23","date_gmt":"2018-09-16T14:10:23","guid":{"rendered":"http:\/\/kako.com\/blog\/?p=38800"},"modified":"2018-09-17T06:25:35","modified_gmt":"2018-09-16T21:25:35","slug":"%e6%a9%9f%e6%a2%b0%e5%ad%a6%e7%bf%92-%e5%90%8d%e5%8f%a4%e5%b1%8b-%e7%ac%ac17%e5%9b%9e%e5%8b%89%e5%bc%b7%e4%bc%9a%e3%81%ab%e8%a1%8c%e3%81%a3%e3%81%a6%e3%81%8d%e3%81%9f","status":"publish","type":"post","link":"http:\/\/kako.com\/blog\/?p=38800","title":{"rendered":"\u6a5f\u68b0\u5b66\u7fd2 \u540d\u53e4\u5c4b \u7b2c17\u56de\u52c9\u5f37\u4f1a\u306b\u884c\u3063\u3066\u304d\u305f"},"content":{"rendered":"<p><a href=\"https:\/\/machine-learning.connpass.com\/event\/94992\/\">\u6a5f\u68b0\u5b66\u7fd2 \u540d\u53e4\u5c4b \u7b2c17\u56de\u52c9\u5f37\u4f1a<\/a>\u306b\u884c\u3063\u3066\u304d\u305f\u3002<br \/>\n<a href=\"http:\/\/kako.com\/blog\/wp\/wp-content\/uploads\/2018\/09\/Img_6025.jpg\"><img loading=\"lazy\" src=\"http:\/\/kako.com\/blog\/wp\/wp-content\/uploads\/2018\/09\/Img_6025.jpg\" alt=\"\" width=\"640\" height=\"480\" class=\"alignnone size-full wp-image-38801\" srcset=\"http:\/\/kako.com\/blog\/wp\/wp-content\/uploads\/2018\/09\/Img_6025.jpg 640w, http:\/\/kako.com\/blog\/wp\/wp-content\/uploads\/2018\/09\/Img_6025-300x225.jpg 300w, http:\/\/kako.com\/blog\/wp\/wp-content\/uploads\/2018\/09\/Img_6025-624x468.jpg 624w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\n<!--more--><\/p>\n<p>\u4eca\u56de\u306fGAN\u306e\u8a71\u3060\u3002<br \/>\nTensorFlow\u3068\u3001TensorFlow Hub\u3092\u4f7f\u3063\u3066GAN\u3092\u52d5\u304b\u3057\u3066\u307f\u308b\u3068\u3044\u3046\u30cf\u30f3\u30ba\u30aa\u30f3\u3068\u3044\u3046\u3053\u3068\u3060\u3063\u305f\u304c\u3001<br \/>\n\u30cf\u30f3\u30ba\u30aa\u30f3\u3068\u3044\u3046\u3088\u308a\u3001\u3084\u308a\u65b9\u306e\u7d39\u4ecb\u306e\u307f\u3067\u3042\u3068\u306f\u305d\u308c\u305e\u308c\u3084\u3063\u3066\u307f\u3066\u306d\u3068\u3044\u3046\u611f\u3058\u3060\u3063\u305f\u3002<\/p>\n<p>\u8cc7\u6599\u306f\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u3002<br \/>\n\u2192 <a href=\"https:\/\/qiita.com\/n_kats_\/items\/a696b247a551a4bb7057\">GAN \u3068\u89aa\u3057\u3082\u3046\uff01\uff08\u6a5f\u68b0\u5b66\u7fd2\u540d\u53e4\u5c4b\u7b2c\uff117\u56de\u52c9\u5f37\u4f1a\uff09<\/a><\/p>\n<p>\u6301\u3063\u3066\u884c\u3063\u305fMacBook Air\u306e\u30d0\u30c3\u30c6\u30ea\u30fc\u304c\u5207\u308c\u3066\u3057\u307e\u3063\u3066\u3001GAN\u3092\u52d5\u304b\u3059\u306e\u304c\u51fa\u6765\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u3042\u3068\u3067\u3084\u3063\u3066\u307f\u308b\u3002<\/p>\n<p>TensowFlow Hub\u3068\u3044\u3046\u306e\u3092\u77e5\u3063\u305f\u3002github\u7684\u306b\u8272\u3005\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\/\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u516c\u958b\u3055\u308c\u3066\u304a\u308a\u3001python\u306e\u30b3\u30fc\u30c9\u3067\u7c21\u5358\u306b\u305d\u308c\u3089\u3092\u5f15\u3063\u5f35\u3063\u3066\u304d\u3066\u5b9f\u884c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u4eca\u56de\u306eGAN\u3092\u52d5\u304b\u3059\u30b3\u30fc\u30c9\u3082\u3068\u3066\u3082\u77ed\u304b\u3063\u305f\u308a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nimport tensorflow as tf\r\nimport tensorflow_hub as hub\r\nfrom PIL import Image\r\nimport numpy as np\r\n\r\n\r\n# \u30e2\u30c7\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9(\u6642\u9593\u304c\u304b\u304b\u308b)\r\ngan = hub.Module(&quot;https:\/\/tfhub.dev\/google\/progan-128\/1&quot;)\r\n\r\n\r\n# \u5165\u529b\u306e\u4e71\u6570(placeholder\u306a\u3069\u3092\u4f7f\u3063\u3066\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3082\u53ef)\r\nz_values = tf.random_normal(shape=[10, 512])\r\nimages = gan(z_values)\r\n\r\n\r\nwith tf.Session() as sess:\r\n    sess.run(tf.global_variables_initializer())\r\n\r\n    # \u753b\u50cf\u751f\u6210\r\n    out = sess.run(images)\r\n\r\n    # \u4fdd\u5b58\r\n    for i, image in enumerate(out):\r\n        Image.fromarray(np.uint8(image * 255)).save(f&quot;result_{i}.png&quot;)  # \u5024\u30920\u301c255\u306b\u3057\u3066\u4fdd\u5b58\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6a5f\u68b0\u5b66\u7fd2 \u540d\u53e4\u5c4b \u7b2c17\u56de\u52c9\u5f37\u4f1a\u306b\u884c\u3063\u3066\u304d\u305f\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/38800"}],"collection":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=38800"}],"version-history":[{"count":2,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/38800\/revisions"}],"predecessor-version":[{"id":38803,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/38800\/revisions\/38803"}],"wp:attachment":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=38800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=38800"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=38800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}