'''ce2p_resnet50os16_voc''' import os from .._base_ import REGISTERED_SEGMENTOR_CONFIGS, REGISTERED_DATASET_CONFIGS, REGISTERED_DATALOADER_CONFIGS # deepcopy SEGMENTOR_CFG = REGISTERED_SEGMENTOR_CONFIGS['CE2P_SEGMENTOR_CFG'].copy() # modify dataset config SEGMENTOR_CFG['dataset'] = REGISTERED_DATASET_CONFIGS['DATASET_CFG_VOCAUG_512x512'].copy() SEGMENTOR_CFG['dataset']['train']['data_pipelines'] = [ ('Resize', {'output_size': (2048, 512), 'keep_ratio': True, 'scale_range': (0.5, 2.0)}), ('RandomCrop', {'crop_size': (512, 512), 'one_category_max_ratio': 0.75}), ('RandomFlip', {'prob': 0.5}), ('PhotoMetricDistortion', {}), ('EdgeExtractor', {}), ('Normalize', {'mean': [123.675, 116.28, 103.53], 'std': [58.395, 57.12, 57.375]}), ('ToTensor', {}), ('Padding', {'output_size': (512, 512), 'data_type': 'tensor'}), ] # modify dataloader config SEGMENTOR_CFG['dataloader'] = REGISTERED_DATALOADER_CONFIGS['DATALOADER_CFG_BS16'].copy() # modify scheduler config SEGMENTOR_CFG['scheduler']['max_epochs'] = 60 # modify other segmentor configs SEGMENTOR_CFG['num_classes'] = 21 SEGMENTOR_CFG['backbone'] = { 'type': 'ResNet', 'depth': 50, 'structure_type': 'resnet50conv3x3stem', 'pretrained': True, 'outstride': 16, 'use_conv3x3_stem': True, 'selected_indices': (0, 1, 2, 3), } SEGMENTOR_CFG['losses'] = { 'loss_cls_stage1': {'type': 'CrossEntropyLoss', 'scale_factor': 1.0, 'ignore_index': -100, 'reduction': 'mean'}, 'loss_cls_stage2': {'type': 'CrossEntropyLoss', 'scale_factor': 1.0, 'ignore_index': -100, 'reduction': 'mean'}, 'loss_edge': {'type': 'CrossEntropyLoss', 'scale_factor': 1.0, 'ignore_index': -100, 'reduction': 'mean', 'norm_loss_with_class_weight': False} } SEGMENTOR_CFG['work_dir'] = os.path.split(__file__)[-1].split('.')[0] SEGMENTOR_CFG['logger_handle_cfg']['logfilepath'] = os.path.join(SEGMENTOR_CFG['work_dir'], f"{os.path.split(__file__)[-1].split('.')[0]}.log")