#dataloader:
#  evaluator: {_target_: detectron2.evaluation.COCOEvaluator, dataset_name: '${..test.dataset.names}'}
#  test:
#    _target_: detectron2.data.build_detection_test_loader
#    dataset: {_target_: detectron2.data.get_detection_dataset_dicts, filter_empty: false, names: custom-coco-fine-val}
#    mapper:
#      _target_: detectron2.data.DatasetMapper
#      augmentations:
#      - {_target_: detectron2.data.transforms.ResizeShortestEdge, max_size: 1536, short_edge_length: 1536}
#      image_format: ${...train.mapper.image_format}
#      is_train: false
#    num_workers: 0
#  train:
#    _target_: detectron2.data.build_detection_train_loader
#    dataset: {_target_: detectron2.data.get_detection_dataset_dicts, names: custom-coco-fine-train}
#    mapper:
#      _target_: detectron2.data.DatasetMapper
#      augmentations:
#      - {_target_: detectron2.data.transforms.RandomFlip, horizontal: true}
#      - {_target_: detectron2.data.transforms.ResizeScale, max_scale: 2.0, min_scale: 0.1, target_height: 1536, target_width: 1536}
#      - _target_: detectron2.data.transforms.FixedSizeCrop
#        crop_size: [1536, 1536]
#        pad: false
#      image_format: RGB
#      is_train: true
#      recompute_boxes: true
#      use_instance_mask: true
#    num_workers: 4
#    total_batch_size: 1
lr_multiplier:
  _target_: detectron2.solver.WarmupParamScheduler
  scheduler: {_target_: fvcore.common.param_scheduler.CosineParamScheduler, end_value: 1, start_value: 1}
  warmup_factor: 0.001
  warmup_length: 0.01
