예제 #1
0
def main():
    ap = argparse.ArgumentParser()

    ap.add_argument('--arch', required=True, nargs='+', type=int)
    ap.add_argument('--lr', required=False, type=int, default=.01)
    ap.add_argument('--epochs', required=False, type=int, default=100)
    ap.add_argument('--iters', required=True, type=int)
    ap.add_argument('--trials', required=True, type=int)
    ap.add_argument('--env', required=True)
    ap.add_argument('--t', required=True, type=int)

    args = vars(ap.parse_args())
    opt = Options()

    opt.envname = args['env']
    opt.trials = args['trials']
    opt.iters = args['iters']
    opt.epochs = args['epochs']
    opt.lr = args['lr']
    opt.arch = args['arch']
    opt.t = args['t']

    opt.filename = '/Users/JonathanLee/experts/' + opt.envname + '.pkl'
    opt.env = gym.envs.make(opt.envname).env
    opt.sim = gym.envs.make(opt.envname).env
    opt.pi = load_policy.load_policy(opt.filename)
    opt.sess = tf.Session()
    opt.sup = NetSupervisor(opt.pi, opt.sess)

    run_trial(opt)
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()