示例#1
0
    size = np.int(512 / roi)

    padding_width = 4

    masks_all = np.zeros((len(masks) * size * size, roi + 2 * padding_width,
                          roi + 2 * padding_width))
    inputs_all = np.zeros((len(inputs) * size * size, roi + 2 * padding_width,
                           roi + 2 * padding_width, 3))
    previous_all = np.zeros(
        (len(inputs) * size * size, roi + 2 * padding_width,
         roi + 2 * padding_width, 3))
    nexts_all = np.zeros((len(inputs) * size * size, roi + 2 * padding_width,
                          roi + 2 * padding_width, 3))

    masks_all = read_masks(masks, size, roi, padding_width)
    inputs_all = read_inputs(inputs, size, roi, padding_width)
    previous_all = read_inputs(previouss, size, roi, padding_width)
    nexts_all = read_inputs(nexts, size, roi, padding_width)

    full_set_all = np.zeros(
        (inputs_all.shape[0], inputs_all.shape[1], inputs_all.shape[2], 9))
    full_set_all[:, :, :, 0:3] = previous_all
    full_set_all[:, :, :, 3:6] = inputs_all
    full_set_all[:, :, :, 6:9] = nexts_all

    num_items = full_set_all.shape[0]
    ind_train = np.int64(num_items * (1 - (1 / 4.8)))

    full_masks_test = masks_all[ind_train:]
    full_test_set = full_set_all[ind_train:]
        (len(inputs_train_list) * size * size, roi + 2 * padding_width,
         roi + 2 * padding_width, 3))

    masks_test = np.zeros((len(masks_test_list) * size * size,
                           roi + 2 * padding_width, roi + 2 * padding_width))
    inputs_test = np.zeros(
        (len(inputs_test_list) * size * size, roi + 2 * padding_width,
         roi + 2 * padding_width, 3))
    previous_test = np.zeros(
        (len(inputs_test_list) * size * size, roi + 2 * padding_width,
         roi + 2 * padding_width, 3))
    next_test = np.zeros((len(inputs_test_list) * size * size,
                          roi + 2 * padding_width, roi + 2 * padding_width, 3))

    masks_train = read_masks(masks_train_list, size, roi, padding_width)
    inputs_train = read_inputs(inputs_train_list, size, roi, padding_width)
    previous_train = read_inputs(previouss_train_list, size, roi,
                                 padding_width)
    next_train = read_inputs(nexts_train_list, size, roi, padding_width)

    masks_test = read_masks(masks_test_list, size, roi, padding_width)
    inputs_test = read_inputs(inputs_test_list, size, roi, padding_width)
    previous_test = read_inputs(previouss_test_list, size, roi, padding_width)
    next_test = read_inputs(nexts_test_list, size, roi, padding_width)

    # sort out black masks for training

    full_masks_train = masks_train
    full_masks_train = mirror_combine_data(full_masks_train)
    full_masks_train = np.vstack((full_masks_train, full_masks_train))
    ind = threshold_mean(full_masks_train, 0.01, 0.8)