model:
  _target_: detectron2.modeling.GeneralizedRCNN
  backbone:
    _target_: detectron2.modeling.SimpleFeaturePyramid
    in_feature: ${.net.out_feature}
    net:
      _target_: detectron2.modeling.ViT
      depth: 24
      drop_path_rate: 0.3
      embed_dim: 1024
      img_size: 1536
      mlp_ratio: 2.6666666666666665
      norm_layer: !!python/object/apply:functools.partial
        args: [&id001 !!python/name:torch.nn.modules.normalization.LayerNorm '']
        state: !!python/tuple
        - *id001
        - !!python/tuple []
        - {eps: 1.0e-06}
        - null
      num_heads: 16
      out_feature: last_feat
      patch_size: 16
      qkv_bias: true
      residual_block_indexes: []
      use_act_checkpoint: true
      use_rel_pos: true
      window_block_indexes: [0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22]
      window_size: 16
    norm: LN
    out_channels: 256
    scale_factors: [4.0, 2.0, 1.0, 0.5]
    square_pad: 1536
    top_block: {_target_: detectron2.modeling.backbone.fpn.LastLevelMaxPool}
  input_format: RGB
  pixel_mean: [123.675, 116.28, 103.53]
  pixel_std: [58.395, 57.12, 57.375]
  proposal_generator:
    _target_: detectron2.modeling.proposal_generator.RPN
    anchor_generator:
      _target_: detectron2.modeling.anchor_generator.DefaultAnchorGenerator
      aspect_ratios: [0.5, 1.0, 2.0]
      offset: 0.0
      sizes:
      - [32]
      - [64]
      - [128]
      - [256]
      - [512]
      strides: [4, 8, 16, 32, 64]
    anchor_matcher:
      _target_: detectron2.modeling.matcher.Matcher
      allow_low_quality_matches: true
      labels: [0, -1, 1]
      thresholds: [0.3, 0.7]
    batch_size_per_image: 256
    box2box_transform:
      _target_: detectron2.modeling.box_regression.Box2BoxTransform
      weights: [1.0, 1.0, 1.0, 1.0]
    head:
      _target_: detectron2.modeling.proposal_generator.StandardRPNHead
      conv_dims: [-1, -1]
      in_channels: 256
      num_anchors: 3
    in_features: [p2, p3, p4, p5, p6]
    nms_thresh: 0.7
    positive_fraction: 0.5
    post_nms_topk: [1000, 1000]
    pre_nms_topk: [2000, 1000]
  roi_heads:
    _target_: detectron2.modeling.roi_heads.CascadeROIHeads
    batch_size_per_image: 512
    box_heads:
    - _target_: detectron2.modeling.roi_heads.FastRCNNConvFCHead
      conv_dims: [256, 256, 256, 256]
      conv_norm: LN
      fc_dims: [1024]
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 256, height: 7, stride: null, width: 7}
    - _target_: detectron2.modeling.roi_heads.FastRCNNConvFCHead
      conv_dims: [256, 256, 256, 256]
      conv_norm: LN
      fc_dims: [1024]
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 256, height: 7, stride: null, width: 7}
    - _target_: detectron2.modeling.roi_heads.FastRCNNConvFCHead
      conv_dims: [256, 256, 256, 256]
      conv_norm: LN
      fc_dims: [1024]
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 256, height: 7, stride: null, width: 7}
    box_in_features: [p2, p3, p4, p5]
    box_pooler:
      _target_: detectron2.modeling.poolers.ROIPooler
      output_size: 7
      pooler_type: ROIAlignV2
      sampling_ratio: 0
      scales: [0.25, 0.125, 0.0625, 0.03125]
    box_predictors:
    - _target_: detectron2.modeling.FastRCNNOutputLayers
      box2box_transform:
        _target_: detectron2.modeling.box_regression.Box2BoxTransform
        weights: [10, 10, 5, 5]
      cls_agnostic_bbox_reg: true
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 1024, height: null, stride: null, width: null}
      num_classes: ${...num_classes}
      test_score_thresh: 0.05
    - _target_: detectron2.modeling.FastRCNNOutputLayers
      box2box_transform:
        _target_: detectron2.modeling.box_regression.Box2BoxTransform
        weights: [20, 20, 10, 10]
      cls_agnostic_bbox_reg: true
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 1024, height: null, stride: null, width: null}
      num_classes: ${...num_classes}
      test_score_thresh: 0.05
    - _target_: detectron2.modeling.FastRCNNOutputLayers
      box2box_transform:
        _target_: detectron2.modeling.box_regression.Box2BoxTransform
        weights: [30, 30, 15, 15]
      cls_agnostic_bbox_reg: true
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 1024, height: null, stride: null, width: null}
      num_classes: ${...num_classes}
      test_score_thresh: 0.05
    mask_head:
      _target_: detectron2.modeling.roi_heads.MaskRCNNConvUpsampleHead
      conv_dims: [256, 256, 256, 256, 256]
      conv_norm: LN
      input_shape: !!python/object:detectron2.layers.shape_spec.ShapeSpec {channels: 256, height: 14, stride: null, width: 14}
      num_classes: ${..num_classes}
    mask_in_features: [p2, p3, p4, p5]
    mask_pooler:
      _target_: detectron2.modeling.poolers.ROIPooler
      output_size: 14
      pooler_type: ROIAlignV2
      sampling_ratio: 0
      scales: [0.25, 0.125, 0.0625, 0.03125]
    num_classes: 11
    positive_fraction: 0.25
    proposal_matchers:
    - _target_: detectron2.modeling.matcher.Matcher
      allow_low_quality_matches: false
      labels: [0, 1]
      thresholds: [0.5]
    - _target_: detectron2.modeling.matcher.Matcher
      allow_low_quality_matches: false
      labels: [0, 1]
      thresholds: [0.6]
    - _target_: detectron2.modeling.matcher.Matcher
      allow_low_quality_matches: false
      labels: [0, 1]
      thresholds: [0.7]
optimizer:
  _target_: torch.optim.AdamW
  betas: [0.9, 0.999]
  lr: 4.0e-05
  params:
    _target_: detectron2.solver.get_default_optimizer_params
    base_lr: ${..lr}
    lr_factor_func: !!python/object/apply:functools.partial
      args: [&id002 !!python/name:detectron2.modeling.backbone.vit.get_vit_lr_decay_rate '']
      state: !!python/tuple
      - *id002
      - !!python/tuple []
      - {lr_decay_rate: 0.8, num_layers: 24}
      - null
    overrides: {}
    weight_decay_norm: null
  weight_decay: 0.1
train:
  amp: {enabled: true}
  checkpointer: {max_to_keep: 100, period: 500}
  ddp: {broadcast_buffers: false, find_unused_parameters: false, fp16_compression: true}
  device: cuda
  eval_period: 500
  init_checkpoint: ./pretrained/eva02_L_coco_seg_sys_o365.pth
  log_period: 20
  max_iter: 40000
  model_ema: {decay: 0.9999, device: cuda, enabled: true, use_ema_weights_for_eval_only: false}
  output_dir: ./output
