dvlab-research/PanopticFCN

train with cityscapes datasets

DejaYang opened this issue · 1 comments

hi, would you like to show me the configs you use to train with cityscapes datasets? or, can you tell me the problems with my config file? thanks a lot.

yaml file
MODEL:
META_ARCHITECTURE: "PanopticFCN"
WEIGHTS: "/mnt/lj/detectron2/projects/PanopticFCN/model_final.pth"
MASK_ON: True
PIXEL_MEAN: [123.675, 116.28, 103.53]
PIXEL_STD: [1.0, 1.0, 1.0]
RESNETS:
DEPTH: 50
OUT_FEATURES: ["res2", "res3", "res4", "res5"]
FPN:
IN_FEATURES: ["res2", "res3", "res4", "res5"]
FEATURE_ENCODER:
DEFORM: True
CONVS_DIM: 256
DATASETS:
TRAIN: ("cityscapes_fine_panoptic_train",)
TEST: ("cityscapes_fine_panoptic_val",)
DATALOADER:
FILTER_EMPTY_ANNOTATIONS: True
SOLVER:
BASE_LR: 0.02
WEIGHT_DECAY: 1e-4
LR_SCHEDULER_NAME: "WarmupPolyLR"
POLY_LR_POWER: 0.9
WARMUP_ITERS: 1000
WARMUP_FACTOR: 0.001
WARMUP_METHOD: "linear"
CLIP_GRADIENTS:
ENABLED: True
CLIP_VALUE: 35.0
IMS_PER_BATCH: 2
MAX_ITER: 270000
CHECKPOINT_PERIOD: 10000
INPUT:
MIN_SIZE_TRAIN: (512, 768, 1024, 1280, 1536, 1792, 2048)
MIN_SIZE_TRAIN_SAMPLING: "choice"
MIN_SIZE_TEST: 1024
MAX_SIZE_TRAIN: 4096
MAX_SIZE_TEST: 2048
CROP:
ENABLED: True
TYPE: "absolute"
SIZE: (512, 1024)
VERSION: 2
OUTPUT_DIR: ./output/panoptic_fn

THING.NUM_CLASSES=8、STUFF.NUM_CLASSES=11、SEM_SEG_HEAD.NUM_CLASSES=11 , is it right?

