This file contains 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 program takes in an image | |
-- and finds nc channels on a given layer | |
-- having the strongest activations | |
require 'torch' | |
require 'nn' | |
require 'image' | |
require 'loadcaffe' | |
function preprocess(img) |
This file contains 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
# git clone from https://github.com/tkarras/progressive_growing_of_gans | |
# download the snapshot from their Google drive | |
# use the following code in the same directory to generate random faces | |
import os | |
import sys | |
import time | |
import glob | |
import shutil | |
import operator | |
import theano |
This file contains 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
-- neural-style modified by @htoyryla 27 Oct 2017 | |
-- to use both gram matrix (as a statistical evaluation) and a mean of n featuremaps (to retain spatial sturcture of the style image) | |
-- to evaluate style | |
-- StyleLoss and GramMatrix have been copied from fast-neural-style | |
-- but modified to calculate a spatial mean of the feature maps | |
-- new param mean_weight to control the amount of mean for style | |
-- loss_type to select between L2 and SmoothL1 (as in fast-neural-style) | |
-- **** style_scale no longer works, the mean calculation requires that style image is resized as the content image **** | |
This file contains 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 is a modified version of neural_style.lua originally by @jcjohnson | |
-- @htoyryla 24 Oct 2017 | |
-- | |
-- original neural-style includes scaling of gram matrix output and gradient in the StyleLoss | |
-- using division by the number of elements in input | |
-- this is done to make the style representations from different layers (of different size) better comparable | |
-- but it also has the effect of decreasing gradients as the image size is increased | |
-- | |
-- this version attempts to keep the gradients from style loss modules in the same range | |
-- (i.e. that what is obtained at image size 512px) |
This file contains 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 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
-- neural-style by jcjohnson modified by @htoyryla | |
-- 13 May 2017 | |
-- generate style variants by modifying style target Gram matrix with randomized eigenvalues | |
-- see function randomizeEigenvalues() for details | |
require 'torch' | |
require 'nn' | |
require 'image' | |
require 'optim' |
This file contains 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
-- neural-style by jcjohnson modified by @htoyryla | |
-- 13 May 2017 | |
-- generate style variants by modifying style target Gram matrix with randomized eigenvalues | |
-- see function randomizeEigenvalues() for details | |
-- this version produces slight variants of a given style | |
-- by multiplying gram matrix eigenvalues by random multiplies 0.1 to 1.9 | |
require 'torch' | |
require 'nn' |
This file contains 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
--[[ | |
Neural-mirage 5 | |
by @htoyryla 3/2016, 3/2017 | |
based on neural-style by @jcjohnson | |
for more info see | |
http://liipetti.net/erratic/2016/03/31/i-have-seen-a-neural-mirage/ | |
http://liipetti.net/erratic/2016/04/20/getting-the-space-back/ |
This file contains 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
-- | |
-- a quickly modified version of jcjohnson/fast-neural-style/train.lua | |
-- using torch.display to monitor training using a test image run through the model every 50 iterations | |
-- | |
-- hannu toyryla @htoyryla 20 Nov 2016 | |
-- | |
-- use -test_image parameter to give test image | |
-- see https://github.com/szym/display for more information on torch display | |
-- | |
-- |
This file contains 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 program takes an original image, such as a photo, | |
-- and a generated image, such as generated by jcjohnson/fast-neural-style | |
-- and copies the original colors to the generated image | |
-- like when using the original_colors param in jcjohnson/neural-style | |
-- | |
-- by hannu töyrylä @htoyryla 30 oct 2016 | |
-- | |
require 'torch' | |
require 'image' |