Nothing interesting, Just a playground

Playing with several papers and storing results here.


In [77]:
import numpy as np
import matplotlib 
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import pylab

import glob
from PIL import Image

%matplotlib inline

Francisco Goya's Black Paintings

For this experiment I'll use Goya's black paintings.


In [51]:
paintings = list(set(glob.glob('*/*.jpg')) - set(glob.glob('contents/*')) - set(glob.glob('outputs/*')))

In [45]:
f, ax = plt.subplots(nrows=3, ncols=5)

for i, row in enumerate(ax):
    for j, col in enumerate(row):
        col.imshow(mpimg.imread(paintings[i*3 + j]))

f.set_size_inches(24, 6)


Multi-scale neural texture synthesis by Xavier Snelgrove

Link to source code


In [5]:
synthesized_textures = glob.glob('*/Syn*.png')

In [18]:
f, ax = plt.subplots(nrows=2, ncols=7)

for i, row in enumerate(ax):
    for j, col in enumerate(row):
        col.imshow(mpimg.imread(synthesized_textures[i*2 + j]))

f.set_size_inches(28,8)



In [65]:
contents = glob.glob('contents/*.jpg')

In [125]:
f, ax = plt.subplots(nrows=2, ncols=2)

for i, row in enumerate(ax):
    for j, col in enumerate(row):
        col.imshow(mpimg.imread(contents[i*2 + j]))

f.set_size_inches(15,10)


Transfering style using "Universal Style Transfer via Feature Transforms"

Link to source code


In [121]:
# SOURCE : http://www.pmavridis.com/misc/heatmaps/
adler_1 = mpimg.imread('outputs/adler/adler_1.jpg')
adler_2 = mpimg.imread('outputs/adler/adler_Syn1.jpg')

# Calculate the absolute difference on each channel separately
error_r = np.fabs(np.subtract(adler_2[:,:,0], adler_1[:,:,0]))
error_g = np.fabs(np.subtract(adler_2[:,:,1], adler_1[:,:,1]))
error_b = np.fabs(np.subtract(adler_2[:,:,2], adler_1[:,:,2]))

# Calculate the maximum error for each pixel
lum_img = np.maximum(np.maximum(error_r, error_g), error_b)

from pylab import rcParams
rcParams['figure.figsize'] = 20, 40

plt.subplot(1, 3, 1)
plt.imshow(adler_1) # 
plt.title('Original Image as Style')

plt.subplot(1, 3, 2)
plt.imshow(adler_2)
plt.title('Synthesized Texture as Style')

plt.subplot(1, 3, 3)
plt.imshow(lum_img.astype(np.uint8))
plt.set_cmap('jet')
plt.title('Difference')

plt.show()



In [123]:
# SOURCE : http://www.pmavridis.com/misc/heatmaps/
adler_1 = mpimg.imread('outputs/raven/raven_8.jpg')
adler_2 = mpimg.imread('outputs/raven/raven_Syn8.jpg')

# Calculate the absolute difference on each channel separately
error_r = np.fabs(np.subtract(adler_2[:,:,0], adler_1[:,:,0]))
error_g = np.fabs(np.subtract(adler_2[:,:,1], adler_1[:,:,1]))
error_b = np.fabs(np.subtract(adler_2[:,:,2], adler_1[:,:,2]))

# Calculate the maximum error for each pixel
lum_img = np.maximum(np.maximum(error_r, error_g), error_b)

from pylab import rcParams
rcParams['figure.figsize'] = 20, 40

plt.subplot(1, 3, 1)
plt.imshow(adler_1) # 
plt.title('Original Image as Style')

plt.subplot(1, 3, 2)
plt.imshow(adler_2)
plt.title('Synthesized Texture as Style')

plt.subplot(1, 3, 3)
plt.imshow(lum_img.astype(np.uint8))
plt.set_cmap('jet')
plt.title('Difference')

plt.show()



In [124]:
# SOURCE : http://www.pmavridis.com/misc/heatmaps/
adler_1 = mpimg.imread('outputs/joker/joker_10.jpg')
adler_2 = mpimg.imread('outputs/joker/joker_Syn10.jpg')

# Calculate the absolute difference on each channel separately
error_r = np.fabs(np.subtract(adler_2[:,:,0], adler_1[:,:,0]))
error_g = np.fabs(np.subtract(adler_2[:,:,1], adler_1[:,:,1]))
error_b = np.fabs(np.subtract(adler_2[:,:,2], adler_1[:,:,2]))

# Calculate the maximum error for each pixel
lum_img = np.maximum(np.maximum(error_r, error_g), error_b)

from pylab import rcParams
rcParams['figure.figsize'] = 20, 40

plt.subplot(1, 3, 1)
plt.imshow(adler_1) # 
plt.title('Original Image as Style')

plt.subplot(1, 3, 2)
plt.imshow(adler_2)
plt.title('Synthesized Texture as Style')

plt.subplot(1, 3, 3)
plt.imshow(lum_img.astype(np.uint8))
plt.set_cmap('jet')
plt.title('Difference')

plt.show()