def add_panopticfcn_config(cfg):
    """
    Add config for Panoptic FCN.
    """
    cfg.MODEL.TENSOR_DIM                 = 100
    cfg.MODEL.IGNORE_VALUE               = 255
    cfg.SOLVER.POLY_LR_POWER             = 0.9
    cfg.SOLVER.POLY_LR_CONSTANT_ENDING   = 0.0

    cfg.MODEL.SEMANTIC_FPN   = CN()
    cfg.MODEL.SEMANTIC_FPN.IN_FEATURES   = ["p2", "p3", "p4", "p5"]
    cfg.MODEL.SEMANTIC_FPN.CONVS_DIM     = 256
    cfg.MODEL.SEMANTIC_FPN.COMMON_STRIDE = 4
    cfg.MODEL.SEMANTIC_FPN.NORM          = "GN"

    cfg.MODEL.POSITION_HEAD   = CN()
    cfg.MODEL.POSITION_HEAD.NUM_CONVS       = 3
    cfg.MODEL.POSITION_HEAD.COORD           = False
    cfg.MODEL.POSITION_HEAD.CONVS_DIM       = 256
    cfg.MODEL.POSITION_HEAD.NORM            = "GN"
    cfg.MODEL.POSITION_HEAD.DEFORM          = True
    cfg.MODEL.POSITION_HEAD.THING = CN()
    cfg.MODEL.POSITION_HEAD.THING.CENTER_TYPE    = "mass"
    cfg.MODEL.POSITION_HEAD.THING.POS_NUM        = 7
    cfg.MODEL.POSITION_HEAD.THING.NUM_CLASSES    = 8
    cfg.MODEL.POSITION_HEAD.THING.BIAS_VALUE     = -2.19
    cfg.MODEL.POSITION_HEAD.THING.MIN_OVERLAP    = 0.7
    cfg.MODEL.POSITION_HEAD.THING.GAUSSIAN_SIGMA = 3
    cfg.MODEL.POSITION_HEAD.THING.THRES          = 0.05
    cfg.MODEL.POSITION_HEAD.THING.TOP_NUM        = 100
    
    cfg.MODEL.POSITION_HEAD.STUFF = CN()
    cfg.MODEL.POSITION_HEAD.STUFF.NUM_CLASSES  = 11
    cfg.MODEL.POSITION_HEAD.STUFF.WITH_THING   = True
    cfg.MODEL.POSITION_HEAD.STUFF.THRES        = 0.05

    cfg.MODEL.SEM_SEG_HEAD   = CN()
    cfg.MODEL.SEM_SEG_HEAD.NUM_CLASSES  = 11
    cfg.MODEL.SEM_SEG_HEAD.IGNORE_VALUE = 255

    cfg.MODEL.KERNEL_HEAD    = CN()
    cfg.MODEL.KERNEL_HEAD.INSTANCE_SCALES = ((1, 64), (32, 128), (64, 256), (128, 512), (256, 2048),)
    cfg.MODEL.KERNEL_HEAD.TEST_SCALES     = ((1, 64), (64, 128), (128, 256), (256, 512), (512, 2048),)
    cfg.MODEL.KERNEL_HEAD.NUM_CONVS       = 3
    cfg.MODEL.KERNEL_HEAD.DEFORM          = False
    cfg.MODEL.KERNEL_HEAD.COORD           = True
    cfg.MODEL.KERNEL_HEAD.CONVS_DIM       = 256
    cfg.MODEL.KERNEL_HEAD.NORM            = "GN"

    cfg.MODEL.FEATURE_ENCODER    = CN()
    cfg.MODEL.FEATURE_ENCODER.IN_FEATURES     = ["p3", "p4", "p5", "p6", "p7"]
    cfg.MODEL.FEATURE_ENCODER.NUM_CONVS       = 3
    cfg.MODEL.FEATURE_ENCODER.CONVS_DIM       = 64
    cfg.MODEL.FEATURE_ENCODER.DEFORM          = False
    cfg.MODEL.FEATURE_ENCODER.COORD           = True
    cfg.MODEL.FEATURE_ENCODER.NORM            = ""

    cfg.MODEL.LOSS_WEIGHT    = CN()
    cfg.MODEL.LOSS_WEIGHT.POSITION          = 1.0
    cfg.MODEL.LOSS_WEIGHT.SEGMENT           = 3.0
    cfg.MODEL.LOSS_WEIGHT.FOCAL_LOSS_ALPHA  = 0.25
    cfg.MODEL.LOSS_WEIGHT.FOCAL_LOSS_GAMMA  = 2.0

    cfg.MODEL.INFERENCE      = CN()
    cfg.MODEL.INFERENCE.INST_THRES        = 0.4
    cfg.MODEL.INFERENCE.SIMILAR_THRES     = 0.9
    cfg.MODEL.INFERENCE.SIMILAR_TYPE      = "cosine"
    cfg.MODEL.INFERENCE.CLASS_SPECIFIC    = True

    cfg.MODEL.INFERENCE.COMBINE  = CN()
    cfg.MODEL.INFERENCE.COMBINE.ENABLE           = True
    cfg.MODEL.INFERENCE.COMBINE.NO_OVERLAP       = False
    cfg.MODEL.INFERENCE.COMBINE.OVERLAP_THRESH   = 0.5
    cfg.MODEL.INFERENCE.COMBINE.STUFF_AREA_LIMIT = 4096
    cfg.MODEL.INFERENCE.COMBINE.INST_THRESH      = 0.2

    cfg.MODEL.EXPORT_ONNX = False