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
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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 version of @jcjohnson's neural-style | |
-- by @htoyryla 14 May 2017 | |
-- allows exploring th effect of giving emphasis to specific channel(s) in a style layer | |
-- use -style_layers to select layer as usual, using a single layer is recommended | |
-- -style_channels to specify one or more channels to be given emphasis, other channels will be attenuated | |
-- if a channel does not exist in a layer, it is ignored and given a warning | |
-- note: if multiple style layers are used, style_channels setting affects both | |
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
-- 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' |
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
-- 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
-- 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
-- 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
-- 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
-- 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
-- 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' |