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
import tensorflow as tf | |
import numpy as np | |
import os | |
import matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
from init import xavier_init | |
from img_gen import plot |
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
import numpy | |
import math | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data | |
import matplotlib.pyplot as plt | |
import os | |
import numpy as np | |
from img_gen import plot |
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
from __future__ import division | |
import os | |
import numpy as np | |
import tensorflow as tf | |
import time | |
import math | |
import matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
from glob import glob | |
from six.moves import xrange |
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
import matplotlib.pyplot as plt | |
import matplotlib.gridspec as gridspec | |
# 縦横10枚ずつ画像を描画 | |
def plot(samples): | |
fig = plt.figure(figsize=(10, 10)) | |
gs = gridspec.GridSpec(10, 10) | |
gs.update(wspace=0.05, hspace=0.05) | |
for i, sample in enumerate(samples): |
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
def unpickle(f): | |
fo = open(f, 'rb') | |
d = cPickle.load(fo, encoding='latin1') | |
fo.close() | |
return d |
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
from layer.layers import * | |
from ops.operators import * | |
class began(Operator): # Operatorを継承 | |
# initialize | |
def __init__(self, sess): | |
self.sess = sess |
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
import sys, os | |
import glob | |
import time | |
import datetime | |
import numpy as np | |
import scipy.misc as scm | |
from function.img_read import * | |
from function.img_gen import * | |
from PIL import 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
def loss_calc(self): | |
# Cycle Consistency Loss | |
cyc_loss = tf.reduce_mean(tf.abs(self.x-self.cyc_x)) + tf.reduce_mean(tf.abs(self.y-self.cyc_y)) | |
# Adversarial Loss | |
# Discriminatorのloss(偽物を偽物と見分ける) | |
disc_loss_x = tf.reduce_mean(tf.squared_difference(self.fake_rec_x,1)) | |
disc_loss_y = tf.reduce_mean(tf.squared_difference(self.fake_rec_y,1)) |
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
# Generator | |
def generator(inputgen, name="generator", reuse=None): | |
if reuse: | |
scope.reuse_variables() | |
with tf.variable_scope(name): | |
f = 7 | |
ks = 3 | |
pad_input = tf.pad(inputgen,[[0, 0], [ks, ks], [ks, ks], [0, 0]], "REFLECT") |
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
# Discriminator | |
def discriminator(inputdisc, name="discriminator", reuse=None): | |
if reuse: | |
scope.reuse_variables() | |
with tf.variable_scope(name): | |
f = 4 | |
x = conv2d(inputdisc, ndf, f, f, 2, 2, 0.02, "SAME", "c1", do_norm=False, relufactor=0.2) | |
x = conv2d(x, ndf*2, f, f, 2, 2, 0.02, "SAME", "c2", relufactor=0.2) |
OlderNewer