Exemple #1
0
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao ([email protected])
# ------------------------------------------------------------------------------

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from yacs.config import CfgNode as CN


# pose_resnet related params
POSE_RESNET = CN()
POSE_RESNET.NUM_LAYERS = 50
POSE_RESNET.DECONV_WITH_BIAS = False
POSE_RESNET.NUM_DECONV_LAYERS = 3
POSE_RESNET.NUM_DECONV_FILTERS = [256, 256, 256]
POSE_RESNET.NUM_DECONV_KERNELS = [4, 4, 4]
POSE_RESNET.FINAL_CONV_KERNEL = 1
POSE_RESNET.PRETRAINED_LAYERS = ['*']

# pose_multi_resoluton_net related params
POSE_HIGH_RESOLUTION_NET = CN()
POSE_HIGH_RESOLUTION_NET.PRETRAINED_LAYERS = ['*']
POSE_HIGH_RESOLUTION_NET.STEM_INPLANES = 64
POSE_HIGH_RESOLUTION_NET.FINAL_CONV_KERNEL = 1

POSE_HIGH_RESOLUTION_NET.STAGE2 = CN()
POSE_HIGH_RESOLUTION_NET.STAGE2.NUM_MODULES = 1
from yacs.config import CfgNode as CN

_C = CN()
_C.data = CN(
    dict(
        batch_size=8,  # batch size
        valid_size=16,  # the first N examples are reserved for validation
        sample_rate=22050,  # Hz, sample rate
        n_fft=2048,  # fft frame size
        win_length=1024,  # window size
        hop_length=256,  # hop size between ajacent frame
        # f_max=8000, # Hz, max frequency when converting to mel
        n_mels=80,  # mel bands
        train_clip_seconds=0.5,  # audio clip length(in seconds)
    ))

_C.model = CN(
    dict(
        upsample_factors=[16, 16],
        n_stack=3,
        n_loop=10,
        filter_size=2,
        residual_channels=128,  # resiaudal channel in each flow
        loss_type="mog",
        output_dim=3,  # single gaussian
        log_scale_min=-9.0,
    ))

