#!/bin/bash
set -e

EVAL_PBTXT="experimental/james/cascade_v1/run_historical_pedestrians_eval.pbtxt"
DATA_SOURCE_PBTXT="experimental/james/cascade_v1/run_historical_pedestrians_data.pbtxt"

# Feb 24th
# mAP 0.523
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp2_pr_classifier_2a86dacb.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp2.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp2_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp2.html"

# Mar 11th
# mAP 0.675
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp13_pr_classifier_ae8007db.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp13.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp13_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp13.html"

# Apr 21st
# mAP 0.806
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp20_pr_classifier_35e115e6.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp20.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp20_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp20.html"

# May 17th
# mAP 0.831
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp25_pr_classifier_488db334.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp25.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp25_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp25.html"

# May 25th
# mAP 0.859
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp34b_pr_classifier_bd51d783.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp34b.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp34b_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp34b.html"

# July 6th
# mAP 0.888
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp46_pr_classifier_b4ef3340.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp46.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp46_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp46.html"

# July 29th
# mAP ?
CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp51_pr_classifier_b1ca0dee.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp51.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp51_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp51.html"

CLASSIFIER_PBTXT="experimental/james/cascade_v1/hist_ped/exp54_peds_pr_classifier_2b4705ab.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp54_peds.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp54_peds_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp54_peds.html"

CLASSIFIER_PBTXT="/mnt/mega1/experiments/newdata_exp55/stage_07/pr_classifier_9bd21def.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp55_peds.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp55_peds_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp55_peds.html"

CLASSIFIER_PBTXT="/mnt/mega1/experiments/newdata_exp55/stage_07/pr_classifier_4d477cce.pbtxt"
OUTPUT="/usr/local/data/experiments/newdata_exp1/hist_ped/exp55b_peds.lmdb"
PR_CURVE="/usr/local/data/experiments/newdata_exp1/hist_ped/exp55b_peds_pr.txt"
HTML="/usr/local/data/experiments/newdata_exp1/hist_ped/exp55b_peds.html"

bazel build -c opt --config=cuda vision/detection/tools:run_detector_main
./bazel-bin/vision/detection/tools/run_detector_main \
  --data_source_pbtxt=$DATA_SOURCE_PBTXT \
  --classifier_pbtxt=$CLASSIFIER_PBTXT \
  --output=$OUTPUT \
  --zoox_concurrency=1 \
  --concurrent_detection_classifier_pool_size_override=1 \
  --alsologtostderr

bazel build -c opt --config=cuda vision/detection/tools:detection_evaluator_main
./bazel-bin/vision/detection/tools/detection_evaluator_main \
  --detection_evaluator_options_file=$EVAL_PBTXT \
  --annotated_image_lmdb=$OUTPUT \
  --pr_curve=$PR_CURVE \
  --html=$HTML \
  --alsologtostderr
