示例#1
0
mb_size = 100 # mini-batch_size
Z_dim = 100
label_dim = 18
X_dim = 64
y_dim = 1
cnt = 0

num = '0'
out_dir = './cifar100_result/basic_{}_{}/'.format(datetime.now(),num)
out_dir.replace(" ","_")

if not os.path.exists(out_dir):
    os.makedirs(out_dir)
    shutil.copyfile(sys.argv[0], out_dir + '/shuideguo.py')

sys.stdout = mutil.Logger(out_dir)
in_channel=4
d_num = 3

# G = model.G_Net_conv_64(ngpu,main_gpu = gpu, in_channel = Z_dim+label_dim,out_channel=3).cuda()
G_model = torch.load("/home/bike/2027/generative-models/GAN/conditional_gan/cifar100_result/basic_2017-05-15 19:57:38.738341_0/G_10000.model")
D_model = torch.load("/home/bike/2027/generative-models/GAN/conditional_gan/cifar100_result/basic_2017-05-15 19:57:38.738341_0/D_10000.model")
# D = model.D_Net_conv_64(ngpu,main_gpu=gpu,inchannel=3).cuda()
D_hidden_layer = 128
conv_hidden_num = 128


repeat_num = int(np.log2(X_dim)) - 2

D = DiscriminatorCNN(input_channel=3, z_num= D_hidden_layer, repeat_num=repeat_num, hidden_num=conv_hidden_num, num_gpu=gpu_ids)
G = GeneratorCNN(label_dim+Z_dim, D.conv2_input_dim, output_num=3, repeat_num=repeat_num, hidden_num=conv_hidden_num, num_gpu=gpu_ids)
示例#2
0
from datetime import datetime

mpl.use('Agg')

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
from torch.autograd import Variable
from tensorflow.examples.tutorials.mnist import input_data
import torch.nn as nn
import torch.nn.functional as F
import shutil, sys
import mutil
import model

sys.stdout = mutil.Logger()
gpu = 1

torch.cuda.set_device(gpu)
mnist = input_data.read_data_sets('../../MNIST_data', one_hot=True)
mb_size = 64  # mini-batch_size
Z_dim = 100
X_dim = mnist.train.images.shape[1]
y_dim = mnist.train.labels.shape[1]
h_dim = 128
cnt = 0

num = '0'
out_dir = 'out_fc_{}_{}/'.format(datetime.now(), num)
if not os.path.exists(out_dir):
    os.makedirs(out_dir)