Ejemplo n.º 1
0
    def reaload_dbconfig(self, parsed_config: configparser):
        """
        reload Database config
        :param parsed_config: config Object
        :return:
        """
        # mysql config
        mysql_host = parsed_config.get('mysql', 'Host', fallback='localhost')
        mysql_id = parsed_config.getint('mysql', 'ID')
        mysql_port = parsed_config.getint('mysql', 'Port', fallback=3306)
        mysql_user = parsed_config.get('mysql', 'User')
        mysql_passwd = parsed_config.get('mysql', 'Passwd')
        mysql_database = parsed_config.get('mysql', 'Database')
        mysql_charset = parsed_config.get('mysql', 'Charset')
        mysql_pool_size = parsed_config.getint('mysql', 'MaxPoolSize')

        # redis config
        redis_host = parsed_config.get('redis', 'Host', fallback='localhost')
        redis_id = parsed_config.getint('redis', 'ID')
        redis_port = parsed_config.getint('redis', 'Port')
        redis_passwd = parsed_config.get('redis', 'Passwd')
        redis_timeout = parsed_config.getint('redis', 'Timeout')

        self.dbconfig.__setitem__(
            'mysql',
            config.to_formated_dbconfig(mysql_id,
                                        mysql_host,
                                        mysql_port,
                                        mysql_passwd,
                                        database=mysql_database,
                                        user=mysql_user,
                                        charset=mysql_charset,
                                        pool_size=mysql_pool_size))
        self.dbconfig.__setitem__(
            'redis',
            config.to_formated_dbconfig(redis_id,
                                        redis_host,
                                        redis_port,
                                        redis_passwd,
                                        timeout=redis_timeout))
Ejemplo n.º 2
0
config = ConfigParser()
config.read('configuration.txt')
#===========================================
#run the training on invariant or local
path_data = config.get('data paths', 'path_local')

#original test images (for FOV selection)
DRIVE_test_imgs_original = path_data + config.get('data paths', 'test_imgs_original')
test_imgs_orig = load_hdf5(DRIVE_test_imgs_original)
full_img_height = test_imgs_orig.shape[2]
full_img_width = test_imgs_orig.shape[3]
#the border masks provided by the DRIVE
DRIVE_test_border_masks = path_data + config.get('data paths', 'test_border_masks')
test_border_masks = load_hdf5(DRIVE_test_border_masks)
# dimension of the patches
patch_height = config.getint('data attributes', 'patch_height')
patch_width = config.getint('data attributes', 'patch_width')
#the stride in case output with average
stride_height = config.getint('testing settings', 'stride_height')
stride_width = config.getint('testing settings', 'stride_width')
assert (stride_height < patch_height and stride_width < patch_width)
#model name
name_experiment = config.get('experiment name', 'name')
path_experiment = './' +name_experiment +'/'
#N full images to be predicted
Imgs_to_test = config.getint('testing settings', 'full_images_to_test')
#Grouping of the predicted image
N_visual = config.getint('testing settings', 'N_group_visual')
#====== average mode ===========
average_mode = config.getboolean('testing settings', 'average_mode')