This is a quick test for annotation pipeline of hico
Browse files
scripts/pipeline_hico_test.sh
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
export PYTHONPATH="${PYTHONPATH:-}:./"
|
| 5 |
+
|
| 6 |
+
DATA_PATH=../datasets/HICO-Det
|
| 7 |
+
|
| 8 |
+
LONG_MODEL_PATH=./model_weights/qwen3_30b_vl_instruct/models
|
| 9 |
+
REFINE_MODEL_PATH=./model_weights/qwen3_8b_vl_instruct
|
| 10 |
+
EXAMINE_MODEL_PATH=./model_weights/qwen3_30b_vl_instruct/models
|
| 11 |
+
|
| 12 |
+
LONG_GPU_IDS=0,1
|
| 13 |
+
REFINE_GPU_IDS=0,1
|
| 14 |
+
EXAMINE_GPU_IDS=0,1
|
| 15 |
+
|
| 16 |
+
LONG_NPROC=2
|
| 17 |
+
REFINE_NPROC=2
|
| 18 |
+
EXAMINE_NPROC=2
|
| 19 |
+
|
| 20 |
+
LONG_OUT_DIR=outputs/pipeline/long
|
| 21 |
+
REFINE_OUT_DIR=outputs/pipeline/refine
|
| 22 |
+
EXAMINE_OUT_DIR=outputs/pipeline/examine
|
| 23 |
+
|
| 24 |
+
MERGED_LONG_JSON=outputs/pipeline/merged_long.json
|
| 25 |
+
MERGED_REFINE_JSON=outputs/pipeline/merged_refine.json
|
| 26 |
+
MERGED_EXAMINE_JSON=outputs/pipeline/merged_examine.json
|
| 27 |
+
|
| 28 |
+
mkdir -p "${LONG_OUT_DIR}" "${REFINE_OUT_DIR}" "${EXAMINE_OUT_DIR}"
|
| 29 |
+
|
| 30 |
+
CUDA_VISIBLE_DEVICES=${LONG_GPU_IDS} OMP_NUM_THREADS=1 torchrun --nnodes=1 --nproc_per_node=${LONG_NPROC} --master_port=25011 \
|
| 31 |
+
tools/annotate_hico.py \
|
| 32 |
+
--model-path "${LONG_MODEL_PATH}" \
|
| 33 |
+
--data-path "${DATA_PATH}" \
|
| 34 |
+
--output-dir "${LONG_OUT_DIR}" \
|
| 35 |
+
--max-samples 5
|
| 36 |
+
|
| 37 |
+
python3 tools/merge_json_outputs.py \
|
| 38 |
+
--input-dir "${LONG_OUT_DIR}" \
|
| 39 |
+
--pattern "labels_*.json" \
|
| 40 |
+
--output-path "${MERGED_LONG_JSON}"
|
| 41 |
+
|
| 42 |
+
CUDA_VISIBLE_DEVICES=${REFINE_GPU_IDS} OMP_NUM_THREADS=1 torchrun --nnodes=1 --nproc_per_node=${REFINE_NPROC} --master_port=25012 \
|
| 43 |
+
tools/refine_hico.py \
|
| 44 |
+
--model-path "${REFINE_MODEL_PATH}" \
|
| 45 |
+
--data-path "${DATA_PATH}" \
|
| 46 |
+
--annotation-path "${MERGED_LONG_JSON}" \
|
| 47 |
+
--output-dir "${REFINE_OUT_DIR}" \
|
| 48 |
+
--max-samples 5
|
| 49 |
+
|
| 50 |
+
python3 tools/merge_json_outputs.py \
|
| 51 |
+
--input-dir "${REFINE_OUT_DIR}" \
|
| 52 |
+
--pattern "refine_labels_*.json" \
|
| 53 |
+
--output-path "${MERGED_REFINE_JSON}"
|
| 54 |
+
|
| 55 |
+
CUDA_VISIBLE_DEVICES=${EXAMINE_GPU_IDS} OMP_NUM_THREADS=1 torchrun --nnodes=1 --nproc_per_node=${EXAMINE_NPROC} --master_port=25013 \
|
| 56 |
+
tools/examine_hico.py \
|
| 57 |
+
--model-path "${EXAMINE_MODEL_PATH}" \
|
| 58 |
+
--data-path "${DATA_PATH}" \
|
| 59 |
+
--annotation-path "${MERGED_REFINE_JSON}" \
|
| 60 |
+
--output-dir "${EXAMINE_OUT_DIR}" \
|
| 61 |
+
--max-samples 5
|
| 62 |
+
|
| 63 |
+
python3 tools/merge_json_outputs.py \
|
| 64 |
+
--input-dir "${EXAMINE_OUT_DIR}" \
|
| 65 |
+
--pattern "examiner_labels_*.json" \
|
| 66 |
+
--output-path "${MERGED_EXAMINE_JSON}"
|
| 67 |
+
|
| 68 |
+
echo "Pipeline complete."
|
| 69 |
+
echo "Long descriptions: ${MERGED_LONG_JSON}"
|
| 70 |
+
echo "Refined descriptions: ${MERGED_REFINE_JSON}"
|
| 71 |
+
echo "Examiner results: ${MERGED_EXAMINE_JSON}"
|