#!/bin/bash
set -e

: "${DET_CONFIG:=configs/det/PP-OCRv5/PP-OCRv5_server_det.yml}"
: "${DATA_ROOT:=../../train_data/japanese_ocr}"
: "${SAVE_DIR:=../../output/train/det_product}"
: "${LR:=0.0001}"

echo "DET_CONFIG=${DET_CONFIG}"
echo "DATA_ROOT=${DATA_ROOT}"
echo "SAVE_DIR=${SAVE_DIR}"
echo "LR=${LR}"

python tools/train.py \
  -c "${DET_CONFIG}" \
  -o \
  Global.save_model_dir="${SAVE_DIR}" \
  Optimizer.lr.learning_rate="${LR}" \
  Train.dataset.data_dir="${DATA_ROOT}/det" \
  Train.dataset.label_file_list="[${DATA_ROOT}/det/train_label.txt]" \
  Eval.dataset.data_dir="${DATA_ROOT}/det" \
  Eval.dataset.label_file_list="[${DATA_ROOT}/det/val_label.txt]"
