{"id":995,"date":"2023-03-21T23:36:22","date_gmt":"2023-03-21T14:36:22","guid":{"rendered":"https:\/\/fukugyouhistory.tokyo\/?p=995"},"modified":"2023-03-27T12:02:54","modified_gmt":"2023-03-27T03:02:54","slug":"stable-diffusion-hugging-face%e3%80%80%e8%87%aa%e5%8b%95%e3%81%8a%e7%b5%b5%e3%81%8b%e3%81%8dai%e3%80%80%e4%b8%8a%e6%89%8b%e3%81%aa%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/fukugyouhistory.tokyo\/?p=995","title":{"rendered":"Stable Diffusion + Hugging Face\u3000\u81ea\u52d5\u304a\u7d75\u304b\u304dAI\u3000\u4e0a\u624b\u306a\u4f7f\u3044\u65b9"},"content":{"rendered":"\n<p>\u4ee5\u524d\u306b<a href=\"https:\/\/fukugyouhistory.tokyo\/?p=698\" target=\"_blank\" rel=\"noreferrer noopener\">STABLE DIFFUSION + HUGGING FACE\u3000\u81ea\u52d5\u304a\u7d75\u304b\u304dAI\u3000\u7c21\u5358\u306b\u4f7f\u3063\u3066\u307f\u305f<\/a>\u306e\u8a18\u4e8b\u3092<br>\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u3044\u307e\u3044\u3061\u30d7\u30ed\u30f3\u30d7\u30c8\uff08\u7d75\u3092\u4f5c\u6210\u3059\u308b\u3068\u304d\u306e\u6587\u5b57\uff09\u4f5c\u6210\u304c\u96e3\u3057\u3044\u3067\u3059\u3002<br>\u4eca\u56de\u3001\u591a\u5c11\u3001\u4e0a\u624b\u306b\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30b3\u30c4\u304c\u5c11\u3057\u5206\u304b\u3063\u305f\u306e\u3067\u3001\u8aac\u660e\u3057\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u751f\u6210\u3057\u305f\u753b\u50cf\u306e\u80cc\u666f\u9664\u53bb\u30fb\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u306a\u3069\u306e\u65b9\u6cd5\u3082\u3001\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u69cb\u6210<\/h2>\n\n\n\n<p>Stable Diffusion\u3092\u4f7f\u3063\u3066\u7d75\u3092\u51fa\u3059\u65b9\u6cd5\u306f\u3001<a rel=\"noreferrer noopener\" href=\"https:\/\/fukugyouhistory.tokyo\/?p=698\" target=\"_blank\">\u4ee5\u524d\u306e\u8a18\u4e8b<\/a>\u3092\u53c2\u8003\u306b\u3057\u3066\u9802\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<br>\u3053\u3053\u3067\u306f\u30d7\u30ed\u30f3\u30d7\u30c8\u306b\u7d5e\u3063\u3066\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>Stable Diffusion\u306e\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u304a\u3059\u3059\u3081\u306e\u69cb\u6210\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br>\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u7279\u5fb4\u3068\u3057\u3066\u3001\u524d\u306e\u65b9\u307b\u3069\u91cd\u8981\u5ea6\u304c\u9ad8\u304f\u306a\u308b\u50be\u5411\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;\u4e3b\u984c&gt;, &lt;\u4e3b\u984c\u306e\u72b6\u6cc1&gt;, &lt;\u4e3b\u984c\u306e\u80cc\u666f&gt;, &lt;\u4e3b\u984c\u3092\u63cf\u304f\u30b9\u30bf\u30a4\u30eb&gt;, &lt;\u8abf\u6574\u30ef\u30fc\u30c9A&gt;, &lt;\u8abf\u6574\u30ef\u30fc\u30c9B&gt;, \u2026<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ed\u30b4\u306e\u4f5c\u6210<\/h3>\n\n\n\n<p>\u30d7\u30ed\u30f3\u30d7\u30c8\u306f\u82f1\u8a9e\u5165\u529b\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u3053\u306e\u69cb\u6210\u306b\u6cbf\u3063\u3066\u65e5\u672c\u8a9e\u3092\u82f1\u8a33\u3057\u3066\u3044\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br>\u4eca\u56de\u306f\u300c\u526f\u696d\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u4f1a\u793e\u306e\u30ed\u30b4\u4f5c\u6210\u300d\u3068\u8a00\u3046\u4eee\u984c\u3067\u3001\u4f8b\u3092\u793a\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u203b\u7ffb\u8a33\u306b\u306f<a rel=\"noreferrer noopener\" href=\"https:\/\/www.deepl.com\/translator\" target=\"_blank\">DeepL<\/a>\u3092\u4f7f\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u8a73\u7d30\u306b\u63cf\u304b\u308c\u305f\u30ed\u30b4\u306e\u30a4\u30e9\u30b9\u30c8\u30c7\u30b6\u30a4\u30f3\u3001\u526f\u696d\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u4f1a\u793e\u306e\u30ed\u30b4\u3001\u30b7\u30f3\u30d7\u30eb\u3067\u592a\u304f\u660e\u78ba\u306a\u8f2a\u90ed\u7dda\u3001\u5168\u4f53\u3092\u57cb\u3081\u308b\u3001\u30a2\u30a4\u30b3\u30f3\u7684\u306b\u3001\u30df\u30cb\u30de\u30ea\u30b9\u30c8<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Detailed logo illustration design, logo for a sideline agency company, simple, thick and clear outlines, fill in the whole, iconic, minimalist.<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-217-1024x523.png\" alt=\"\" class=\"wp-image-997\" width=\"404\" height=\"206\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-217-1024x523.png 1024w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-217-300x153.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-217-768x392.png 768w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-217.png 1140w\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u6587\u7ae0\u3067\u3001\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u306730\u679a\u751f\u6210\u3055\u305b\u3066\u307f\u307e\u3057\u305f\u3002\u305d\u306e\u4e2d\u304b\u3089\u826f\u3055\u305d\u3046\u306a\u3082\u306e\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u4f7f\u7528\u30e2\u30c7\u30eb \uff1a prompthero\/openjourney\nimage = pipe(prompt, guidance_scale=10, num_inference_steps=50).images&#91;0]<\/code><\/pre>\n\n\n\n<p><img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-999\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-218.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-218.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-218-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-218-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1001\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-219.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-219.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-219-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-219-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1003\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-220.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-220.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-220-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-220-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1004\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-221.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-221.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-221-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-221-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1005\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-222.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-222.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-222-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-222-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1006\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-223.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-223.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-223-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-223-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1007\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-224.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-224.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-224-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-224-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1008\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-225.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-225.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-225-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-225-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1009\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-226.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-226.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-226-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-226-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1010\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-227.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-227.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-227-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-227-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1012\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1013\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-229.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-229.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-229-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-229-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1014\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-230.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-230.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-230-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-230-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1015\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-231.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-231.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-231-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-231-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1016\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-232.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-232.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-232-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-232-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/p>\n\n\n\n<p>\u300c\u526f\u696d\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u4f1a\u793e\u300d\u304c\u6f20\u7136\u3068\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u3053\u308c\uff01\u3068\u8a00\u3046\u3082\u306e\u304c\u4f5c\u3089\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001<br>\u96f0\u56f2\u6c17\u3068\u3057\u3066\u306e\u30ed\u30b4\u306f\u3067\u304d\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u30a4\u30e1\u30fc\u30b8\u304c\u6d6e\u304b\u3076\u984c\u6750\u3092\u5143\u306b\u3059\u308b\u3068\u3001<br>\u3088\u308a\u826f\u3044\u30ed\u30b4\u304c\u4f5c\u6210\u3055\u308c\u308b\u3053\u3068\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u98a8\u666f\u306e\u4f5c\u6210<\/h3>\n\n\n\n<p>\u540c\u69d8\u306b\u3001\u98a8\u666f\u3092\u4f5c\u6210\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u8a73\u7d30\u306b\u63cf\u304b\u308c\u305f\u90fd\u5e02\u306e\u98a8\u666f\u3001\u9ad8\u901f\u9053\u8def\u3001\u5c11\u5973\u306e\u5f8c\u308d\u5074\u304b\u3089\u306e\u8996\u70b9\u3001\u9ed2\u3044\u77ed\u3044\u9aea\u3001\u8352\u5ec3\u3057\u305f\u90fd\u5e02\u3001\u5de8\u5927\u306a\u6728\u3001\u8352\u5ec3\u3057\u305f\u5929\u7a7a\u3001\u8302\u307f\u3068\u8349\u539f\u3001\u590f\u306e\u7a7a\u3001\u7a7a\u64ae\u3001\u65b0\u6d77\u8aa0\u6620\u753b\u306e\u80cc\u666f<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Detailed urban landscape, motorway, girl's back view, short black hair, devastated city, huge trees, devastated sky, bushes and meadows, summer sky, aerial shot, background of Makoto Shinkai film.<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-234-1024x466.png\" alt=\"\" class=\"wp-image-1018\" width=\"404\" height=\"184\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-234-1024x466.png 1024w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-234-300x137.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-234-768x350.png 768w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-234.png 1129w\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u6587\u7ae0\u3067\u3001\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u306710\u679a\u751f\u6210\u3055\u305b\u3066\u307f\u307e\u3057\u305f\u3002\u305d\u306e\u4e2d\u304b\u3089\u826f\u3055\u305d\u3046\u306a\u3082\u306e\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u4f7f\u7528\u30e2\u30c7\u30eb \uff1a prompthero\/openjourney\nimage = pipe(prompt, guidance_scale=10, num_inference_steps=50).images&#91;0]<\/code><\/pre>\n\n\n\n<p><img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1019\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-235.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-235.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-235-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-235-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1020\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-236.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-236.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-236-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-236-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1021\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-237.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-237.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-237-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-237-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1022\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-238.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-238.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-238-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-238-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1023\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-239.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-239.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-239-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-239-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1024\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n\n\n\n<p>\u304b\u306a\u308a\u4e16\u754c\u89b3\u304c\u51fa\u3066\u3044\u307e\u3059\u3002\u69cb\u6210\u3092\u8003\u616e\u3059\u308b\u3068\u3001\u307e\u3060\u7d4c\u9a13\u306e\u6d45\u3044\u79c1\u3067\u3082\u7d50\u69cb\u306a\u7d75\u3092\u51fa\u529b\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u80cc\u666f\u306e\u9664\u53bb<\/h2>\n\n\n\n<p>\u80cc\u666f\u306e\u9664\u53bb\u306b\u306f\u300c<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/danielgatis\/rembg\" target=\"_blank\">Rembg<\/a>\u300d\u3068\u3044\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br>\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f\u30ed\u30b4\u3068\u98a8\u666f\u306e\u3046\u3061\u3001\u4ee5\u4e0b\u306e\u3082\u306e\u3092\u4f7f\u7528\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p> <img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1012\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-228-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1024\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-240-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>!pip install rembg<\/code><\/pre>\n\n\n\n<p>\u300cRESTART RUNTIME\u300d\u304c\u51fa\u307e\u3059\u304c\u3001\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u7d9a\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from rembg import remove\nfrom PIL import Image\n\ninput_path = 'input.png'\noutput_path = 'output.png'\n\ninput = Image.open(input_path)\noutput = remove(input)\noutput.save(output_path)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>from IPython.display import Image,display_png\ndisplay_png(Image(\"output.png\"))<\/code><\/pre>\n\n\n\n<p>\u7dba\u9e97\u306b\u80cc\u666f\u304c\u53d6\u308a\u9664\u3051\u3066\u3044\u307e\u3059\u3002<br>\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u51c4\u3044\u3068\u3053\u308d\u306f\u3001\u30ed\u30b4\u306e\u3088\u3046\u306a\u753b\u50cf\u3060\u3051\u3067\u306f\u306a\u304f\u3001<br>\u98a8\u666f\u306e\u3088\u3046\u306a\u753b\u50cf\u3067\u3082\u3001\u4eba\u7269\u7b49\u3092\u81ea\u52d5\u5224\u5b9a\u3057\u3066\u80cc\u666f\u306e\u307f\u3092\u524a\u9664\u3057\u3066\u304f\u308c\u308b\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n\n\n\n<p><img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-1027\" style=\"width: 150px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-233.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-233.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-233-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-233-150x150.png 150w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>\u3000<img decoding=\"async\" width=\"300\" height=\"300\" class=\"wp-image-1030\" style=\"width: 300px;\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/output.png\" alt=\"\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/output.png 512w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/output-300x300.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/output-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u2460<\/h2>\n\n\n\n<p>\u6700\u521d\u304b\u3089\u89e3\u50cf\u5ea6\u306e\u5927\u304d\u3044\u753b\u50cf\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u51e6\u7406\u304c\u91cd\u304f\u3066\u5927\u5909\u306b\u306a\u308a\u307e\u3059\u3002<br>\u305d\u3053\u3067\u3001\u7d30\u304b\u3044\u63cf\u753b\u90e8\u5206\u3092\u88dc\u5b8c\u3057\u3064\u3064\u89e3\u50cf\u5ea6\u3092\u9ad8\u3081\u3066\u304f\u308c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u300c<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/xinntao\/Real-ESRGAN\" target=\"_blank\">Real-ESRGAN<\/a>\u300d\u3068\u8a00\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<br>Google Colaboratory\u306e\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u4e0b\u8a18\u3067\u3059\u3002<br>\u300c3. Inference\u300d\u5185\u306e\u30b3\u30fc\u30c9\u306b\u3042\u308b\u901a\u308a\u3001\u4efb\u610f\u306e\u500d\u7387\u3067\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<br>https:\/\/colab.research.google.com\/drive\/1k2Zod6kSHEvraybHl50Lys0LerhyTMCo?usp=sharing<\/p>\n\n\n\n<p>\u203b\u753b\u50cf\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3044\u3068GPU\u30e1\u30e2\u30ea\u306e\u4e0a\u9650\u3092\u8d85\u3048\u308b\u306e\u3067\u3001\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## 1. Preparations\n\n# Clone Real-ESRGAN and enter the Real-ESRGAN\n!git clone https:\/\/github.com\/xinntao\/Real-ESRGAN.git\n%cd Real-ESRGAN\n# Set up the environment\n!pip install basicsr\n!pip install facexlib\n!pip install gfpgan\n!pip install -r requirements.txt\n!python setup.py develop<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 2. Upload Images\n\nimport os\nfrom google.colab import files\nimport shutil\n\nupload_folder = 'upload'\nresult_folder = 'results'\n\nif os.path.isdir(upload_folder):\n    shutil.rmtree(upload_folder)\nif os.path.isdir(result_folder):\n    shutil.rmtree(result_folder)\nos.mkdir(upload_folder)\nos.mkdir(result_folder)\n\n# upload images\nuploaded = files.upload()\nfor filename in uploaded.keys():\n  dst_path = os.path.join(upload_folder, filename)\n  print(f'move {filename} to {dst_path}')\n  shutil.move(filename, dst_path)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 3. Inference\n\n# if it is out of memory, try to use the `--tile` option\n# We upsample the image with the scale factor X3.5\n!python inference_realesrgan.py -n RealESRGAN_x4plus -i upload --outscale 3.5 --face_enhance\n# Arguments\n# -n, --model_name: Model names\n# -i, --input: input folder or image\n# --outscale: Output scale, can be arbitrary scale factore. <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 4. Visualization\n\n# utils for visualization\nimport cv2\nimport matplotlib.pyplot as plt\ndef display(img1, img2):\n  fig = plt.figure(figsize=(25, 10))\n  ax1 = fig.add_subplot(1, 2, 1) \n  plt.title('Input image', fontsize=16)\n  ax1.axis('off')\n  ax2 = fig.add_subplot(1, 2, 2)\n  plt.title('Real-ESRGAN output', fontsize=16)\n  ax2.axis('off')\n  ax1.imshow(img1)\n  ax2.imshow(img2)\ndef imread(img_path):\n  img = cv2.imread(img_path)\n  img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n  return img\n\n# display each image in the upload folder\nimport os\nimport glob\n\ninput_folder = 'upload'\nresult_folder = 'results'\ninput_list = sorted(glob.glob(os.path.join(input_folder, '*')))\noutput_list = sorted(glob.glob(os.path.join(result_folder, '*')))\nfor input_path, output_path in zip(input_list, output_list):\n  img_input = imread(input_path)\n  img_output = imread(output_path)\n  display(img_input, img_output)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 5. Download Results\n\n# Download the results\nzip_filename = 'Real-ESRGAN_result.zip'\nif os.path.exists(zip_filename):\n  os.remove(zip_filename)\nos.system(f\"zip -r -j {zip_filename} results\/*\")\nfiles.download(zip_filename)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-243-1024x443.png\" alt=\"\" class=\"wp-image-1032\" width=\"633\" height=\"273\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-243-1024x443.png 1024w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-243-300x130.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-243-768x333.png 768w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-243.png 1328w\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u2461<\/h2>\n\n\n\n<p>\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u300c<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/JingyunLiang\/SwinIR\" target=\"_blank\">SwinIR<\/a>\u300d\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3082\u3042\u308b\u306e\u3067\u3001\u7d39\u4ecb\u3057\u307e\u3059\u3002<br>Google Colaboratory\u306e\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u4e0b\u8a18\u3067\u3059\u3002<br>\u300c3. Inference\u300d\u5185\u306e\u30b3\u30fc\u30c9\u306b\u3042\u308b\u901a\u308a\u3001\u4efb\u610f\u306e\u500d\u7387\u3067\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<br>https:\/\/colab.research.google.com\/gist\/JingyunLiang\/a5e3e54bc9ef8d7bf594f6fee8208533\/swinir-demo-on-real-world-image-sr.ipynb<\/p>\n\n\n\n<p>\u30c7\u30e2\u30da\u30fc\u30b8\u5185\u3067\u306f\u3001\u4ed6\u306e\u30a2\u30c3\u30d7\u30b9\u30b1\u30fc\u30eb\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u306e\u6bd4\u8f03\u3082\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002<br>\u4f7f\u3044\u305f\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u4ee5\u5916\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308c\u3070\u3001\u4f7f\u3044\u52dd\u624b\u304c\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u203b\u753b\u50cf\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3044\u3068GPU\u30e1\u30e2\u30ea\u306e\u4e0a\u9650\u3092\u8d85\u3048\u308b\u306e\u3067\u3001\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## 1. Preparations\n\n# Clone realESRGAN\n!git clone https:\/\/github.com\/xinntao\/Real-ESRGAN.git\n%cd Real-ESRGAN\n# Set up the environment\n!pip install basicsr\n!pip install facexlib\n!pip install gfpgan\n!pip install -r requirements.txt\n!python setup.py develop\n\n# Clone BSRGAN\n!git clone https:\/\/github.com\/cszn\/BSRGAN.git\n\n!rm -r SwinIR\n# Clone SwinIR\n!git clone https:\/\/github.com\/JingyunLiang\/SwinIR.git\n!pip install timm\n\n# Download the pre-trained models\n!wget https:\/\/github.com\/cszn\/KAIR\/releases\/download\/v1.0\/BSRGAN.pth -P BSRGAN\/model_zoo\n!wget https:\/\/github.com\/xinntao\/Real-ESRGAN\/releases\/download\/v0.1.0\/RealESRGAN_x4plus.pth -P experiments\/pretrained_models\n!wget https:\/\/github.com\/JingyunLiang\/SwinIR\/releases\/download\/v0.0\/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth -P experiments\/pretrained_models\n!wget https:\/\/github.com\/JingyunLiang\/SwinIR\/releases\/download\/v0.0\/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth -P experiments\/pretrained_models<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 2. Upload Images\n\nimport os\nimport glob\nfrom google.colab import files\nimport shutil\nprint(' Note1: You can find an image on the web or download images from the RealSRSet (proposed in BSRGAN, ICCV2021) at https:\/\/github.com\/JingyunLiang\/SwinIR\/releases\/download\/v0.0\/RealSRSet+5images.zip.\\n Note2: You may need Chrome to enable file uploading!\\n Note3: If out-of-memory, set test_patch_wise = True.\\n')\n\n# test SwinIR by partioning the image into patches\ntest_patch_wise = False\n\n# to be compatible with BSRGAN\n!rm -r BSRGAN\/testsets\/RealSRSet\nupload_folder = 'BSRGAN\/testsets\/RealSRSet'\nresult_folder = 'results'\n\nif os.path.isdir(upload_folder):\n    shutil.rmtree(upload_folder)\nif os.path.isdir(result_folder):\n    shutil.rmtree(result_folder)\nos.mkdir(upload_folder)\nos.mkdir(result_folder)\n\n# upload images\nuploaded = files.upload()\nfor filename in uploaded.keys():\n  dst_path = os.path.join(upload_folder, filename)\n  print(f'move {filename} to {dst_path}')\n  shutil.move(filename, dst_path)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 3. Inference\n\n# BSRGAN\n!rm -r results\nif not test_patch_wise:\n  %cd BSRGAN\n  !python main_test_bsrgan.py\n  %cd ..\n  shutil.move('BSRGAN\/testsets\/RealSRSet_results_x4', 'results\/BSRGAN')\n\n# realESRGAN\nif test_patch_wise:\n  !python inference_realesrgan.py -n RealESRGAN_x4plus --input BSRGAN\/testsets\/RealSRSet -s 4 --output results\/realESRGAN --tile 800\nelse:\n  !python inference_realesrgan.py -n RealESRGAN_x4plus --input BSRGAN\/testsets\/RealSRSet -s 4 --output results\/realESRGAN\n\n# SwinIR\nif test_patch_wise:\n  !python SwinIR\/main_test_swinir.py --task real_sr --model_path experiments\/pretrained_models\/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth --folder_lq BSRGAN\/testsets\/RealSRSet --scale 4 --tile 800\nelse:\n  !python SwinIR\/main_test_swinir.py --task real_sr --model_path experiments\/pretrained_models\/003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth --folder_lq BSRGAN\/testsets\/RealSRSet --scale 4\nshutil.move('results\/swinir_real_sr_x4', 'results\/SwinIR')\n\n# SwinIR-Large\nif test_patch_wise:\n  !python SwinIR\/main_test_swinir.py --task real_sr --model_path experiments\/pretrained_models\/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq BSRGAN\/testsets\/RealSRSet --scale 4 --large_model --tile 640\nelse:\n  !python SwinIR\/main_test_swinir.py --task real_sr --model_path experiments\/pretrained_models\/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq BSRGAN\/testsets\/RealSRSet --scale 4 --large_model\nshutil.move('results\/swinir_real_sr_x4_large', 'results\/SwinIR_large')\nfor path in sorted(glob.glob(os.path.join('results\/SwinIR_large', '*.png'))):\n  os.rename(path, path.replace('SwinIR.png', 'SwinIR_large.png')) # here is a bug in Colab file downloading: no same-name files<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 4. Visualization\n\n# utils for visualization\nimport cv2\nimport matplotlib.pyplot as plt\ndef display(img1, img2):\n  total_figs = 5\n  fig = plt.figure(figsize=(total_figs*12, 14))\n  ax1 = fig.add_subplot(1, total_figs, 1) \n  plt.title('Input image', fontsize=30)\n  ax1.axis('off')\n  ax2 = fig.add_subplot(1, total_figs, 2)\n  plt.title('BSRGAN (ICCV2021) output', fontsize=30)\n  ax2.axis('off')\n  ax3 = fig.add_subplot(1, total_figs, 3)\n  plt.title('Real-ESRGAN output', fontsize=30)\n  ax3.axis('off')\n  ax4 = fig.add_subplot(1, total_figs, 4)\n  plt.title('SwinIR (ours) output', fontsize=30)\n  ax4.axis('off')\n  ax5 = fig.add_subplot(1, total_figs, 5)\n  plt.title('SwinIR-Large (ours) output', fontsize=30)\n  ax5.axis('off')\n  ax1.imshow(img1)\n  ax2.imshow(img2&#91;'BSRGAN'])\n  ax3.imshow(img2&#91;'realESRGAN'])\n  ax4.imshow(img2&#91;'SwinIR'])\n  ax5.imshow(img2&#91;'SwinIR-L'])\n\ndef imread(img_path):\n  img = cv2.imread(img_path)\n  img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n  return img\n\n# display each image in the upload folder\nprint('Note: BSRGAN may be better at face restoration, but worse at building restoration because it uses different datasets in training.')\nif test_patch_wise:\n  print('BSRGAN does not support \"test_patch_wise\" mode for now. Set test_patch_wise = False to see its results.\\n')\nelse:\n  print('\\n')\ninput_folder = upload_folder\nresult_folder = 'results\/SwinIR'\ninput_list = sorted(glob.glob(os.path.join(input_folder, '*')))\noutput_list = sorted(glob.glob(os.path.join(result_folder, '*')))\nfor input_path, output_path in zip(input_list, output_list):\n  img_input = imread(input_path)\n  img_output = {}\n  img_output&#91;'SwinIR'] = imread(output_path)\n  img_output&#91;'SwinIR-L'] = imread(output_path.replace('SwinIR\/', 'SwinIR_large\/').replace('SwinIR.png', 'SwinIR_large.png'))\n  if test_patch_wise:\n    img_output&#91;'BSRGAN'] = img_output&#91;'SwinIR']*0+255\n  else:\n    img_output&#91;'BSRGAN'] = imread(output_path.replace('SwinIR', 'BSRGAN'))\n  path = output_path.replace('\/SwinIR\/', '\/realESRGAN\/').replace('_SwinIR.png','_out{}'.format(os.path.splitext(input_path)&#91;1]))\n  if os.path.exists(path):\n    shutil.move(path, path.replace('_out.', '_realESRGAN.'))\n  img_output&#91;'realESRGAN'] = imread(path.replace('_out.', '_realESRGAN.'))\n\n  display(img_input, img_output)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>## 5. Download Results\n\n# Download the results\nzip_filename = 'SwinIR_result.zip'\nif os.path.exists(zip_filename):\n  os.remove(zip_filename)\nos.system(f\"zip -r -j {zip_filename} results\/*\")\nfiles.download(zip_filename)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"189\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307-1024x189.png\" alt=\"\" class=\"wp-image-1234\" srcset=\"https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307-1024x189.png 1024w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307-300x55.png 300w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307-768x142.png 768w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307-1536x283.png 1536w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307-2048x378.png 2048w, https:\/\/fukugyouhistory.tokyo\/wp-content\/uploads\/2023\/03\/image-307.png 1920w\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u307e\u3060\u307e\u3060\u4e0a\u624b\u306b\u4f7f\u3046\u305f\u3081\u306e\u65b9\u6cd5\u306f\u305f\u304f\u3055\u3093\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u3053\u3053\u307e\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u306bSTABLE DIFFUSION + HUGGING FACE\u3000\u81ea\u52d5\u304a\u7d75\u304b\u304dAI\u3000\u7c21\u5358\u306b\u4f7f\u3063\u3066\u307f\u305f\u306e\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u3044\u307e\u3044\u3061\u30d7\u30ed\u30f3\u30d7\u30c8\uff08\u7d75\u3092\u4f5c\u6210\u3059\u308b\u3068\u304d\u306e\u6587\u5b57\uff09\u4f5c\u6210\u304c\u96e3\u3057\u3044\u3067\u3059\u3002\u4eca\u56de\u3001\u591a\u5c11\u3001\u4e0a\u624b\u306b\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":{"0":"post-995","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-ai"},"_links":{"self":[{"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=995"}],"version-history":[{"count":22,"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/995\/revisions"}],"predecessor-version":[{"id":1239,"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/995\/revisions\/1239"}],"wp:attachment":[{"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fukugyouhistory.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}