def main(args=None):
    datasets = read_data_sets()

    batches = BatchRenderer(
        datasets.train.images,
        datasets.train.landmarks,
        datasets.train.genders,
        datasets.train.smiles,
        datasets.train.glasses,
        datasets.train.poses,
        datasets.train.all_attr,
        FLAGS.batch_size)

    nn = CNN(
        input_shape=[FLAGS.batch_size, szImg, szImg, 1],
        n_filter=[20, 40, 60, 80],
        n_hidden=[120],
        n_y=n_y,
        receptive_field=[[4, 4], [3, 3], [3, 3], [2, 2]],
        pool_size=[[2, 2], [2, 2], [2, 2], [1, 1]])

    nn.train(
        batches,
        datasets.test,
        lr=FLAGS.lr,
        n_epoch=FLAGS.n_epoch,
        logdir=FLAGS.train_dir)
Example #2
0
def main(args=None):
    datasets = read_data_sets()

    batches = BatchRenderer(
        datasets.train.images,
        datasets.train.landmarks,
        datasets.train.genders,
        datasets.train.smiles,
        datasets.train.glasses,
        datasets.train.poses,
        datasets.train.all_attr,
        FLAGS.batch_size)

    nn = CSCNN(
        input_shape=[FLAGS.batch_size, szImg, szImg, 1],
        n_filter=[20, 40, 60, 80],
        n_hidden=[120],
        n_y_landmark=n_y_landmark,
        n_y_attribute=n_y_attribute,
        receptive_field=[[4, 4], [3, 3], [3, 3], [2, 2]],
        pool_size=[[2, 2], [2, 2], [2, 2], [1, 1]],
        apply_cross_stitch=[True, True, True, True, True],
        apply_weight_reg=[True, True, True, True, True],
        attribute=attribute,
        logdir=logdir)

    nn.train(
        batches,
        datasets.test,
        lr=FLAGS.lr,
        n_epoch=FLAGS.n_epoch)