Ejemplo n.º 1
0
            st = time.time()

            output_image = sess.run(network, feed_dict={input: input_image})

            output_image = np.array(output_image[0, :, :, :])
            output_image = helpers.reverse_one_hot(output_image)
            out_eval_image = output_image[:, :, 0]
            out_vis_image = helpers.colour_code_segmentation(output_image)

            accuracy = utils.compute_avg_accuracy(out_eval_image, gt)
            class_accuracies = utils.compute_class_accuracies(
                out_eval_image, gt, num_classes)
            prec = utils.precision(out_eval_image, gt)
            rec = utils.recall(out_eval_image, gt)
            f1 = utils.f1score(out_eval_image, gt)
            iou = utils.compute_mean_iou(out_eval_image, gt)

            file_name = utils.filepath_to_name(val_input_names[ind])
            target.write("%s, %f, %f, %f, %f, %f" %
                         (file_name, accuracy, prec, rec, f1, iou))
            for item in class_accuracies:
                target.write(", %f" % (item))
            target.write("\n")

            scores_list.append(accuracy)
            class_scores_list.append(class_accuracies)
            precision_list.append(prec)
            recall_list.append(rec)
            f1_list.append(f1)
            iou_list.append(iou)
Ejemplo n.º 2
0
        output_image = sess.run(network, feed_dict={z: input_image})

        gt_map = cv2.imread(test_output_names[ind],
                            -1)[:args.crop_height, :args.crop_width]

        output_image = np.array(output_image[0, :, :, :])
        output_image = helpers.reverse_one_hot(output_image)
        output_image = output_image[:, :, 0]
        out_vis_image = helpers.colour_code_segmentation(output_image)

        accuracy = utils.compute_avg_accuracy(output_image, gt_map)
        class_accuracies = utils.compute_class_accuracies(output_image, gt_map)
        prec = utils.precision(output_image, gt_map)
        rec = utils.recall(output_image, gt_map)
        f1 = utils.f1score(output_image, gt_map)
        iou = utils.compute_mean_iou(output_image, gt_map)

        file_name = utils.filepath_to_name(test_input_names[ind])
        target.write("%s, %f, %f, %f, %f, %f" %
                     (file_name, accuracy, prec, rec, f1, iou))
        for item in class_accuracies:
            target.write(", %f" % (item))
        target.write("\n")

        scores_list.append(accuracy)
        class_scores_list.append(class_accuracies)
        precision_list.append(prec)
        recall_list.append(rec)
        f1_list.append(f1)
        iou_list.append(iou)