#!/bin/bash
# ==============================================================================
# POPE Evaluation Script
# Dataset: POPE
# Type: Y/N (Yes/No classification)
# Judge: Required (gpt-4o-mini for Yes/No extraction)
# Metrics: F1 Score, Accuracy, Precision, Recall
# ==============================================================================

set -eo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# ==============================================================================
# POPE-specific Configuration
# ==============================================================================
export DATASETS="${1:-POPE}"
export WORK_DIR="${WORK_DIR:-$(pwd)/eval_outputs/pope}"

# POPE requires judge model for Yes/No extraction from ambiguous predictions
export JUDGE_MODEL="${JUDGE_MODEL:-gpt-4o-mini-20240718}"

echo "=============================================="
echo "POPE Evaluation"
echo "=============================================="
echo "Dataset: ${DATASETS}"
echo "Evaluation: F1 Score, Accuracy, Precision, Recall"
echo "Judge: ${JUDGE_MODEL}"
echo ""
echo "POPE evaluates hallucination in VLMs:"
echo "  - random: randomly sampled negative objects"
echo "  - popular: popular negative objects"
echo "  - adversarial: adversarial negative objects"
echo "=============================================="

# Delegate to the universal eval script
exec "${SCRIPT_DIR}/eval_vlm.sh" pope

