# Auto-labeling pipeline config for warehouse dataset.
# Scene: fixed ground-level camera inside an active warehouse construction site.
# Workers in hard hats and safety vests, scissor lifts, ladders, hanging cables.
# Primary output: structured VLM QA via vlm_json (worker safety events, equipment near-misses)
#
# Delta from base auto_labeling.yaml:
#   - detection_and_tracking.classes: person only (no COCO-80 class for construction equipment)
#   - detection_and_tracking.max_age: 45 (workers go behind columns/equipment and re-emerge)
#   - vlm_json.frame_fps: 3 (slow-moving workers; lower fps saves tokens)
#   - mcq_generation.window_metadata_extraction.sampling_fps: 3

pipeline:
  model_cache_path: ckpts
  gpu_ids: all
  use_multi_gpu: false
  empty_output_policy: warn
  daft_validate: true

# list format required — CLI overrides data.0.inputs.video_path and data.0.output.out_dir
data:
  - inputs:
      video_path: ../input
    output:
      out_dir: ../output/pipeline_full_warehouse
      config_path: ${.out_dir}/config.yaml

endpoints:
  vlm:
    url: ""
    model: ""
  llm:
    url: ""
    model: ""

super_resolution:
  enabled: false
  # Ground-level warehouse camera; workers occupy a reasonable frame fraction — SR not needed.
  variant: seedvr2_7b
  seed: 42
  res_h: 720
  res_w: 1280
  window_frames: 128
  overlap_frames: 64
  window_timeout: 3600

detection_and_tracking:
  enabled: true
  model: rfdetr
  threshold: 0.2
  iou_threshold: 0.3
  # COCO-80 classes for warehouse construction monitoring.
  # person: workers in hard hats and safety vests.
  # No COCO-80 class for scissor lifts, ladders, or scaffolding — see README warnings.
  classes: ["person"]
  tracker: boosttrack
  use_reid: true
  reid_weights: ""
  per_class: true
  asso_func: diou
  # Moderate max_age: workers go behind columns, equipment, and ladders then re-emerge.
  min_hits: 3
  max_age: 45
  min_track_frames: 5
  save_vis: false
  save_video: true
  save_video_red_id: true
  save_rgb: false
  cross_class_iou_threshold: 0.9
  dedup_iou_threshold: 0.3
  dedup_priority: prev_iou

vlm_json:
  enabled: false
  split_json_calls: true
  # Warehouse construction safety prompt — two-JSON format (JSON 1: metadata, JSON 2: events array).
  # sub_category values: collision (worker_equipment_contact, worker_fall),
  #   near_miss (near_miss_equipment, near_miss_falling_object),
  #   anomaly (unsafe_ladder_use, cable_trip_hazard),
  #   normal_traffic (normal_construction, equipment_operation, worker_transit).
  scene_prompt_file:
  events_prompt_file:
  frame_fps: 3        # slow-moving workers; lower fps saves tokens
  resolution: 360
  max_frames: 24
  max_tokens: 8192
  timeout: 600
  rate_limit: 0

mcq_generation:
  enabled: true
  mode: question-driven-vlm-llm
  window_metadata_extraction:
    question_bank_file: /workspace/configs/window_default.json
    scene_prompt_file: null
    mcq_prompt_file: null
    qd_vlm_scene_prompt_template_file: null
    qd_mcq_mapper_prompt_template_file: null
    window_frames: 60
    single_window: false
    sampling_fps: 3      # match vlm_json.frame_fps for consistent temporal coverage
    resolution: 480
    max_frames: 100
    vlm_max_tokens: 8192
    llm_max_tokens: 8192
    timeout: 600
    rate_limit: 0
    aggregate_windows: true
    write_empty_mcq_marker: true
    skip_existing: false
    retry_missing_questions: true
    retry_missing_max_rounds: 2
    vlm_verify_enabled: true
    vlm_verify_apply_corrections: false
    vlm_verify_prompt_file: null
    vlm_verify_max_tokens: 8192
    vlm_verify_temperature: 0.0
