def test_merge_w_channels(self): X_train, Y_train = get_ds_simple(cnt_samples=10) X_train = np.expand_dims(X_train, axis=1).astype(np.float32) / 255 Y_train = Y_train[:, np.newaxis] print(X_train.shape, Y_train.shape) im = merge_samples(X_train, Y_train) im.save("/tmp/simple_channel.png")
def test_size(self): X_train, Y_train = get_ds_simple(dim_image=128, cnt_samples=10) print(X_train.shape, Y_train.shape) im = merge_samples(X_train, Y_train) im.save("/tmp/size128.png")
import numpy as np import chainer import chainer.functions as F import chainer.links as L import dagen import dagen.image from dagen.image.image import get_ds_simple from ..trainer import train params = {} params["batch_size"] = 8 X_train, Y_train = get_ds_simple(cnt_samples=1000) X_test, Y_test = get_ds_simple(cnt_samples=100) X_train = np.expand_dims(X_train, axis=1).astype(np.float32) / 255 Y_train = Y_train[:, np.newaxis] X_test = np.expand_dims(X_test, axis=1).astype(np.float32) / 255 Y_test = Y_test[:, np.newaxis] print(X_train.shape) print(Y_train.shape) class Net(chainer.Chain): def __init__(self, train=True): super(Net, self).__init__( conv1=L.Convolution2D(1, 16, 2), conv2=L.Convolution2D(None, 16, 2), l1=L.Linear(None, 10),
def test_simple(self): X_train, Y_train = get_ds_simple(cnt_samples=10) print(X_train.shape, Y_train.shape) im = merge_samples(X_train, Y_train) im.save("/tmp/simple.png")
import chainer import chainer.functions as F import chainer.links as L import dagen import dagen.image from dagen.image.image import get_ds_simple from dagen.image.image import merge_samples from ..trainer import train params = {"nb_epoch": 10} params["batch_size"] = 8 params["gpus"] = [0] X_train, Y_train = get_ds_simple(dim_image=32, cnt_samples=1000) X_train = np.expand_dims(X_train, axis=1).astype(np.float32) / 255 print(X_train.shape) class Net(chainer.Chain): def __init__(self, train=True): super(Net, self).__init__( conv_e_1=L.Convolution2D(None, 32, 3, pad=1), conv_e_2=L.Convolution2D(None, 32, 3, pad=1), conv_e_3=L.Convolution2D(None, 32, 3, pad=1), conv_d_1=L.Convolution2D(None, 32, 3, pad=1), conv_d_2=L.Convolution2D(None, 32, 3, pad=1), conv_d_3=L.Convolution2D(None, 32, 3, pad=1), conv_d_4=L.Convolution2D(None, 1, 3, pad=1), # dc1 = L.Deconvolution2D(in_channels=None, out_channels=32, ksize=2, stride=2, pad=0 ),