Ejemplo n.º 1
0
def main():
    # ------------------------------------------------ Training Phase ------------------------------------------------
    # image_files = random.sample(glob.glob('E:\\work\\pedestrian_crop_python_process\\Pedestrain_cropDB\\train\\0\\*.bmp'), 10)
    # image_files = random.sample(glob.glob('data/0.normal/*.bmp'), 10)
    # data_in = data_read(image_files)

    opt = Options().parse()
    opt.iwidth = map_x_size
    opt.iheight = map_y_size

    #---new--- depth for size
    ctinit = map_x_size
    while ctinit > 4:
        ctinit = ctinit / 2
    opt.ctinit = int(ctinit)
    #---new---

    opt.batchsize = 64
    opt.epochs = 1000
    opt.mask = 0  # 1: masking for simulation map
    opt.time = datetime.now()

    train_dataloader = load_data(
        './data/unsupervised/train/')  # path to trainset
    result_path = './results/{0}/'.format(
        opt.time)  # reconstructions durnig the training
    if not os.path.isdir(result_path):
        os.mkdir(result_path)

    # dataloader = load_data(opt, data_in)
    model = AAE_basic(opt, train_dataloader)
    model.train()
map_x_size = 64
map_y_size = 64
map_layer_num = 3

opt = Options().parse()
opt.iwidth = map_x_size
opt.iheight = map_y_size
opt.batchsize = 1
opt.ngpu = 0
opt.gpu_ids = -1

# ---new---
ctinit = map_x_size
while ctinit > 4:
    ctinit = ctinit / 2
opt.ctinit = int(ctinit)
# ---new---

# opt.mask = 1

model_saved = False
d_loss = None
g_loss = None
recon_loss = None
z_loss = None

N = 1000
fake = None
P = None
Q = None
D = None