Views
No views yet
mkdir outputs
mkdir model_weightspip install pycocotools{DATA_ROOT}
|-- Annotation
| |--hico-det-instance-level
| | |--hico-det-training-set-instance-level.json
| `--hico-fullbody-pose
| |--halpe_train_v1.json
| `--halpe_val_v1.json
|── Configs
| |--hico_hoi_list.txt
| `--Part_State_76.txt
|── Images
| |--images
| |--test2015
| | |--HICO_test2015_00000001.jpg
| | |--HICO_test2015_00000002.jpg
| | ...
| `--train2015
| |--HICO_train2015_00000001.jpg
| |--HICO_train2015_00000002.jpg
| ...
`── Logic_Rules
|--gather_rule.pkl
`--read_rules.pyIDX={YOUR_GPU_IDS}
export PYTHONPATH=$PYTHONPATH:./
data_path={DATA_ROOT}
model_path={ROOT}/model_weights/{YOUR_MODEL_NAME}
output_dir={ROOT}/outputs
if [ -d ${output_dir} ];then
echo "dir already exists"
else
mkdir ${output_dir}
fi
CUDA_VISIBLE_DEVICES=$IDX OMP_NUM_THREADS=1 torchrun --nnodes=1 --nproc_per_node={NUM_YOUR_GPUs} --master_port=25005 \
tools/annotate_hico.py \
--model-path ${model_path} \
--data-path ${data_path} \
--output-dir ${output_dir} \bash scripts/annotate_hico.shConversation in data/convsersation.py.bash scripts/annotate_hico.shoutputs/labels_0.json
outputs/labels_1.jsonpython3 tools/merge_json_outputs.py \
--input-dir outputs \
--pattern "labels_*.json" \
--output-path outputs/merged_labels.jsonrefined_description field. It uses Conversation_For_Clean_Descrption in data/convsersation.py.data_path, model_path, annotation_path, and output_dir in scripts/refine_hico.sh, then run:bash scripts/refine_hico.shoutputs/refine/refine_labels_0.jsonpython3 tools/merge_json_outputs.py \
--input-dir outputs/refine \
--pattern "refine_labels_*.json" \
--output-path outputs/merged_refine.jsonexaminer_result field. It uses Conversation_examiner in data/convsersation.py.data_path, model_path, annotation_path, and output_dir in scripts/examine_hico.sh, then run:bash scripts/examine_hico.shoutputs/examiner/examiner_labels_0.jsonpython3 tools/merge_json_outputs.py \
--input-dir outputs/examiner \
--pattern "examiner_labels_*.json" \
--output-path outputs/merged_examine.jsonbash scripts/pipeline_hico.shscripts/pipeline_hico.sh:DATA_PATHLONG_MODEL_PATHREFINE_MODEL_PATHEXAMINE_MODEL_PATHLONG_GPU_IDSREFINE_GPU_IDSEXAMINE_GPU_IDSLONG_NPROCREFINE_NPROCEXAMINE_NPROCoutputs/pipeline/merged_long.jsonoutputs/pipeline/merged_refine.jsonoutputs/pipeline/merged_examine.jsontools/vlm_backend.py, so you can use different VLM families for long-description generation, refinement, and examination.tools/annotate_hico.pytools/refine_hico.pytools/examine_hico.pytools/clean_initial_annotation.py--model-path--model-backend--torch-dtypetorchrun --nnodes=1 --nproc_per_node=1 tools/annotate_hico.py \
--model-path /path/to/model \
--model-backend auto \
--torch-dtype bfloat16 \
--data-path ../datasets/HICO-Det \
--output-dir outputs/test \
--max-samples 5--model-backend qwen3_vl
--model-backend qwen3_vl_moe
--model-backend llava
--model-backend deepseek_vl
--model-backend hf_vision2seq
--model-backend hf_causal_vlmtools/vlm_backend.pyinfer_model_backend(...)load_model_and_processor(...)build_batch_tensors(...)decode_generated_text(...)AutoProcessor and AutoModelForVision2Seq or AutoModelForCausalLM.
In that case, you may only need to run with:--model-backend auto--model-backend hf_vision2seq--model-backend hf_causal_vlminfer_model_backend(...) in tools/vlm_backend.py.load_model_and_processor(...)build_batch_tensors(...)decode_generated_text(...) if neededdata/convsersation.py.tools/vlm_backend.py.tools/.{
'file_name': 'HICO_train2015_00009511.jpg',
'image_id': 0,
'keypoints': a 51-elements list (17x3 keypoints with x, y, v),
'vis': a 51-elements list (17 keypionts, each has 3 visiblity flags),
'instance_id':0,
'action_labels': [{'human_part': part_id, 'partstate': state_id}, ...],
'height': 640,
'width': 480,
'human_bbox': [126, 258, 150, 305],
'object_bbox': [128, 276, 144, 313],
'description': "The person is riding a bicycle, supported by visible evidence of their body interacting with the bike.\n\n- The right hand is holding the right handlebar.\n- The left hand is holding the left handlebar.\n- The right hip is positioned over the seat, indicating the person is sitting on the bicycle.\n- The right foot is on the right pedal.\n- The left foot is on the left pedal."
}{
'refined_description': "A refined 2-3 sentence version aligned with the target HOI label.",
'examiner_result': "Verdict: PASS or FAIL ..."
}{DATA_ROOT}
|-- annotations
| |--person_keypoints_train2017.json
| `--person_keypoints_val2017.json
|── Configs
| |--hico_hoi_list.txt
| `--Part_State_76.txt
|── train2017
| |--000000000009.jpg
| |--000000000025.jpg
| ...
`-- val2017
|--000000000139.jpg
|--000000000285.jpg
...
IDX={YOUR_GPU_IDS}
export PYTHONPATH=$PYTHONPATH:./
data_path={DATA_ROOT}
model_path={ROOT}/model_weights/{YOUR_MODEL_NAME}
output_dir={ROOT}/outputs
if [ -d ${output_dir} ];then
echo "dir already exists"
else
mkdir ${output_dir}
fi
CUDA_VISIBLE_DEVICES=$IDX OMP_NUM_THREADS=1 torchrun --nnodes=1 --nproc_per_node={NUM_YOUR_GPUs} --master_port=25005 \
tools/annotate_coco.py \
--model-path ${model_path} \
--data-path ${data_path} \
--output-dir ${output_dir} \bash scripts/annotate_coco.shdataset = PoseCOCODataset(
data_path=os.path.join(args.data_path, 'annotations', 'person_keypoints_train2017.json'), # <- Line 167
multimodal_cfg=dict(image_folder=os.path.join(args.data_path, 'train2017'), # <- Line 168
data_augmentation=False,
image_size=336,),){
'file_name': '000000000009.jpg',
'image_id': 9,
'keypoints': a 51-elements list (17x3 keypoints with x, y, v),
'vis': a 51-elements list (17 keypionts, each has 3 visiblity flags),
'height': 640,
'width': 480,
'human_bbox': [126, 258, 150, 305],
'description': "The person is riding a bicycle, supported by visible evidence of their body interacting with the bike.\n\n- The right hand is holding the right handlebar.\n- The left hand is holding the left handlebar.\n- The right hip is positioned over the seat, indicating the person is sitting on the bicycle.\n- The right foot is on the right pedal.\n- The left foot is on the left pedal."
}