Ejemplo n.º 1
0
Archivo: main.py Proyecto: Tramac/MURA
def main():
    config = Config()

    create_dirs([config.summary_dir, config.checkpoint_dir])

    sess = tf.Session()

    train_data = Dataset(config.root,
                         config.train_image_file,
                         config.type,
                         transform=Augmentaton(size=config.resize,
                                               mean=config.means[config.type],
                                               std=config.stds[config.type]),
                         max_samples=None)
    valid_data = Dataset(config.root,
                         config.valid_image_file,
                         config.type,
                         transform=Augmentaton(size=config.resize,
                                               mean=config.means[config.type],
                                               std=config.stds[config.type]),
                         max_samples=None)
    train_data_loader = DataLoader(train_data)
    valid_data_loader = DataLoader(valid_data)

    model = DenseNet(config)

    logger = Logger(sess, config)

    trainer = DenseNetTrainer(sess, model, train_data_loader,
                              valid_data_loader, config, logger)

    model.load(sess)

    if config.phase == "train":
        trainer.train()

    elif config.phase == "test":
        trainer.test("prediction.csv")
Ejemplo n.º 2
0
Archivo: eval.py Proyecto: Tramac/MURA
def evaluate():
    config = Config()
    valid_data = Dataset(config.root,
                         valid_image_paths,
                         config.type,
                         transform=Augmentaton(size=config.resize,
                                               mean=config.means[config.type],
                                               std=config.stds[config.type]),
                         max_samples=10)
    valid_data_loader = DataLoader(valid_data)

    sess = tf.Session()
    model = DenseNet(config)
    logger = Logger(sess, config)
    trainer = DenseNetTrainer(sess, model, valid_data_loader,
                              valid_data_loader, config, logger)

    model.load(sess)

    if config.phase == "train":
        trainer.train()

    elif config.phase == "test":
        trainer.test(output_prediction_path)