Пример #1
0
#load saved training data in cropped dimensions directly
print('loading train volumes')
train_imgs, train_labels = dt.load_cropped_img_labels(train_list)
#print('train shape',train_imgs.shape,train_labels.shape)

#load validation volumes id numbers to save the best model during training
val_list = data_list.val_data(parse_config.no_of_tr_imgs,
                              parse_config.comb_tr_imgs)
#load val data both in original dimensions and its cropped dimensions
print('loading val volumes')
val_label_orig, val_img_crop, val_label_crop, pixel_val_list = load_val_imgs(
    val_list, dt, orig_img_dt)

# get test volumes id list
print('get test volumes list')
test_list = data_list.test_data()
######################################

######################################
#define directory to save the model
save_dir = str(cfg.srt_dir) + '/models/' + str(
    parse_config.dataset) + '/trained_models/train_baseline/'

save_dir = str(save_dir) + '/with_data_aug/'

if (parse_config.rd_en == 1 and parse_config.ri_en == 1):
    save_dir = str(save_dir) + 'rand_deforms_and_ints_en/'
elif (parse_config.rd_en == 1):
    save_dir = str(save_dir) + 'rand_deforms_en/'
elif (parse_config.ri_en == 1):
    save_dir = str(save_dir) + 'rand_ints_en/'
Пример #2
0
#load saved training data in cropped dimensions directly
print('load train volumes')
train_imgs, train_labels = dt.load_cropped_img_labels(train_list)
#print('train shape',train_imgs.shape,train_labels.shape)

#load validation volumes id numbers to save the best model during training
val_list = data_list.val_data(parse_config.no_of_tr_imgs,
                              parse_config.comb_tr_imgs)
#load val data both in original dimensions and its cropped dimensions
print('load val volumes')
val_label_orig, val_img_crop, val_label_crop, pixel_val_list = load_val_imgs(
    val_list, dt, orig_img_dt)

# get test volumes id list
print('get test volumes list')
test_list = data_list.test_data(parse_config.no_of_tr_imgs)
######################################

######################################
# parameters values set for training of CNN
mean_f1_val_prev = 0.0000001
threshold_f1 = 0.0000001
step_val = parse_config.n_iter
start_epoch = 0
n_epochs = step_val

tr_loss_list, val_loss_list = [], []
tr_dsc_list, val_dsc_list = [], []
ep_no_list = []
loss_least_val = 1
f1_mean_least_val = 0.0000000001