Spaces:
Sleeping
Sleeping
File size: 7,216 Bytes
56bd2b5 |
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# Copyright (c) Meta Platforms, Inc. and affiliates
from detectron2.config import CfgNode as CN
def get_cfg_defaults(cfg):
# A list of category names which will be used
cfg.DATASETS.CATEGORY_NAMES = []
# The category names which will be treated as ignore
# e.g., not counting as background during training
# or as false positives during evaluation.
cfg.DATASETS.IGNORE_NAMES = []
# Should the datasets appear with the same probabilty
# in batches (e.g., the imbalance from small and large
# datasets will be accounted for during sampling)
cfg.DATALOADER.BALANCE_DATASETS = False
# The thresholds for when to treat a known box
# as ignore based on too heavy of truncation or
# too low of visibility in the image. This affects
# both training and evaluation ignores.
cfg.DATASETS.TRUNCATION_THRES = 0.99
cfg.DATASETS.VISIBILITY_THRES = 0.01
cfg.DATASETS.MIN_HEIGHT_THRES = 0.00
cfg.DATASETS.MAX_DEPTH = 1e8
# Whether modal 2D boxes should be loaded,
# or if the full 3D projected boxes should be used.
cfg.DATASETS.MODAL_2D_BOXES = False
# Whether truncated 2D boxes should be loaded,
# or if the 3D full projected boxes should be used.
cfg.DATASETS.TRUNC_2D_BOXES = True
# Threshold used for matching and filtering boxes
# inside of ignore regions, within the RPN and ROIHeads
cfg.MODEL.RPN.IGNORE_THRESHOLD = 0.5
# Configuration for cube head
cfg.MODEL.ROI_CUBE_HEAD = CN()
cfg.MODEL.ROI_CUBE_HEAD.NAME = "CubeHead"
cfg.MODEL.ROI_CUBE_HEAD.POOLER_RESOLUTION = 7
cfg.MODEL.ROI_CUBE_HEAD.POOLER_SAMPLING_RATIO = 0
cfg.MODEL.ROI_CUBE_HEAD.POOLER_TYPE = "ROIAlignV2"
# Settings for the cube head features
cfg.MODEL.ROI_CUBE_HEAD.NUM_CONV = 0
cfg.MODEL.ROI_CUBE_HEAD.CONV_DIM = 256
cfg.MODEL.ROI_CUBE_HEAD.NUM_FC = 2
cfg.MODEL.ROI_CUBE_HEAD.FC_DIM = 1024
# proposal method
cfg.MODEL.ROI_CUBE_HEAD.NUMBER_OF_PROPOSALS = 1000
# the style to predict Z with currently supported
# options --> ['direct', 'sigmoid', 'log', 'clusters']
cfg.MODEL.ROI_CUBE_HEAD.Z_TYPE = "direct"
# the style to predict pose with currently supported
# options --> ['6d', 'euler', 'quaternion']
cfg.MODEL.ROI_CUBE_HEAD.POSE_TYPE = "6d"
# Whether to scale all 3D losses by inverse depth
cfg.MODEL.ROI_CUBE_HEAD.INVERSE_Z_WEIGHT = False
# Virtual depth puts all predictions of depth into
# a shared virtual space with a shared focal length.
cfg.MODEL.ROI_CUBE_HEAD.VIRTUAL_DEPTH = True
cfg.MODEL.ROI_CUBE_HEAD.VIRTUAL_FOCAL = 512.0
# If true, then all losses are computed using the 8 corners
# such that they are all in a shared scale space.
# E.g., their scale correlates with their impact on 3D IoU.
# This way no manual weights need to be set.
cfg.MODEL.ROI_CUBE_HEAD.DISENTANGLED_LOSS = True
# When > 1, the outputs of the 3D head will be based on
# a 2D scale clustering, based on 2D proposal height/width.
# This parameter describes the number of bins to cluster.
cfg.MODEL.ROI_CUBE_HEAD.CLUSTER_BINS = 1
# Whether batch norm is enabled during training.
# If false, all BN weights will be frozen.
cfg.MODEL.USE_BN = True
# Whether to predict the pose in allocentric space.
# The allocentric space may correlate better with 2D
# images compared to egocentric poses.
cfg.MODEL.ROI_CUBE_HEAD.ALLOCENTRIC_POSE = True
# Whether to use chamfer distance for disentangled losses
# of pose. This avoids periodic issues of rotation but
# may prevent the pose "direction" from being interpretable.
cfg.MODEL.ROI_CUBE_HEAD.CHAMFER_POSE = True
# Should the prediction heads share FC features or not.
# These include groups of uv, z, whl, pose.
cfg.MODEL.ROI_CUBE_HEAD.SHARED_FC = True
# Check for stable gradients. When inf is detected, skip the update.
# This prevents an occasional bad sample from exploding the model.
# The threshold below is the allows percent of bad samples.
# 0.0 is off, and 0.01 is recommended for minor robustness to exploding.
cfg.MODEL.STABILIZE = 0.01
# Whether or not to use the dimension priors
cfg.MODEL.ROI_CUBE_HEAD.DIMS_PRIORS_ENABLED = True
# How prior dimensions should be computed?
# The supported modes are ["exp", "sigmoid"]
# where exp is unbounded and sigmoid is bounded
# between +- 3 standard deviations from the mean.
cfg.MODEL.ROI_CUBE_HEAD.DIMS_PRIORS_FUNC = 'exp'
# weight for confidence loss. 0 is off.
cfg.MODEL.ROI_CUBE_HEAD.USE_CONFIDENCE = 1.0
# Loss weights for XY, Z, Dims, Pose
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_3D = 1.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_XY = 1.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_POSE = 7.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_NORMAL_VEC = 20.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_IOU = 1.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_SEG = 2.5
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_Z = 1.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_DIMS = 20.0
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_DEPTH = 1.0
cfg.MODEL.DLA = CN()
# Supported types for DLA backbones are...
# dla34, dla46_c, dla46x_c, dla60x_c, dla60, dla60x, dla102x, dla102x2, dla169
cfg.MODEL.DLA.TYPE = 'dla34'
# Only available for dla34, dla60, dla102
cfg.MODEL.DLA.TRICKS = False
# A joint loss for the disentangled loss.
# All predictions are computed using a corner
# or chamfers loss depending on chamfer_pose!
# Recommened to keep this weight small: [0.05, 0.5]
cfg.MODEL.ROI_CUBE_HEAD.LOSS_W_JOINT = 1.0
# sgd, adam, adam+amsgrad, adamw, adamw+amsgrad
cfg.SOLVER.TYPE = 'sgd'
cfg.MODEL.RESNETS.TORCHVISION = True
cfg.TEST.DETECTIONS_PER_IMAGE = 100
cfg.TEST.VISIBILITY_THRES = 1/2.0
cfg.TEST.TRUNCATION_THRES = 1/2.0
cfg.INPUT.RANDOM_FLIP = "horizontal"
# When True, we will use localization uncertainty
# as the new IoUness score in the RPN.
cfg.MODEL.RPN.OBJECTNESS_UNCERTAINTY = 'IoUness'
# If > 0.0 this is the scaling factor that will be applied to
# an RoI 2D box before doing any pooling to give more context.
# Ex. 1.5 makes width and height 50% larger.
cfg.MODEL.ROI_CUBE_HEAD.SCALE_ROI_BOXES = 0.0
# weight path specifically for pretraining (no checkpointables will be loaded)
cfg.MODEL.WEIGHTS_PRETRAIN = ''
# ## start of our things
cfg.MODEL.ROI_CUBE_HEAD.TEST = 'bas'
cfg.MODEL.ROI_CUBE_HEAD.DIMS_PRIORS_PRECOMPUTED = False
cfg.PLOT = CN(new_allowed=True)
cfg.PLOT.OUTPUT_DIR = ''
cfg.PLOT.EVAL = ''
cfg.PLOT.MODE2D = '' #either GT or PRED
cfg.PLOT.SCORING_FUNC = None
cfg.PLOT.PROPOSAL_FUNC = None
cfg.PLOT.number_of_proposals = 1000
cfg.TRAIN = CN(new_allowed=True)
cfg.TRAIN.pseudo_gt = 'learn'
# these are meant to be overwritten as an argument
cfg.log = True
# (these 2 are mutually exclusive) z_pseudo_gt_patch or z_pseudo_gt_center
cfg.loss_functions = ['dims', 'pose_alignment', 'pose_ground', 'iou', 'z', 'z_pseudo_gt_patch', 'depth']
cfg.MODEL.DEPTH_ON = False #whether to use the depth anything concated features |