Пример #1
0
def main(argv=None):
    model = DNN(train_images_dir='data/train/',
                val_images_dir='data/val/',
                test_images_dir='data/test/',
                num_epochs=40,
                train_batch_size=1000,
                val_batch_size=1000,
                test_batch_size=10000,
                height_of_image=28,
                width_of_image=28,
                num_channels=1,
                num_classes=10,
                learning_rate=0.001,
                base_dir='results',
                max_to_keep=2,
                model_name="DNN",
                model='DNN')

    model.create_network()
    model.initialize_network()

    if False:
        model.train_model(1, 1, 1, 4)
    else:
        model.test_model()
Пример #2
0
def main(argv=None):
    model = DNN(
        train_images_dir=FLAGS.train_images_dir,
        val_images_dir=FLAGS.val_images_dir,
        test_images_dir=FLAGS.test_images_dir,
        num_epochs=FLAGS.num_epochs,
        train_batch_size=FLAGS.train_batch_size,
        val_batch_size=FLAGS.val_batch_size,
        test_batch_size=FLAGS.test_batch_size,
        height_of_image=FLAGS.height_of_image,
        width_of_image=FLAGS.width_of_image,
        num_channels=FLAGS.num_channels,
        # num_classes=FLAGS.num_classes,
        learning_rate=FLAGS.learning_rate,
        base_dir=FLAGS.base_dir,
        max_to_keep=FLAGS.max_to_keep,
        model_name=FLAGS.model_name,
    )

    if FLAGS.train:
        model.create_network(model_type="train")
        model.initialize_network()
        model.train_model(FLAGS.display_step, FLAGS.validation_step,
                          FLAGS.checkpoint_step, FLAGS.summary_step)
    else:
        model.create_network(model_type="test")
        model.initialize_network()
        model.test_model()
Пример #3
0
def main(argv=None):
    model = DNN(
        train_spec_dir=FLAGS.train_spec_dir,
        val_spec_dir=FLAGS.val_spec_dir,
        test_spec_dir=FLAGS.test_spec_dir,
        num_epochs=FLAGS.num_epochs,
        train_batch_size=FLAGS.train_batch_size,
        val_batch_size=FLAGS.val_batch_size,
        test_batch_size=FLAGS.test_batch_size,
        sequence_length=FLAGS.sequence_length,
        fft_length=FLAGS.fft_length,
        learning_rate=FLAGS.learning_rate,
        base_dir=FLAGS.base_dir,
        max_to_keep=FLAGS.max_to_keep,
        model_name=FLAGS.model_name,
    )

    model.create_network()
    print('[*] Network created')
    model.initialize_network()
    print('[*] Network initialized')
    if FLAGS.train:
        model.train_model(FLAGS.display_step, FLAGS.validation_step, FLAGS.checkpoint_step, FLAGS.summary_step)
        print('[*] Model trained')
    else:
        model.test_model()
        print('[*] Model tested')