File size: 1,672 Bytes
500565b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.

from detectron2.config import CfgNode as CN


def add_tensormask_config(cfg):
    """
    Add config for TensorMask.
    """
    cfg.MODEL.TENSOR_MASK = CN()

    # Anchor parameters
    cfg.MODEL.TENSOR_MASK.IN_FEATURES = ["p2", "p3", "p4", "p5", "p6", "p7"]

    # Convolutions to use in the towers
    cfg.MODEL.TENSOR_MASK.NUM_CONVS = 4

    # Number of foreground classes.
    cfg.MODEL.TENSOR_MASK.NUM_CLASSES = 80
    # Channel size for the classification tower
    cfg.MODEL.TENSOR_MASK.CLS_CHANNELS = 256

    cfg.MODEL.TENSOR_MASK.SCORE_THRESH_TEST = 0.05
    # Only the top (1000 * #levels) candidate boxes across all levels are
    # considered jointly during test (to improve speed)
    cfg.MODEL.TENSOR_MASK.TOPK_CANDIDATES_TEST = 6000
    cfg.MODEL.TENSOR_MASK.NMS_THRESH_TEST = 0.5

    # Box parameters
    # Channel size for the box tower
    cfg.MODEL.TENSOR_MASK.BBOX_CHANNELS = 128
    # Weights on (dx, dy, dw, dh)
    cfg.MODEL.TENSOR_MASK.BBOX_REG_WEIGHTS = (1.5, 1.5, 0.75, 0.75)

    # Loss parameters
    cfg.MODEL.TENSOR_MASK.FOCAL_LOSS_GAMMA = 3.0
    cfg.MODEL.TENSOR_MASK.FOCAL_LOSS_ALPHA = 0.3

    # Mask parameters
    # Channel size for the mask tower
    cfg.MODEL.TENSOR_MASK.MASK_CHANNELS = 128
    # Mask loss weight
    cfg.MODEL.TENSOR_MASK.MASK_LOSS_WEIGHT = 2.0
    # weight on positive pixels within the mask
    cfg.MODEL.TENSOR_MASK.POSITIVE_WEIGHT = 1.5
    # Whether to predict in the aligned representation
    cfg.MODEL.TENSOR_MASK.ALIGNED_ON = False
    # Whether to use the bipyramid architecture
    cfg.MODEL.TENSOR_MASK.BIPYRAMID_ON = False