def __init__(self, model, grid_size, logger=LogFactory.get_default_logger()): self.model = model self.grid_size = grid_size self.logger = logger
def __init__(self, model, neighbour_area, logger=LogFactory.get_default_logger()): self.model = model self.neighbour_area = neighbour_area self.probability_calculator = CachedProbabilityCalculator() self.logger = logger
def train_model(train_config=TextureTrainConfiguration(), logger=LogFactory.get_default_logger()): """ Gets examples path from config, trains a svm then dumps the model in a file """ logger.log("Started training texture model") trainer = TextureModelTrainer( train_config.path_pos, train_config.path_neg, train_config.skin_label, train_config.non_skin_label) trainer.__train_and_store_model(train_config.path_models + "/" + train_config.selected_classifier, logger) logger.log("Done")
def __init__(self, with_position, sigma, tau, logger=LogFactory.get_default_logger()): self.with_position = with_position self.sigma = sigma self.tau = tau self.logger = logger
def get_detector(model_path, detection_type, detection_window_size, logger=LogFactory.get_default_logger()): serializator = SerializationUtils(logger) model = serializator.load_joblib_object(model_path) if detection_type == 0: return GridDetector(model, detection_window_size, logger) else: return PerPixelDetector(model, detection_window_size, logger)
def get_detector(model_path, detector_type, neighbour_area, logger=LogFactory.get_default_logger()): serializer = SerializationUtils(logger) model = serializer.load_object(model_path) if detector_type == 0: detector = SimpleDetector(model, logger) elif detector_type == 1: detector = NeighbourDetector(model, neighbour_area, logger) else: detector = AverageOnSuperpixelDetector(model, neighbour_area, logger) return detector
def __init__(self, path_pos, path_neg, skin_label, non_skin_label, logger=LogFactory.get_default_logger()): self.path_pos = path_pos self.path_neg = path_neg self.skin_label = skin_label self.non_skin_label = non_skin_label self.model = None self.logger = logger
def __init__(self, path_train, color_space, logger=LogFactory.get_default_logger()): self.path_train = path_train self.color_space = color_space self.appearances = {} self.appearances_as_skin = {} self.skin_pixels = 0 self.non_skin_pixels = 0 self.logger = logger
def __init__(self, path_positive_images, path_negative_images, color_space, logger=LogFactory.get_default_logger()): self.path_positive_images = path_positive_images self.path_negative_images = path_negative_images self.color_space = color_space self.appearances = {} self.appearances_as_skin = {} self.skin_pixels = 0 self.non_skin_pixels = 0 self.logger = logger
def __init__(self, config=RunConfiguration(), logger=LogFactory.get_default_logger()): logger.log('Initializing evaluator') self.config = config self.quickshift = QuickshiftSegmentation(config.qs_with_position, config.qs_sigma, config.qs_tau, logger) self.spm_detector = SpmDetectorFactory.get_detector( config.spm_model_path, config.spm_type, config.spm_neighbour_area, logger) self.texture_detector = TextureDetectorFactory.get_detector( config.texture_model_path, config.texture_detection_type, config.texture_detection_area, logger) self.logger = logger
def train_spm_model(train_config=SpmTrainConfiguration(), logger=LogFactory.get_default_logger()): """ Default factory method ; uses values from config """ logger.log("Started training model") if train_config.database == 'compaq': extractor = CompaqComponentExtractor(train_config.path_compaq, train_config.color_space, logger) else: extractor = SfaComponentExtractor(train_config.path_pos, train_config.path_neg, train_config.color_space, logger) trainer = SPMModelTrainer(extractor, train_config.color_space) trainer.__train_and_store_model(train_config.path_models + '/' + train_config.selected_model) logger.log("Done")
def __init__(self, model, window_size, logger=LogFactory.get_default_logger()): self.model = model self.window_size = window_size self.probability_calculator = CachedProbabilityCalculator() self.logger = logger
def __init__(self, logger=LogFactory.get_default_logger()): self.logger = logger
def __init__(self, model, logger=LogFactory.get_default_logger()): self.model = model self.logger = logger