Commit 12ed746d authored by Andrei-Claudiu Roibu's avatar Andrei-Claudiu Roibu 🖥
Browse files

added function to stop shuffling data once done

parent 6f01a19e
......@@ -39,7 +39,7 @@ import as data
from solver import Solver
from BrainMapperUNet import BrainMapperUNet
from utils.data_utils import get_datasets, data_test_train_validation_split
from utils.data_utils import get_datasets, data_test_train_validation_split, update_shuffling_flag
import utils.data_evaluation_utils as evaluations
from utils.data_logging_utils import LogWriter
......@@ -133,7 +133,7 @@ def train(data_parameters, training_parameters, network_parameters, misc_paramet
if training_parameters['use_pre_trained']:
BrainMapperModel = torch.load(training_parameters['pre_trained_path'])
BrainMapperModel = torch.load(traikning_parameters['pre_trained_path'])
BrainMapperModel = BrainMapperUNet(network_parameters)
......@@ -355,7 +355,7 @@ if __name__ == '__main__':
if data_shuffling_flag == True:
# Here we shuffle the data!
data_test_train_validation_split(data_parameters['data_directory'], data_parameters['train_percentage'], data_parameters['validation_percentage'])
# TODO: This might also be a very good point to add cross-validation later
......@@ -21,6 +21,7 @@ import torch
import as data
import nibabel as nb
import random
import configparser
def directory_reader(folder_location, write_txt=False):
"""Produces a list of of data-tags which are accessible
......@@ -75,7 +76,19 @@ def data_test_train_validation_split(folder_location, train_percentage, validati
np.savetxt('validation.txt', validation)
def update_shuffling_flag(file_name):
""" Update shuffling flag
Changes shuffling flag in settings to False once data has been shuffled
file_name (str): The settings file name
config = configparser.ConfigParser()
config.set('DATA', 'data_split_flag', 'False')
with open(file_name, 'w') as configfile:
def tract_sum_generator(folder_path):
"""Sums the tracts of different dMRI files
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment