diff --git a/assets/index.html b/assets/index.html index f661590..90b9f98 100644 --- a/assets/index.html +++ b/assets/index.html @@ -4,7 +4,8 @@ waifu2x - + + @@ -17,7 +18,7 @@ en/ja/ru
-
Single-Image Super-Resolution for anime/fan-art using Deep Convolutional Neural Networks. about.
+
Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. Also it is supported photo. about.
@@ -32,6 +33,11 @@ Limits: Size: 2MB, Noise Reduction: 2560x2560px, Upscaling: 1280x1280px
+
+ Style + + +
Noise Reduction (expect JPEG Artifact) diff --git a/assets/index.ja.html b/assets/index.ja.html index 58d1f4d..f2100e0 100644 --- a/assets/index.ja.html +++ b/assets/index.ja.html @@ -5,6 +5,7 @@ waifu2x + @@ -17,7 +18,7 @@ en/ja/ru
-
深層畳み込みニューラルネットワークによる二次元画像のための超解像システム. about.
+
深層畳み込みニューラルネットワークによる二次元画像のための超解像システム. 写真にも対応. about.
@@ -32,6 +33,11 @@ 制限: サイズ: 2MB, ノイズ除去: 2560x2560px, 拡大: 1280x1280px
+
+ スタイル + + +
ノイズ除去 (JPEGノイズを想定) diff --git a/assets/index.ru.html b/assets/index.ru.html index e9134bb..749ab06 100644 --- a/assets/index.ru.html +++ b/assets/index.ru.html @@ -6,6 +6,7 @@ waifu2x + @@ -33,6 +34,11 @@ Макс. размер файла — 2MB, устранение шума — макс. 2560x2560px, апскейл — 1280x1280px
+
+ Стиль + + +
Устранение шума (артефактов JPEG) diff --git a/assets/ui.js b/assets/ui.js index 0d93ff4..8d0d569 100644 --- a/assets/ui.js +++ b/assets/ui.js @@ -1,4 +1,5 @@ $(function (){ + var expires = 365; function clear_file() { var new_file = $("#file").clone(); new_file.change(clear_url); @@ -19,6 +20,7 @@ $(function (){ } else { $("h1").html("w/a/ifu2x"); } + $.cookie("style", checked.val(), {expires: expires}); } function on_change_noise_level(e) { @@ -30,6 +32,7 @@ $(function (){ if (checked.val() != 0) { checked.parents("label").css("font-weight", "bold"); } + $.cookie("noise", checked.val(), {expires: expires}); } function on_change_scale_factor(e) { @@ -41,40 +44,29 @@ $(function (){ if (checked.val() != 0) { checked.parents("label").css("font-weight", "bold"); } + $.cookie("scale", checked.val(), {expires: expires}); } - function on_change_white_noise(e) + function restore_from_cookie() { - $("input[name=white_noise]").parents("label").each( - function (i, elm) { - $(elm).css("font-weight", "normal"); - }); - var checked = $("input[name=white_noise]:checked"); - if (checked.val() != 0) { - checked.parents("label").css("font-weight", "bold"); + if ($.cookie("style")) { + $("input[name=style]").filter("[value=" + $.cookie("style") + "]").prop("checked", true) } - } - function on_click_experimental_button(e) - { - if ($(this).hasClass("close")) { - $(".experimental .container").show(); - $(this).removeClass("close"); - } else { - $(".experimental .container").hide(); - $(this).addClass("close"); + if ($.cookie("noise")) { + $("input[name=noise]").filter("[value=" + $.cookie("noise") + "]").prop("checked", true) + } + if ($.cookie("scale")) { + $("input[name=scale]").filter("[value=" + $.cookie("scale") + "]").prop("checked", true) } - e.preventDefault(); - e.stopPropagation(); } $("#url").change(clear_file); $("#file").change(clear_url); - //$("input[name=style]").change(on_change_style); + $("input[name=style]").change(on_change_style); $("input[name=noise]").change(on_change_noise_level); $("input[name=scale]").change(on_change_scale_factor); - //$("input[name=white_noise]").change(on_change_white_noise); - //$(".experimental .button").click(on_click_experimental_button) - - //on_change_style(); + + restore_from_cookie(); + on_change_style(); on_change_scale_factor(); on_change_noise_level(); }) diff --git a/web.lua b/web.lua index 7fb8076..a59a325 100644 --- a/web.lua +++ b/web.lua @@ -12,8 +12,9 @@ local iproc = require 'iproc' local reconstruct = require 'reconstruct' local image_loader = require 'image_loader' local alpha_util = require 'alpha_util' +local gm = require 'graphicsmagick' --- Notes: turbo and xlua has different implementation of string:split(). +-- Note: turbo and xlua has different implementation of string:split(). -- Therefore, string:split() has conflict issue. -- In this script, use turbo's string:split(). local turbo = require 'turbo' @@ -36,13 +37,13 @@ if cudnn then cudnn.benchmark = false end local ART_MODEL_DIR = path.join(ROOT, "models", "anime_style_art_rgb") -local PHOTO_MODEL_DIR = path.join(ROOT, "models", "ukbench") +local PHOTO_MODEL_DIR = path.join(ROOT, "models", "photo") local art_noise1_model = torch.load(path.join(ART_MODEL_DIR, "noise1_model.t7"), "ascii") local art_noise2_model = torch.load(path.join(ART_MODEL_DIR, "noise2_model.t7"), "ascii") local art_scale2_model = torch.load(path.join(ART_MODEL_DIR, "scale2.0x_model.t7"), "ascii") ---local photo_scale2_model = torch.load(path.join(PHOTO_MODEL_DIR, "scale2.0x_model.t7"), "ascii") ---local photo_noise1_model = torch.load(path.join(PHOTO_MODEL_DIR, "noise1_model.t7"), "ascii") ---local photo_noise2_model = torch.load(path.join(PHOTO_MODEL_DIR, "noise2_model.t7"), "ascii") +local photo_scale2_model = torch.load(path.join(PHOTO_MODEL_DIR, "scale2.0x_model.t7"), "ascii") +local photo_noise1_model = torch.load(path.join(PHOTO_MODEL_DIR, "noise1_model.t7"), "ascii") +local photo_noise2_model = torch.load(path.join(PHOTO_MODEL_DIR, "noise2_model.t7"), "ascii") local CLEANUP_MODEL = false -- if you are using the low memory GPU, you could use this flag. local CACHE_DIR = path.join(ROOT, "cache") local MAX_NOISE_IMAGE = 2560 * 2560 @@ -143,7 +144,7 @@ local function convert(x, alpha, options) x = reconstruct.image(art_noise2_model, x) cleanup_model(art_noise2_model) end - else --[[photo + else -- photo if options.border then x = alpha_util.make_border(x, alpha, reconstruct.offset_size(photo_scale2_model)) end @@ -163,7 +164,6 @@ local function convert(x, alpha, options) x = reconstruct.image(photo_noise2_model, x) cleanup_model(photo_noise2_model) end - --]] end image_loader.save_png(cache_file, x)