Ejemplo n.º 1
0
def show_debug_sample(data, label, predictions, data_dim, label_dim, std=1):
    img = []
    lbl = []
    for i in range(len(data)):
        prediction_image = from_arr_to_label(predictions[i], label_dim)
        label_image = from_arr_to_label(label[i], label_dim)
        temp = data[i] * std
        min_pixel = np.amin(temp)
        temp = temp + min_pixel

        data_image = from_arr_to_data(temp, data_dim)
        data_image.paste(prediction_image, (24, 24), prediction_image)
        data_image = data_image.resize((128, 128))
        img.append(data_image)

        lbldata_image = from_arr_to_data(temp, data_dim)
        lbldata_image.paste(label_image, (24, 24), label_image)
        lbldata_image = lbldata_image.resize((128, 128))
        lbl.append(lbldata_image)

    new_im = Image.new('RGB', (256,len(img)*128))
    for j in range(len(img)):
        new_im.paste(img[j], (0, j*128))
        new_im.paste(lbl[j], (128, j*128))
    new_im.show()
Ejemplo n.º 2
0
def show_debug_sample(data, label, predictions, data_dim, label_dim, std=1):
    img = []
    lbl = []
    for i in range(len(data)):
        prediction_image = from_arr_to_label(predictions[i], label_dim)
        label_image = from_arr_to_label(label[i], label_dim)
        temp = data[i] * std
        min_pixel = np.amin(temp)
        temp = temp + min_pixel

        data_image = from_arr_to_data(temp, data_dim)
        data_image.paste(prediction_image, (24, 24), prediction_image)
        data_image = data_image.resize((128, 128))
        img.append(data_image)

        lbldata_image = from_arr_to_data(temp, data_dim)
        lbldata_image.paste(label_image, (24, 24), label_image)
        lbldata_image = lbldata_image.resize((128, 128))
        lbl.append(lbldata_image)

    new_im = Image.new('RGB', (256, len(img) * 128))
    for j in range(len(img)):
        new_im.paste(img[j], (0, j * 128))
        new_im.paste(lbl[j], (128, j * 128))
    new_im.show()
Ejemplo n.º 3
0
def debug_input_data(data, label, data_dim, label_dim, delay=0):
    label_image = from_arr_to_label(label, label_dim)
    data_image= from_arr_to_data(data, data_dim)

    data_image.paste(label_image, (24, 24), label_image)
    data_image = data_image.resize((128, 128))
    data_image.show()
    time.sleep(delay)
Ejemplo n.º 4
0
def debug_input_data(data, label, data_dim, label_dim, delay=0):
    label_image = from_arr_to_label(label, label_dim)
    data_image = from_arr_to_data(data, data_dim)

    data_image.paste(label_image, (24, 24), label_image)
    data_image = data_image.resize((128, 128))
    data_image.show()
    time.sleep(delay)
Ejemplo n.º 5
0
    def show_individual_predictions(self, dataset, predictions, std=1):
        print("Show each individual prediction")
        images = np.array(dataset[0].eval())
        for i in range(images.shape[0]):
            min_val = np.amin(images[i])
            img =from_arr_to_data((images[i]*std + min_val), 64)

            pred = predictions[i]
            clip_idx = pred < 0.3
            pred[clip_idx] = 0
            lab = from_arr_to_label(pred, 16)

            img.paste(lab, (24, 24), lab)
            img = img.resize((256, 256))
            img.show()
            user = raw_input('Proceed?')
            if user == 'no':
                break