# 3D ResNet-50g video classification on Kinetics-600.
#
# --experiment_type=video_classification_kinetics600
# Expected accuracy: 78.7% accuracy, 93.6% top-5.
# Train on TPU: v3-128, eval on TPU: v3-32
runtime:
  distribution_strategy: 'tpu'
  mixed_precision_dtype: 'bfloat16'
task:
  init_checkpoint: null
  init_checkpoint_modules: all
  losses:
    l2_weight_decay: 0.0001
    label_smoothing: 0.0
  model:
    aggregate_endpoints: false
    backbone:
      resnet_3d:
        block_specs: !!python/tuple
        - temporal_kernel_sizes: !!python/tuple
          - 3
          - 3
          - 3
          temporal_strides: 1
          use_self_gating: true
        - temporal_kernel_sizes: !!python/tuple
          - 3
          - 1
          - 3
          - 1
          temporal_strides: 1
          use_self_gating: true
        - temporal_kernel_sizes: !!python/tuple
          - 3
          - 1
          - 3
          - 1
          - 3
          - 1
          temporal_strides: 1
          use_self_gating: true
        - temporal_kernel_sizes: !!python/tuple
          - 1
          - 3
          - 1
          temporal_strides: 1
          use_self_gating: true
        model_id: 50
        stem_conv_temporal_kernel_size: 5
        stem_conv_temporal_stride: 2
        stem_pool_temporal_stride: 2
        stem_type: v0
        stochastic_depth_drop_rate: 0.0
      type: resnet_3d
    dropout_rate: 0.2
    model_type: video_classification
    norm_activation:
      activation: relu
      norm_epsilon: 1.0e-05
      norm_momentum: 0.9
      use_sync_bn: false
  train_data:
    aug_max_area_ratio: 1.0
    aug_max_aspect_ratio: 2.0
    aug_min_area_ratio: 0.49
    aug_min_aspect_ratio: 0.5
    drop_remainder: true
    dtype: 'bfloat16'
    feature_shape: !!python/tuple
    - 64
    - 224
    - 224
    - 3
    global_batch_size: 1024
    min_image_size: 256
    name: kinetics600
    num_classes: 600
    split: train
  validation_data:
    dtype: 'bfloat16'
    feature_shape: !!python/tuple
    - 250
    - 224
    - 224
    - 3
    global_batch_size: 64
    min_image_size: 256
    name: kinetics600
    num_classes: 600
    num_examples: 27780
    num_test_clips: 1
    num_test_crops: 1
    one_hot: true
trainer:
  optimizer_config:
    learning_rate:
      cosine:
        alpha: 0.0
        decay_steps: 71400
        initial_learning_rate: 1.6
        name: CosineDecay
      type: cosine
    warmup:
      linear:
        name: linear
        warmup_learning_rate: 0
        warmup_steps: 1785
      type: linear
  train_steps: 71400
  steps_per_loop: 500
  summary_interval: 500
  validation_interval: 500
