Exemplo n.º 1
0
 def setUp(self):
     brats_db = Loader.create(config_dict=DB.BRATS2017)
     subject_list = brats_db.load_subjects()
     self.subject = subject_list[0]
Exemplo n.º 2
0
                                     loss_name=params[p.LOSS])
    else:
        model = BraTS_models.compile(model,
                                     lr=params[p.LR],
                                     model_type=params[p.MODEL_TYPE],
                                     loss_name=params[p.LOSS])

    # plot_file = join(dir_path, filename +'.png')
    # plot_model(model, to_file=plot_file)

    json_string = model.to_json()
    open(join(dir_path, filename + '_model.json'), 'w').write(json_string)

    print("Architecture defined ...")
    """ DATA LOADING """
    brats_db = Loader.create(config_dict=DB.BRATS2017)
    subject_list = brats_db.load_subjects()

    dataset = Dataset_train(
        input_shape=tuple(params[p.INPUT_DIM]),
        output_shape=tuple(params[p.INPUT_DIM]),
        n_classes=params[p.N_CLASSES],
        n_subepochs=params[p.N_SUBEPOCHS],
        batch_size=params[p.BATCH_SIZE],
        sampling_scheme=params[p.SAMPLING_SCHEME],
        sampling_weights=params[p.SAMPLING_WEIGHTS],
        n_subjects_per_epoch_train=params[p.N_SUBJECTS_TRAIN],
        n_segments_per_epoch_train=params[p.N_SEGMENTS_TRAIN],
        n_subjects_per_epoch_validation=params[p.N_SUBJECTS_VALIDATION],
        n_segments_per_epoch_validation=params[p.N_SEGMENTS_VALIDATION],
        train_size=params[p.TRAIN_SIZE],
Exemplo n.º 3
0
        model_type=params[p.MODEL_TYPE][1],
        l1=0.00001,
        l2=0.001,
        momentum=0.99,
        mode='test')

    weights_filepath_2 = '/imatge/acasamitjana/work/segmentation/BraTS/mask_seg/20170815/LR_0.0005_mask_seg_dice_momentum0.99_brainmask/model_weights/brats2017_epoch32.h5'
    model2.load_weights(weights_filepath_2)
    model2 = BraTS_models.compile(model2,
                                  lr=params[p.LR],
                                  model_type=params[p.MODEL_TYPE][1],
                                  loss_name=params[p.LOSS])

    print("Architecture defined ...")
    """ DATA LOADING """
    brats_db = Loader.create(config_dict=DB.BRATS2017_Validation)
    subject_list = brats_db.load_subjects()

    dataset = Dataset_train(
        input_shape=tuple(params[p.INPUT_DIM]),
        output_shape=tuple(params[p.INPUT_DIM]),
        n_classes=params[p.N_CLASSES],
        n_subepochs=params[p.N_SUBEPOCHS],
        batch_size=params[p.BATCH_SIZE],
        sampling_scheme=params[p.SAMPLING_SCHEME],
        sampling_weights=params[p.SAMPLING_WEIGHTS],
        n_subjects_per_epoch_train=params[p.N_SUBJECTS_TRAIN],
        n_segments_per_epoch_train=params[p.N_SEGMENTS_TRAIN],
        n_subjects_per_epoch_validation=params[p.N_SUBJECTS_VALIDATION],
        n_segments_per_epoch_validation=params[p.N_SEGMENTS_VALIDATION],
        train_size=params[p.TRAIN_SIZE],