Exemple #1
0
def prepare_line():
    train_data_names = read_data_names('./train_labels')
    test_data_names = read_data_names('./test_labels')

    train_images = read_images('./train_images', data_names=train_data_names)
    train_labels = read_labels('./train_labels')
    # train_data_names = read_data_names('./train_labels')

    test_labels = read_labels('./test_labels')
    test_images = read_images('./test_images', test_data_names)
    # test_data_names = read_data_names('./test_labels')

    for ind, image in enumerate(train_images):
        print(ind)
        H, W, C = image.shape
        lab = train_labels[ind]
        seg = draw_line(lab, H, W)
        np.save('./train_lines/{}.npy'.format(ind), seg)

    for ind, image in enumerate(test_images):
        print('test {}'.format(ind))
        H, W, C = image.shape
        lab = test_labels[ind]
        seg = draw_line(lab, H, W)
        np.save('./test_lines/{}.npy'.format(ind), seg)

    seg = np.load('./train_labels/1.npy')
    ln = np.load('./train_lines/1.npy')
    plt.figure()
    plot_image(seg, segmap=ln)
    plt.show()
Exemple #2
0
def prepare_seg():
    train_data_names = read_data_names('./train_labels')
    test_data_names = read_data_names('./test_labels')

    train_images = read_images('./train_images', data_names=train_data_names)
    train_labels = read_labels('./train_labels')
    # train_data_names = read_data_names('./train_labels')

    test_labels = read_labels('./test_labels')
    test_images = read_images('./test_images', test_data_names)
    # test_data_names = read_data_names('./test_labels')

    for ind, image in enumerate(train_images):
        H, W, C = image.shape
        lab = train_labels[ind]
        seg = draw_seg(lab, H, W)
        np.save('./train_labels/{}.npy'.format(ind), seg)

    for ind, image in enumerate(test_images):
        H, W, C = image.shape
        lab = test_labels[ind]
        seg = draw_seg(lab, H, W)
        np.save('./test_labels/{}.npy'.format(ind), seg)
        os.path.join(
            pred_path, title, 'result_' + title + '_%.2f' %
            (np.average(w2_errors) * 100) + '.csv'))

    return result_list


if __name__ == '__main__':
    plt.rcParams["figure.figsize"] = (8, 16)
    #test랑 record 변환은 메인에서 하지말고 여기서만 하면됨

    record_label_location = './record_cr_labels'
    record_data_location = './record_cr_images'
    record_data_names = read_data_names(record_label_location)
    record_labels = read_labels(record_label_location)
    record_images = read_images(record_data_location, record_data_names)

    pred_path = './model/TRTEST_ep4278'
    postprocess_inte(pred_path=pred_path,
                     images=record_images,
                     labels_gt_abs=record_labels,
                     title=None,
                     save_plot=True,
                     method2_on=True,
                     method1_on=False,
                     original_display=True)

    ###Validation set

    test_label_location = './test_labels'
    test_data_location = './test_images'
Exemple #4
0
    plt.rcParams["figure.figsize"] = (4, 8)
    # test_label_location = './test_labels'
    # test_data_location = './test_images'
    # test_data_names = read_data_names(test_label_location)
    # test_labels = read_labels(test_label_location)
    # test_images = read_images(test_data_location, test_data_names)

    train_label_location = './train_labels'
    train_image_location = './train_images'

    out_path = './plots'

    train_labels = read_labels(train_label_location)
    train_data_names = read_data_names(train_label_location)

    train_images = read_images(train_image_location, train_data_names)

    count = 0

    for ind, image in enumerate(train_images):
        label = train_labels[ind]
        plt.figure()
        #title = 'train_vanila'
        H, W, C = image.shape
        gt = label
        gt_angles, gt_pos = calc_angle_old(gt, (H, W), full=True)
        _fp = gt.reshape(-1, 2, 2).copy()
        for pos in gt_pos:
            dots = np.average(_fp[2 * pos:2 * pos + 2, :, :], axis=0)
            if True:
                plt.plot(dots[:, 0], dots[:, 1], 'g')
Exemple #5
0
        return cobb_angles, pos
    else:
        return cobb_angles

from label_io import read_labels, read_images, read_data_names
import pandas as pd
if __name__ == '__main__':
    ####    Testing demo algorithm


    data_names_train = read_data_names('./train_labels')
    labels_now = read_labels('./train_labels')
    labels_ori = read_labels('./train_labels', title ='labels_original')
    labels_m = read_labels('./train_labels', title ='labels_m')
    train_images_location = './train_images'
    train_images = read_images(train_images_location, data_names=data_names_train)

    images = read_images('./train_images', data_names_train)

    # for ind, im in enumerate(images):
    #     lab_m = labels_m[ind]
    #     lab_ori = labels_ori[ind]
    #
    #     if np.sum(np.abs((lab_m - lab_ori)))>=1:
    #         plt.figure()
    #         plot_image(im, coord_red=lab_ori, coord_gr=lab_m)
    #         plt.show()

    #
    ####    gt angle
    gtangle = pd.read_csv('./train_labels/angles.csv', header=None, index_col=None)