This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import argparse | |
parser = argparse.ArgumentParser() | |
# Basic options | |
parser.add_argument("-content", help="Original content target image", default='examples/inputs/tubingen.jpg') | |
parser.add_argument("-generated", help="Stylized image", default='examples/outputs/tubingen_starry.png') | |
parser.add_argument("-output_image", default='out.png') | |
params = parser.parse_args() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This modified version of Neural-Style was created by github.com/ProGamerGov on 2017-09-29 | |
-- Use: "luarocks install paths" to install the required package. | |
-- The -style_image parameter will now automatically determine if the input is a directory, or a string of one or more images. | |
-- The FC layers as content layers feature comes from: | |
-- github.com/htoyryla's gist.github.com/htoyryla/806ca4d978f0528114282cd00022ad71 | |
-- Code from: https://github.com/jcjohnson/neural-style/pull/408 | |
-- The NIN ImageNet model uses dropout layers with random values, | |
-- so this version of neural_style.lua removes the unneeded dropout layers entirely. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This modified version of Neural-Style was created by github.com/ProGamerGov on 2017-09-29 | |
-- Use: "luarocks install paths" to install the required package. | |
-- The -style_image parameter will now automatically determine if the input is a directory, or a string of one or more images. | |
-- Code from: https://github.com/jcjohnson/neural-style/pull/408 | |
-- The NIN ImageNet model uses dropout layers with random values, | |
-- so this version of neural_style.lua removes the unneeded dropout layers entirely. | |
require 'torch' | |
require 'nn' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- modified by ProGamerGov to select the best content channels, in addition to style channels. | |
-- modified version of @jcjohnson's neural-style | |
-- by @htoyryla 13 Feb 2018 | |
-- allows giving emphasis to nc best channel(s) in each style layer | |
-- use -style_layers to select layer as usual, using a single layer is recommended | |
-- -nc to set how many of the best channels are used per layer | |
-- during target capture, tests the model using the style image | |
-- and selects nc channels with strongest activations to be given emphasis during iterations | |
-- not tested with multiple style images |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Modified from github.com/htoyryla's code here: https://github.com/htoyryla/convis/issues/2#issuecomment-365009705 | |
require 'torch' | |
require 'nn' | |
require 'image' | |
require 'loadcaffe' | |
function preprocess(img) | |
local mean_pixel = torch.DoubleTensor({103.939, 116.779, 123.68}) | |
local perm = torch.LongTensor{3, 2, 1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This version of neural_style.lua allows for the use of all of the Adam optimizer parameters. | |
-- The learning rate parameter also now affect's L-BFGS' learning rate. | |
-- The modifications were made based on the research done here: | |
-- https://github.com/jcjohnson/neural-style/issues/428#issuecomment-342618091 | |
-- github.com/ProGamerGov 2017-11-07 | |
require 'torch' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This modified version of Neural-Style was created by github.com/ProGamerGov on 2017-09-29 | |
-- Use: "luarocks install paths" to install the required package. | |
-- The -style_image parameter will now automatically determine if the input is a directory, or a string of one or more images. | |
require 'torch' | |
require 'nn' | |
require 'image' | |
require 'optim' | |
require 'paths' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Code from: https://github.com/jcjohnson/neural-style/pull/408 | |
-- The NIN ImageNet model uses dropout layers with random values, | |
-- so this version of neural_style.lua removes the unneeded dropout layers entirely. | |
require 'torch' | |
require 'nn' | |
require 'image' | |
require 'optim' | |
require 'loadcaffe' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#Usage: ./alternate.sh <input.png> | |
#Dependency: sudo apt-get install imagemagick | |
#Permission fix troubleshooting: chmod u+x ./alternate.sh | |
# 1. Defines the input image as a variable | |
input=$1 | |
input_file=`basename $input` | |
clean_name="${input_file%.*}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Matting laplacian code from: github.com/martinbenson/deep-photo-styletransfer/ | |
-- Generate the laplacian with: https://gist.github.com/ProGamerGov/290f26afccc5e013d1a8425ef6a594f2 | |
-- More details can be found in this gist: https://gist.github.com/ProGamerGov/d3988b914c92220ae45aa5bb1e31d6a7 | |
-- The original Neural Style code can be found here: https://github.com/jcjohnson/neural-style | |
require 'torch' | |
require 'nn' | |
require 'image' | |
require 'optim' |