def __init__(self,
                 images_dir,
                 picture_amount_threshold,
                 feature_method_list,
                 row_threshold,
                 column_threshold,
                 picture_resolution,
                 label_threshold,
                 ground_truth_dir,
                 abs_flag,
                 log_flag,
                 grey_picture=False,
                 auto_canny=True,
                 auto_canny_sigma=0.33):

        saved_args = locals()
        Arguments.logArguments('FeatureDataSet', saved_args)

        self.create_grey_dir = False
        self.images_dir = images_dir
        self.picture_amount_threshold = picture_amount_threshold  # number of pictures
        self.grey_picture = grey_picture  # load picture as grey/color
        self.feature_method_list = feature_method_list  # list of feature extraction method
        self.row_threshold = row_threshold
        self.column_threshold = column_threshold
        self.picture_resolution = picture_resolution
        self.label_threshold = label_threshold  # min amount of label 1 percentage
        self.ground_truth_dir = ground_truth_dir  # dir of ground true pictures - extract only high class 1 percent
        self.abs_flag = abs_flag
        self.log_flag = log_flag

        self.images_pixel_dict = dict()  # contain images and their pixels
        self.images_name_list = list()  # contain pic name in data set
        self.X = list()  # list of ndarray - feature format
        self.X_sobelx = list()
        self.X_sobely = list()
        self.X_laplacian = list()
        self.X_canny = list()
        self.X_scharrx = list()
        self.X_scharry = list()
        self.X_sobelx_final = list()
        self.X_sobely_final = list()
        self.X_laplacian_final = list()
        self.X_canny_final = list()
        self.X_scharrx_final = list()
        self.X_scharry_final = list()

        self.auto_canny = auto_canny
        self.auto_canny_sigma = auto_canny_sigma
        if self.auto_canny_sigma < 0 or self.auto_canny_sigma > 1:
            raise 'Illegal value for auto Canny Sigma parameter - need to be 0<=..<=1'

        self.kepsilon = 1e-8

        return
Пример #2
0
    def __init__(self,
                 crf,
                 w,
                 image_name_list,
                 X,
                 ground_truth_dir,
                 pixel_frame,
                 evaluation_visualisation_flag,
                 dir_visualization_name,
                 model_name,
                 feature_data_set_obj,
                 baseline_features=None):

        saved_args = locals()
        del saved_args['X']  # preventing from logging
        Arguments.logArguments('Evaluate', saved_args)

        self.crf = crf
        self.w = w
        self.X = X
        self.image_name_list = image_name_list
        self.ground_truth_dir = ground_truth_dir
        self.pixels_frame = pixel_frame
        self.evaluation_visualisation_flag = evaluation_visualisation_flag
        self.dir_visualization_name = dir_visualization_name
        self.model_name = model_name

        self.baseline_features_dict = dict()
        if len(baseline_features) > 0:
            for f in baseline_features:
                attr = getattr(feature_data_set_obj, 'X_{}_final'.format(f))
                self.baseline_features_dict[f] = attr

        self.all_f1_avg = list()  # avg f1 (between all gt)
        self.all_f1 = list()  # max f1 (max per gt)
        self.all_recall = list()
        self.all_precision = list()

        self.all_super_f1_avg = list()
        self.all_super_f1 = list()
        self.all_super_recall = list()
        self.all_super_precision = list()

        self.canny_f1_avg = list()
        self.canny_f1 = list()
        self.canny_recall = list()
        self.canny_precision = list()

        self.canny_super_f1_avg = list()
        self.canny_super_f1 = list()
        self.canny_super_recall = list()
        self.canny_super_precision = list()
        return
    def __init__(self, ground_truth_dir, images_name_list, row_threshold, column_threshold, X, pixels_frame):

        saved_args = locals()
        del saved_args['X']  # preventing from logging
        Arguments.logArguments('TargetDataSet', saved_args)
        self.ground_truth_dir = ground_truth_dir
        self.images_name_list = images_name_list
        self.row_threshold = row_threshold
        self.column_threshold = column_threshold
        self.pixels_frame = pixels_frame
        self.y = list()
        self.X = X

        self.delete_indexes = list()

        return
Пример #4
0
    def __init__(self, X, y, learners, learners_parameters, models, models_parameters, total_label_one_avg, row_threshold):

        saved_args = locals()
        del saved_args['X']     # preventing from logging
        del saved_args['y']     # preventing from logging
        Arguments.logArguments('Model', saved_args)

        self.X = X
        self.y = y
        self.learners = learners
        self.learners_parameters = learners_parameters
        self.models = models
        self.models_parameters = models_parameters
        self.total_label_one_avg = total_label_one_avg
        self.row_threshold = row_threshold              # needed to define graph model

        self.total_accuracy_list = list()               # each image and relevance accuracy
        return