From 4810853b7a7c672ef8527ef78639a0d7bf422eab Mon Sep 17 00:00:00 2001 From: Qwertystop Date: Wed, 6 Jul 2016 22:44:46 -0400 Subject: [PATCH 1/2] Added minor feature: Ability to initialize image with arbitrary other image. --- neural_style.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neural_style.lua b/neural_style.lua index 00b68f0..0a4b73c 100644 --- a/neural_style.lua +++ b/neural_style.lua @@ -249,7 +249,10 @@ local function main(params) elseif params.init == 'image' then img = content_image_caffe:clone():float() else - error('Invalid init type') + -- Read other init arguments as path to initial image + local alternate_initial_image = image.load(params.alternate_initial_image, 3) + alternate_initial_image = image.scale(alternate_initial_image, params.image_size, 'bilinear') + img = preprocess(alternate_initial_image):float() end if params.gpu >= 0 then if params.backend ~= 'clnn' then From cffdd124aeefb7d62eee4dd24636f599f14596d7 Mon Sep 17 00:00:00 2001 From: Qwertystop Date: Thu, 7 Jul 2016 18:48:15 -0400 Subject: [PATCH 2/2] Typo fixed --- neural_style.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neural_style.lua b/neural_style.lua index 0a4b73c..8fc6a9a 100644 --- a/neural_style.lua +++ b/neural_style.lua @@ -250,7 +250,7 @@ local function main(params) img = content_image_caffe:clone():float() else -- Read other init arguments as path to initial image - local alternate_initial_image = image.load(params.alternate_initial_image, 3) + local alternate_initial_image = image.load(params.init, 3) alternate_initial_image = image.scale(alternate_initial_image, params.image_size, 'bilinear') img = preprocess(alternate_initial_image):float() end