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
k = np.float32([1,4,6,4,1]) | |
k = np.outer(k, k) | |
k5x5 = k[:,:,None,None]/k.sum()*np.eye(3, dtype=np.float32) | |
def lap_split(img): | |
'''Split the image into lo and hi frequency components''' | |
with tf.name_scope('split'): | |
lo = tf.nn.conv2d(img, k5x5, [1,2,2,1], 'SAME') | |
lo2 = tf.nn.conv2d_transpose(lo, k5x5*4, tf.shape(img), [1,2,2,1]) | |
hi = img-lo2 |
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
render_lapnorm(T(layer)[:,:,:,65]) |
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
render_lapnorm(T('mixed3b_1x1_pre_relu')[:,:,:,101]) |
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
render_lapnorm(T(layer)[:,:,:,65]+T(layer)[:,:,:,139], octave_n=4) |
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
def render_deepdream(t_obj, img0=img_noise, | |
iter_n=10, step=1.5, octave_n=4, octave_scale=1.4): | |
t_score = tf.reduce_mean(t_obj) # defining the optimization objective | |
t_grad = tf.gradients(t_score, t_input)[0] # behold the power of automatic differentiation! | |
# split the image into a number of octaves | |
img = img0 | |
octaves = [] | |
for i in range(octave_n-1): | |
hw = img.shape[:2] |
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
img0 = PIL.Image.open('pilatus800.jpg') | |
img0 = np.float32(img0) | |
showarray(img0/255.0) |
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
render_deepdream(tf.square(T('mixed4c')), img0) |
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
render_deepdream(T(layer)[:,:,:,139], img0) |
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
# -*- coding: utf-8 -*- | |
"""텐서보드에서 요약정보(summaries)를 보여주는 간단한 MNIST 분류기 | |
이 소스는 별로 특별하지 않은 MNIST 모델이다. 하지만, 텐서보드 그래프 탐색기에서 그래프를 읽을수 있게 | |
tf.name_scope를 사용하고, 텐서보드에서 의미있게 그룹핑되어 보여질 수 있도록 요약 태그(summary tag) | |
를 사용하는 방법을 배우기 위한 좋은 예제이다. | |
이 예제는 텐서보드 대시보드의 기능들을 보여준다. | |
""" |
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
// Anonymous Runnable | |
Runnable r1 = new Runnable(){ | |
@Override | |
public void run(){ | |
System.out.println("Hello world one!"); | |
} | |
}; | |
r1.run(); |