# --experiment_type=scaled_yolo
# mAP 54%
runtime:
  distribution_strategy: 'tpu'
  mixed_precision_dtype: 'float32'
  tpu_enable_xla_dynamic_padder: false
task:
  model:
    input_size: [1280, 1280, 3]
    backbone:
      type: 'darknet'
      darknet:
        model_id: 'csp-large'
        max_level: 6
        min_level: 3
        width_scale: 1.00
        depth_scale: 1.00
    decoder:
      type: yolo_decoder
      yolo_decoder:
        version: v4
        type: csp_large
    head:
      smart_bias: true
    detection_generator:
      box_type:
        'all': scaled
      scale_xy:
        'all': 2.0
      max_boxes: 300
      nms_type: iou
      iou_thresh: 0.001
      nms_thresh: 0.65
    loss:
      use_scaled_loss: true
      update_on_repeat: true
      box_loss_type:
        'all': ciou
      ignore_thresh:
        'all': 0.0
      iou_normalizer:
        'all': 0.05
      cls_normalizer:
        'all': 0.5
      object_normalizer:
        '6': 0.07
        '5': 0.29
        '4': 0.7
        '3': 2.8
      objectness_smooth:
        'all': 1.0
    norm_activation:
      use_sync_bn: true
    num_classes: 80
    anchor_boxes:
      anchors_per_scale: 4
      boxes:  [box: [13, 17], box: [31, 25], box: [24, 51], box: [61, 45],
               box: [61, 45], box: [48, 102], box: [119, 96], box: [97, 189],
               box: [97, 189], box: [217, 184], box: [171, 384], box: [324, 451],
               box: [324, 451], box: [545, 357], box: [616, 618], box: [1024, 1024]]
  train_data:
    input_path: '/readahead/200M/placer/prod/home/tensorflow-performance-data/datasets/coco/train*'
    shuffle_buffer_size: 10000
    parser:
      mosaic:
        mosaic_frequency: 1.0
        mixup_frequency: 0.2
        mosaic_crop_mode: 'scale'
        mosaic_center: 0.25
        aug_scale_min: 0.1
        aug_scale_max: 1.9
      max_num_instances: 300
      letter_box: true
      random_flip: true
      aug_rand_translate: 0.1
      area_thresh: 0.1
  validation_data:
    input_path: '/readahead/200M/placer/prod/home/tensorflow-performance-data/datasets/coco/val*'
trainer:
  best_checkpoint_eval_metric: 'AP'
  best_checkpoint_export_subdir: 'best_ckpt'
  best_checkpoint_metric_comp: 'higher'
  train_steps: 231000  # 500 epochs
  optimizer_config:
    learning_rate:
      cosine:
        decay_steps: 231000  # 500 epochs