_C.training = CN(
    dict(
        lr=1e-3,  # learning rates
Exemple #3
0
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Modified by Pengfei Xian. All Rights Reserved.
import os

from yacs.config import CfgNode as CN

_C = CN()
_C.OUTPUT_DIR = "run/"
_C.MULTI_RUN = False
_C.TEST_ONLY = False


# ---------------------------------------------------------------------------- #
# DATALOADER
# ---------------------------------------------------------------------------- #
_C.DATALOADER = CN()
_C.DATALOADER.NUM_CLASSES = 19
_C.DATALOADER.BASE_SIZE = 2048
_C.DATALOADER.CROP_SIZE = 513
_C.DATALOADER.BATCH_SIZE_TRAIN = 4
_C.DATALOADER.BATCH_SIZE_TEST = 4
_C.DATALOADER.BATCH_SIZE_VAL = 4
_C.DATALOADER.NUM_WORKERS = 4
_C.DATALOADER.PIN_MEMORY = True
_C.DATALOADER.DATASET = "cityscapes"
_C.DATALOADER.DATASET_PATH = ""
_C.DATALOADER.IGNORE_INDEX = -1


# ---------------------------------------------------------------------------- #
# Cudnn related params
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------
# Whenever an argument can be either used for training or for testing, the
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
# or _TEST for a test-specific parameter.
# For example, the number of images during training will be
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
# IMAGES_PER_BATCH_TEST

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CN()

_C.MODEL = CN()
_C.MODEL.RPN_ONLY = False
_C.MODEL.MASK_ON = False
_C.MODEL.DEVICE = "cuda"
_C.MODEL.META_ARCHITECTURE = "GeneralizedRCNN"

# If the WEIGHT starts with a catalog://, like :R-50, the code will look for
# the path in paths_catalog. Else, it will use it as the specified absolute
# path
_C.MODEL.WEIGHT = ""

# -----------------------------------------------------------------------------
# INPUT
# -----------------------------------------------------------------------------
Exemple #5
0
from yacs.config import CfgNode as CN

_C = CN()

_C.MODEL = CN()
_C.MODEL.META_ARCHITECTURE = 'SSDDetector'
_C.MODEL.DEVICE = "cuda"
# match default boxes to any ground truth with jaccard overlap higher than a threshold (0.5)
_C.MODEL.THRESHOLD = 0.5
_C.MODEL.NUM_CLASSES = 4
# Hard negative mining
_C.MODEL.NEG_POS_RATIO = 3
_C.MODEL.CENTER_VARIANCE = 0.1
_C.MODEL.SIZE_VARIANCE = 0.2

# ---------------------------------------------------------------------------- #
# Backbone
# ---------------------------------------------------------------------------- #
_C.MODEL.BACKBONE = CN()
_C.MODEL.BACKBONE.NAME = 'light_vgg'  #'vgg'
_C.MODEL.BACKBONE.OUT_CHANNELS = (512, 1024, 512, 256, 256, 256)
_C.MODEL.BACKBONE.PRETRAINED = True

# -----------------------------------------------------------------------------
# PRIORS
# -----------------------------------------------------------------------------
_C.MODEL.PRIORS = CN()
_C.MODEL.PRIORS.FEATURE_MAPS = [38, 19, 10, 5, 3, 1]
_C.MODEL.PRIORS.STRIDES = [8, 16, 32, 64, 100, 300]
_C.MODEL.PRIORS.MIN_SIZES = [30, 60, 111, 162, 213, 264]
_C.MODEL.PRIORS.MAX_SIZES = [60, 111, 162, 213, 264, 315]
Exemple #6
0
def make_config():
    cfg = CfgNode()
    cfg.desc = ""  # 对本次实验的简单描述,用于为tensorboard命名
    cfg.stage = "train"  # train or eval or test
    cfg.device = "cpu"  # cpu or cuda
    cfg.device_ids = ""  # if not set, use all gpus
    cfg.output_dir = "/data/vehicle_reid/perspective_transform_feature/debug"
    cfg.debug = False

    cfg.train = CfgNode()
    cfg.train.epochs = 120

    cfg.data = CfgNode()
    cfg.data.name = "VeRi776"
    cfg.data.pkl_path = "../data_processing/veri776.pkl"
    cfg.data.train_size = (256, 256)
    cfg.data.valid_size = (256, 256)
    cfg.data.pad = 10
    cfg.data.re_prob = 0.5
    cfg.data.with_mask = True
    cfg.data.test_ext = ''

    cfg.data.sampler = 'RandomIdentitySampler'
    cfg.data.batch_size = 16
    cfg.data.num_instances = 4

    cfg.data.train_num_workers = 0
    cfg.data.test_num_workers = 0

    cfg.model = CfgNode()
    cfg.model.name = "resnet50"
    # If it is set to empty, we will download it from torchvision official website.
    cfg.model.pretrain_path = ""
    cfg.model.last_stride = 1
    cfg.model.neck = 'bnneck'
    cfg.model.neck_feat = 'after'
    cfg.model.pretrain_choice = 'imagenet'
    cfg.model.ckpt_period = 10

    cfg.optim = CfgNode()
    cfg.optim.name = 'Adam'
    cfg.optim.base_lr = 3.5e-4
    cfg.optim.bias_lr_factor = 1
    cfg.optim.weight_decay = 0.0005
    cfg.optim.momentum = 0.9

    cfg.loss = CfgNode()
    cfg.loss.losses = ["triplet", "id", "center", "local-triplet"]
    cfg.loss.triplet_margin = 0.3
    cfg.loss.normalize_feature = True
    cfg.loss.id_epsilon = 0.1

    cfg.loss.center_lr = 0.5
    cfg.loss.center_weight = 0.0005

    cfg.loss.tuplet_s = 64
    cfg.loss.tuplet_beta = 0.1

    cfg.scheduler = CfgNode()
    cfg.scheduler.milestones = [40, 70]
    cfg.scheduler.gamma = 0.1
    cfg.scheduler.warmup_factor = 0.0
    cfg.scheduler.warmup_iters = 10
    cfg.scheduler.warmup_method = "linear"

    cfg.test = CfgNode()
    cfg.test.feat_norm = True
    cfg.test.remove_junk = True
    cfg.test.period = 10
    cfg.test.device = "cuda"
    cfg.test.model_path = "../outputs/veri776.pth"
    cfg.test.max_rank = 50
    cfg.test.rerank = False
    cfg.test.lambda_ = 0.0
    # split: When the CUDA memory is not sufficient,
    # we can split the dataset into different parts
    # for the computing of distance.
    cfg.test.split = 0

    cfg.logging = CfgNode()
    cfg.logging.level = "info"
    cfg.logging.period = 20

    return cfg
from yacs.config import CfgNode as CN

_C = CN()

# Model
_C.MODEL = CN()
_C.MODEL.ARCH = "se_resnext50_32x4d"  # check python train.py -h for available models
_C.MODEL.IMG_SIZE = 224

# Train
_C.TRAIN = CN()
_C.TRAIN.OPT = "adam"  # adam or sgd
_C.TRAIN.WORKERS = 8
_C.TRAIN.LR = 0.001
_C.TRAIN.LR_DECAY_STEP = 20
_C.TRAIN.LR_DECAY_RATE = 0.2
_C.TRAIN.MOMENTUM = 0.9
_C.TRAIN.WEIGHT_DECAY = 0.0
_C.TRAIN.BATCH_SIZE = 64
_C.TRAIN.EPOCHS = 80
_C.TRAIN.AGE_STDDEV = 1.0

# Test
_C.TEST = CN()
_C.TEST.WORKERS = 8
_C.TEST.BATCH_SIZE = 32
Exemple #8
0
# Copyright (c) SenseTime. All Rights Reserved.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from yacs.config import CfgNode as CN

__C = CN()

cfg = __C

__C.META_ARC = "siamrpn_r50_l234_dwxcorr"

__C.CUDA = True

# ------------------------------------------------------------------------ #
# Training options
# ------------------------------------------------------------------------ #
__C.TRAIN = CN()

# Anchor Target
# Positive anchor threshold
__C.TRAIN.THR_HIGH = 0.6

# Negative anchor threshold
__C.TRAIN.THR_LOW = 0.3

# Number of negative
__C.TRAIN.NEG_NUM = 16
from yacs.config import CfgNode as CN

_C = CN()

_C.ENCODER_HIDDEN_LAYERS_MLP = [512, 256, 128, 64]
_C.DECODER_HIDDEN_LAYERS_MLP = [512, 256, 128, 64]

# _C.ENCODER_HIDDEN_LAYERS_MLP = [64, 32]
# _C.DECODER_HIDDEN_LAYERS_MLP = [64, 32]


def get_vae_defaults():
    return _C.clone()
Exemple #10
0
from yacs.config import CfgNode as CN
import os

_C = CN()
_C.name = "default"
_C.protocol = "ae"

# System settings -----------------------------------------------
_C.system = CN()
_C.system.num_gpu = 1
_C.system.num_workers = 4
_C.system.checkpoints_root = "training_checkpoints"
_C.system.stream = 'file'
_C.system.seed = 777

# Dataset opt. -----------------------------------------------
_C.dataset = CN()
_C.dataset.repeat_dataset = 1
_C.dataset.cache = 1
_C.dataset.img_size = 512
_C.dataset.augmentations = []
_C.dataset.transforms = [{"name": "ToTensor"}]
_C.dataset.root = CN(new_allowed=True)
_C.dataset.root.NIH = "/datasets/ilyas/ChestNets/images"
_C.dataset.root.JSRT = "/home/semyon/ds_project/data/pngversion"
data_annotation_root = '/home/semyon/ds_project/data'

# Train
_C.dataset.train = CN()
_C.dataset.train.csv_path = os.path.join(data_annotation_root, "train.csv")
_C.dataset.train.batch_size = 16
Exemple #11
0
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from yacs.config import CfgNode as CN

# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------
# Whenever an argument can be either used for training or for testing, the
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
# or _TEST for a test-specific parameter.
# For example, the number of images during training will be
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
# IMAGES_PER_BATCH_TEST
# _C.TASK = CN()
_C = CN()

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------
_C.TASK = ""

_C.GPU = 0

_C.PRINT_FREQ = 10

_C.MODEL = CN()
_C.MODEL.ARCH = 'csnet'
_C.MODEL.BASIC_SPLIT = [
    1,
]

_C.LOSS = CN()
Exemple #12
0
from yacs.config import CfgNode

_C = CfgNode()

_C.GPUS = (0, )
_C.WORKERS = 4

# Cudnn related params
_C.CUDNN = CfgNode()
_C.CUDNN.BENCHMARK = True
_C.CUDNN.DETERMINISTIC = False
_C.CUDNN.ENABLED = True

# common params for NETWORK
_C.MODEL = CfgNode()
_C.MODEL.NAME = 'pose_hrnet'
_C.MODEL.NUM_JOINTS = 17
_C.MODEL.TAG_PER_JOINT = True
_C.MODEL.IMAGE_SIZE = [256, 256]  # width * height, ex: 192 * 256
_C.MODEL.EXTRA = CfgNode(new_allowed=True)

_C.BOX_MODEL = CfgNode()
_C.BOX_MODEL.THRESHOLD = 0.8

# testing
_C.TEST = CfgNode()

# size of images for each device
# Test Model Epoch
_C.TEST.POST_PROCESS = False
_C.TEST.POSE_DRAW = False
Exemple #13
0
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao ([email protected])
# ------------------------------------------------------------------------------

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from yacs.config import CfgNode as CN

EFFICIENT_NET = CN()
EFFICIENT_NET.NETTYPE = 'efficientnet-b0'
EFFICIENT_NET.DECONV_WITH_BIAS = False
EFFICIENT_NET.NUM_DECONV_LAYERS = 3
EFFICIENT_NET.NUM_DECONV_FILTERS = [256, 256, 256]
EFFICIENT_NET.NUM_DECONV_KERNELS = [4, 4, 4]
EFFICIENT_NET.FINAL_CONV_KERNEL = 1
EFFICIENT_NET.PRETRAINED_LAYERS = ['*']
# pose_resnet related params写在这儿是防止没有yaml吗
POSE_RESNET = CN()
POSE_RESNET.NUM_LAYERS = 50
POSE_RESNET.DECONV_WITH_BIAS = False
POSE_RESNET.NUM_DECONV_LAYERS = 3
POSE_RESNET.NUM_DECONV_FILTERS = [256, 256, 256]
POSE_RESNET.NUM_DECONV_KERNELS = [4, 4, 4]
POSE_RESNET.FINAL_CONV_KERNEL = 1
POSE_RESNET.PRETRAINED_LAYERS = ['*']

# pose_resnet related params
Exemple #14
0
class Config():
    """
    TODO Finish Documentation (Numpy Style)
    """

    def __init__(self):
        """
        Initialize all main class variables
        """

        # initialize yacs config node (CfgNode)
        self._CONFIG = CN()

        # initialize main sections of settings with default values
        self._initKittConfig()
        self._initVisionConfig()

    def create_argparser(self):
        """create command line parser using argparse

        Arguments
        ---------
        TODO Detail Arguments

        """

        # initialize argparse parser
        parser = argparse.ArgumentParser(description = "How to control Thor.")

        # add arguments to parser
        parser.add_argument('-c', '--config',
                            help="custom config file path",
                            required=False,
                            type=str,
                            default='source/Config/default.yaml')
        parser.add_argument('opts',
                            help='modify default config using the command-line',
                            default=None,
                            nargs=argparse.REMAINDER)

        # parse args
        args = parser.parse_args()

        # update config with argue yaml file
        self._CONFIG.merge_from_file(args.config)

        # update config with argued options
        self._CONFIG.merge_from_list(args.opts)

        # freeze the config to prevent corruption
        self._CONFIG.freeze()

    def _initKittConfig(self):
        """
        TODO Finish Documentation (Numpy Style)
        """
        
        # create Kitt section in config
        self._CONFIG.KITT = CN()

        # start Kitt module at runtime (True / False)
        self._CONFIG.KITT.START = False

    def _initVisionConfig(self):
        """Initialize configuration for Vision"""

        # create Vision section in config
        self._CONFIG.VISION = CN()

        # start Vision module at runtime (True / False)
        self._CONFIG.VISION.START = False

        # webcam id to receive frames
        self._CONFIG.VISION.CAM_NUMBER = 1 # usb cam on thor

        # start detect package
        self._CONFIG.VISION.DETECT = False

        # frame rate to receive from video source
        self._CONFIG.VISION.FPS = 30

        # image size to receive from video source
        self._CONFIG.VISION.IMAGE_SIZE = [640, 480]

        # record camera footage
        self._CONFIG.VISION.RECORD = False

        # show the camera's view on screen
        self._CONFIG.VISION.SHOW_VIEW = False

        # image size to receive when using detect
        self._CONFIG.VISION.TENSOR_IMAGE_SIZE = [800, 600]

        # video path to receive frames
        self._CONFIG.VISION.VIDEO_PATH = None

    # ---------------
    # getter methods
    # ---------------

    def getKittStart(self):
        """return boolean specifying whether to start Kitt at runtime"""
        return self._CONFIG.KITT.START

    def getVisionCamNum(self):
        """return integer value representing camera source"""
        return self._CONFIG.VISION.CAM_NUMBER

    def getVisionDetect(self):
        """return boolean attribute specifying whether or not to apply object detection"""
        return self._CONFIG.VISION.DETECT

    def getVisionFPS(self):
        """return integer value specifying frame rate to record"""
        return self._CONFIG.VISION.FPS

    def getVisionImageSize(self):
        """return list value specifying image size"""
        return self._CONFIG.VISION.IMAGE_SIZE

    def getVisionRecord(self):
        """return boolean value specifying whether to record"""
        return self._CONFIG.VISION.RECORD

    def getVisionShowView(self):
        """return boolean value specifying the initialization of visuals"""
        return self._CONFIG.VISION.SHOW_VIEW

    def getVisionStart(self):
        """return boolean specifying whether to start Vision at runtime"""
        return self._CONFIG.VISION.START

    def getVisionTensorImageSize(self):
        """return boolean specifying output of object detection"""
        return self._CONFIG.VISION.TENSOR_IMAGE_SIZE

    def getVisionVideoPath(self):
        """return path to prerecorded video(s)"""
        return self._CONFIG.VISION.VIDEO_PATH
Exemple #15
0
from os.path import join

from yacs.config import CfgNode

from config.const import PROJECT_ROOT

_C = CfgNode()
_C.SEED = 42

# train
_C.TRAIN = CfgNode()
_C.TRAIN.BATCH_SIZE = 256
_C.TRAIN.DISTRIBUTED_BACKEND = 'ddp'
_C.TRAIN.GPUS = 2
_C.TRAIN.LR = 0.01
_C.TRAIN.MAX_EPOCHS = 1
_C.TRAIN.MODEL_TYPE = 'simple_cnn'
_C.TRAIN.MOMENTUM = 0.9
_C.TRAIN.OPTIMIZER_TYPE = 'sgd'
_C.TRAIN.SCHEDULER_TYPE = 'step_lr'
_C.TRAIN.STEP_SIZE = 5

_C.MLFLOW = CfgNode()
_C.MLFLOW.EXPERIMENT_NAME = 'Default'

_C.OPTUNA = CfgNode()
_C.OPTUNA.N_TRIALS = 2
_C.OPTUNA.TIMEOUT = 60 * 60

_C.DATA = CfgNode()
_C.DATA.CACHE_DIR = join(PROJECT_ROOT, '.data')
Exemple #16
0
"""
-------------------------------------------------
   File Name:    config.py
   Author:       Zhonghao Huang
   Date:         2019/10/22
   Description:  Global Configure.
-------------------------------------------------
"""

from yacs.config import CfgNode as CN

cfg = CN()

cfg.output_dir = ''
cfg.device = 'cuda'
cfg.device_id = '3'

cfg.structure = 'fixed'
cfg.loss = "logistic"
cfg.drift = 0.001
cfg.d_repeats = 1
cfg.use_ema = True
cfg.ema_decay = 0.999

cfg.num_works = 4
cfg.num_samples = 36
cfg.feedback_factor = 10
cfg.checkpoint_factor = 10

# ---------------------------------------------------------------------------- #
# Options for scheduler
Exemple #17
0
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
from yacs.config import CfgNode as CN

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CN()
_C.MODEL = CN()

# -----------------------------------------------------------------------------
# INPUT
# -----------------------------------------------------------------------------
_C.INPUT = CN()
# Size of the smallest side of the image during training
_C.INPUT.HEIGHT = 600
_C.INPUT.WIDTH = 400
# Values to be used for image normalization
_C.INPUT.PIXEL_MEAN = [0.485, 0.456, 0.406]
# Values to be used for image normalization
_C.INPUT.PIXEL_STD = [0.229, 0.224, 0.225]

# -----------------------------------------------------------------------------
# DataLoader
# -----------------------------------------------------------------------------
_C.DATALOADER = CN()
# Number of data loading threads
_C.DATALOADER.NUM_WORKERS = 4
_C.DATALOADER.DEBUG = False
Exemple #18
0
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao ([email protected])
# ------------------------------------------------------------------------------

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from yacs.config import CfgNode as CN


# pose_multi_resoluton_net related params
POSENET = CN()
POSENET.PRETRAINED_LAYERS = ['*']
POSENET.STEM_INPLANES = 64
POSENET.FINAL_CONV_KERNEL = 1

POSENET.STAGE2 = CN()
POSENET.STAGE2.NUM_MODULES = 4
POSENET.STAGE2.NUM_BRANCHES = 4
POSENET.STAGE2.NUM_BLOCKS = [4, 4, 4, 4]
POSENET.STAGE2.NUM_CHANNELS = [32, 64, 128, 256]
POSENET.STAGE2.BLOCK = 'BASIC'
POSENET.STAGE2.FUSE_METHOD = 'SUM'


MODEL_EXTRAS = {
    'posenet': POSENET,
}
Exemple #19
0
# -*- coding: utf-8 -*-
# @Author  : LG
from yacs.config import CfgNode as CN
import os

### 参数请结合自身项目设定,才能跑出较好的效果。

project_root = os.getcwd()

_C = CN()


_C.FILE = CN()

_C.FILE.PRETRAIN_WEIGHT_ROOT = project_root+'/Weights/pretrained'   # 会使用到的预训练模型
_C.FILE.MODEL_SAVE_ROOT = project_root+'/Weights/trained'           # 训练模型的保存
_C.FILE.VGG16_WEIGHT = 'vgg16_reducedfc.pth'                        # vgg预训练模型

_C.DEVICE = CN()

_C.DEVICE.MAINDEVICE = 'cuda:0' # 主gpu
_C.DEVICE.TRAIN_DEVICES = [0,1] # 训练gpu
_C.DEVICE.TEST_DEVICES = [0,1]  # 检测gpu

_C.MODEL = CN()

_C.MODEL.INPUT = CN()
_C.MODEL.INPUT.IMAGE_SIZE = 300         # 模型输入尺寸
_C.MODEL.INPUT.PIXEL_MEAN = [0, 0, 0]   # 数据集均值
_C.MODEL.INPUT.PIXEL_STD = [1, 1, 1]    # 数据集方差
Exemple #20
0
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Configuration file (powered by YACS)."""

import argparse
import os
import sys

from pycls.core.io import cache_url
from yacs.config import CfgNode as CfgNode

# Global config object
_C = CfgNode()

# Example usage:
#   from core.config import cfg
cfg = _C

# ------------------------------------------------------------------------------------ #
# Model options
# ------------------------------------------------------------------------------------ #
_C.MODEL = CfgNode()

# Model type
_C.MODEL.TYPE = ""

# Number of weight layers
_C.MODEL.DEPTH = 0
from yacs.config import CfgNode as CN

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CN()
_C.DIR = "ckpt/ade20k-resnet50dilated-ppm_deepsup"

# -----------------------------------------------------------------------------
# Dataset
# -----------------------------------------------------------------------------
_C.DATASET = CN()
_C.DATASET.root_dataset = "./data/"
_C.DATASET.list_train = "./data/training.odgt"
_C.DATASET.list_val = "./data/validation.odgt"
_C.DATASET.color_mat = "./data/color150.mat"
_C.DATASET.object_info = "./data/object150_info.csv"
_C.DATASET.num_class = 150
# multiscale train/test, size of short edge (int or tuple)
_C.DATASET.imgSizes = (300, 375, 450, 525, 600)
# maximum input image size of long edge
_C.DATASET.imgMaxSize = 1000
# maxmimum downsampling rate of the network
_C.DATASET.padding_constant = 8
# downsampling rate of the segmentation label
_C.DATASET.segm_downsampling_rate = 8
# randomly horizontally flip images when train/test
_C.DATASET.random_flip = True

# -----------------------------------------------------------------------------
Exemple #22
0
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------
# Whenever an argument can be either used for training or for testing, the
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
# or _TEST for a test-specific parameter.
# For example, the maximum image side during training will be
# INPUT.MAX_SIZE_TRAIN, while for testing it will be
# INPUT.MAX_SIZE_TEST

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CN()

_C.MODEL = CN()
_C.MODEL.RPN_ONLY = False
_C.MODEL.MASK_ON = False
_C.MODEL.RETINANET_ON = False
_C.MODEL.KEYPOINT_ON = False
_C.MODEL.DEVICE = "cuda"
_C.MODEL.META_ARCHITECTURE = "GeneralizedRCNN"
_C.MODEL.CLS_AGNOSTIC_BBOX_REG = False

_C.MODEL.RPN_VERSION = 0
_C.MODEL.ROI_VERSION = 0

# If the WEIGHT starts with a catalog://, like :R-50, the code will look for
# the path in paths_catalog. Else, it will use it as the specified absolute
Exemple #23
0
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Configuration file (powered by YACS)."""

import argparse
import os
import sys

from pycls.core.io import cache_url
from yacs.config import CfgNode as CN

# Global config object
_C = CN()

# Example usage:
#   from core.config import cfg
cfg = _C

# ------------------------------------------------------------------------------------ #
# Model options
# ------------------------------------------------------------------------------------ #
_C.MODEL = CN()

# Model type
_C.MODEL.TYPE = ""

# Number of weight layers
_C.MODEL.DEPTH = 0
Exemple #24
0
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao ([email protected])
# ------------------------------------------------------------------------------

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os

from yacs.config import CfgNode as CN

_C = CN()

_C.OUTPUT_DIR = ''
_C.LOG_DIR = ''
_C.DATA_DIR = ''
_C.GPUS = (0, 1)
_C.WORKERS = 4
_C.PRINT_FREQ = 20
_C.AUTO_RESUME = False
_C.PIN_MEMORY = True
_C.RANK = 0

# Cudnn related params
_C.CUDNN = CN()
_C.CUDNN.BENCHMARK = True
_C.CUDNN.DETERMINISTIC = False
_C.CUDNN.ENABLED = True
Exemple #25
0
import os
from yacs.config import CfgNode as CN
r"""Learning algorithm settings 
"""

_C = CN()

# --------------------------------------------------------------------- #
#                    computation device & media options                 #
# --------------------------------------------------------------------- #
_C.GPU = 0  # Only gpu mode is supported now
_C.DISTRIBUTED = True

_C.MULTIPROC_DIST = True
_C.DIST_URL = 'tcp://10.198.87.144:8008'
# _C.DIST_URL = 'tcp://224.66.41.62:23456'
_C.DIST_BACKEND = 'nccl'
_C.WORLD_SIZE = 1
_C.RANK = 0

# --------------------------------------------------------------------- #
#                          miscellaneous options                        #
# --------------------------------------------------------------------- #
_C.OUTPUT_DIR = "../models/"
_C.CHECKPOINT = ""
_C.PRETRAINED = "../models/s"  # Pretrained unsupervised model for downstream tasks
# _C.SEED = None
_C.LOGGER = ('MetricLogger', 'TensorboardLogger')

# --------------------------------------------------------------------- #
#                              model options                            #
Exemple #26
0
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------
# Whenever an argument can be either used for training or for testing, the
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
# or _TEST for a test-specific parameter.
# For example, the number of images during training will be
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
# IMAGES_PER_BATCH_TEST

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CN()

_C.MODEL = CN()
_C.MODEL.DEVICE = "cuda:0"
_C.MODEL.NAME = 'seresnet50'  # 'resnet50' 'seresnet50' 'densenet196'
_C.MODEL.LAST_STRIDE = 1
_C.MODEL.PRETRAIN_PATH = ''
_C.MODEL.PRETRAIN_PATH_SE = ''
_C.MODEL.PRETRAIN_PATH_DENSE = ''

# -----------------------------------------------------------------------------
# APNet
# -----------------------------------------------------------------------------
_C.APNET = CN()
_C.APNET.LEVEL = 0
# -----------------------------------------------------------------------------
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from yacs.config import CfgNode

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CfgNode()

_C.DATA_ROOT = './data/coco'
_C.DATASET_ABS = 'Phys'
_C.BASE = ''
# -----------------------------------------------------------------------------
# INPUT
# -----------------------------------------------------------------------------
_C.INPUT = CfgNode()
_C.INPUT.PRELOAD_TO_MEMORY = False
_C.INPUT.IMAGE_MEAN = [0, 0, 0]
_C.INPUT.IMAGE_STD = [1.0, 1.0, 1.0]
_C.INPUT.PHYRE_USE_EMBEDDING = False
_C.INPUT.IMAGE_CHANNEL = 3
# ---------------------------------------------------------------------------- #
# Solver
# ---------------------------------------------------------------------------- #
_C.SOLVER = CfgNode()

_C.SOLVER.BASE_LR = 0.001
_C.SOLVER.BIAS_LR_FACTOR = 2
_C.SOLVER.LR_GAMMA = 0.1
_C.SOLVER.VAL_INTERVAL = 16000
_C.SOLVER.WEIGHT_DECAY = 0.0005
Exemple #28
0
from yacs.config import CfgNode as CN

_C = CN()

# numpy random seed
_C.NUMPY_RANDOM_SEED = 1234

#-----------------------------------------------------------------------------
# Bullet configuration.
#-----------------------------------------------------------------------------

_C.BULLET = CN()
# If "GUI", run real-time pybullet built-in visualizer; if "DIRECT", not.
_C.BULLET.MODE = "GUI"
# timestep in physics simulation.
_C.BULLET.TIMESTEP = 0.0002
# maximum duration of each simulation (-1 if indefinite)
_C.BULLET.MAX_TIME = -1.
# numSolverIteration parameter of bullet
_C.BULLET.NUM_SOLVER_ITERATIONS = 20
# gravity constant
_C.BULLET.GRAVITY = -9.81

#-----------------------------------------------------------------------------
# Scene set configuration
#-----------------------------------------------------------------------------
# Number of scenes
_C.NUM_SCENES = 10

#-----------------------------------------------------------------------------
# Object pose initialization configuration.
Exemple #29
0
"""Default packnet_sfm configuration parameters (overridable in configs/*.yaml)
"""

import os
from yacs.config import CfgNode as CN

########################################################################################################################
cfg = CN()
cfg.name = ''  # Run name
cfg.debug = False  # Debugging flag
########################################################################################################################
### ARCH
########################################################################################################################
cfg.arch = CN()
cfg.arch.seed = 42  # Random seed for Pytorch/Numpy initialization
cfg.arch.min_epochs = 1  # Minimum number of epochs
cfg.arch.max_epochs = 50  # Maximum number of epochs
########################################################################################################################
### CHECKPOINT
########################################################################################################################
cfg.checkpoint = CN()
cfg.checkpoint.filepath = ''  # Checkpoint filepath to save data
cfg.checkpoint.save_top_k = 5  # Number of best models to save
cfg.checkpoint.monitor = 'loss'  # Metric to monitor for logging
cfg.checkpoint.monitor_index = 0  # Dataset index for the metric to monitor
cfg.checkpoint.mode = 'auto'  # Automatically determine direction of improvement (increase or decrease)
cfg.checkpoint.s3_path = ''  # s3 path for AWS model syncing
cfg.checkpoint.s3_frequency = 1  # How often to s3 sync
########################################################################################################################
### SAVE
########################################################################################################################
# -----------------------------------------------------------------------------
# Convention about Training / Test specific parameters
# -----------------------------------------------------------------------------
# Whenever an argument can be either used for training or for testing, the
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
# or _TEST for a test-specific parameter.
# For example, the number of images during training will be
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
# IMAGES_PER_BATCH_TEST

# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------

_C = CN()

_C.MODEL = CN()
_C.MODEL.RPN_ONLY = False
_C.MODEL.MASK_ON = False
_C.MODEL.DEVICE = "cuda"
_C.MODEL.META_ARCHITECTURE = "GeneralizedRCNN"

# If the WEIGHT starts with a catalog://, like :R-50, the code will look for
# the path in paths_catalog. Else, it will use it as the specified absolute
# path
_C.MODEL.WEIGHT = ""


# -----------------------------------------------------------------------------
# INPUT
Exemple #31
0
    def test_merge_cfg_from_cfg(self):
        # Test: merge from clone
        cfg = get_cfg()
        s = "dummy0"
        cfg2 = cfg.clone()
        cfg2.MODEL.TYPE = s
        cfg.merge_from_other_cfg(cfg2)
        assert cfg.MODEL.TYPE == s

        # Test: merge from yaml
        s = "dummy1"
        cfg2 = CN.load_cfg(cfg.dump())
        cfg2.MODEL.TYPE = s
        cfg.merge_from_other_cfg(cfg2)
        assert cfg.MODEL.TYPE == s

        # Test: merge with a valid key
        s = "dummy2"
        cfg2 = CN()
        cfg2.MODEL = CN()
        cfg2.MODEL.TYPE = s
        cfg.merge_from_other_cfg(cfg2)
        assert cfg.MODEL.TYPE == s

        # Test: merge with an invalid key
        s = "dummy3"
        cfg2 = CN()
        cfg2.FOO = CN()
        cfg2.FOO.BAR = s
        with self.assertRaises(KeyError):
            cfg.merge_from_other_cfg(cfg2)

        # Test: merge with converted type
        cfg2 = CN()
        cfg2.TRAIN = CN()
        cfg2.TRAIN.SCALES = [1]
        cfg.merge_from_other_cfg(cfg2)
        assert type(cfg.TRAIN.SCALES) is tuple
        assert cfg.TRAIN.SCALES[0] == 1

        # Test str (bytes) <-> unicode conversion for py2
        if PY2:
            cfg.A_UNICODE_KEY = u"foo"
            cfg2 = CN()
            cfg2.A_UNICODE_KEY = b"bar"
            cfg.merge_from_other_cfg(cfg2)
            assert type(cfg.A_UNICODE_KEY) == unicode  # noqa: F821
            assert cfg.A_UNICODE_KEY == u"bar"

        # Test: merge with invalid type
        cfg2 = CN()
        cfg2.TRAIN = CN()
        cfg2.TRAIN.SCALES = 1
        with self.assertRaises(ValueError):
            cfg.merge_from_other_cfg(cfg2)