Restore README
Browse files
README.md
CHANGED
|
@@ -1,3 +1,91 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LLM auto annotation for HICO-DET dataset (Pose from [Halpe](https://github.com/Fang-Haoshu/Halpe-FullBody), Part State from [HAKE](https://github.com/DirtyHarryLYL/HAKE)).
|
| 2 |
+
|
| 3 |
+
## Environment
|
| 4 |
+
The code is developed using python 3.11.11 on Ubuntu 21.xx with torch==2.6.0+cu124,
|
| 5 |
+
transformers==4.57.3 (with Qwen3 series)
|
| 6 |
+
|
| 7 |
+
## Quick start
|
| 8 |
+
### Installation
|
| 9 |
+
1. Install required packges and dependencies.
|
| 10 |
+
2. Clone this repo, and we'll call the directory that you cloned as ${ROOT}.
|
| 11 |
+
3. Creat necessary directories:
|
| 12 |
+
```
|
| 13 |
+
mkdir outputs
|
| 14 |
+
mkdir model_weights
|
| 15 |
+
```
|
| 16 |
+
4. Download LLM's weights into model_weights from hugging face.
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
### Prepare Dataset
|
| 20 |
+
5. Download [dataset]().
|
| 21 |
+
6. Organize dataset, your directory tree of dataset should look like this (there maybe extra files.):
|
| 22 |
+
```
|
| 23 |
+
{DATA_ROOT}
|
| 24 |
+
|-- Annotation
|
| 25 |
+
| |--hico-det-instance-level
|
| 26 |
+
| | |--hico-det-training-set-instance-level.json
|
| 27 |
+
| `--hico-fullbody-pose
|
| 28 |
+
| |--halpe_train_v1.json
|
| 29 |
+
| `--halpe_val_v1.json
|
| 30 |
+
|── Configs
|
| 31 |
+
| |--hico_hoi_list.txt
|
| 32 |
+
| `--Part_State_76.txt
|
| 33 |
+
|── Images
|
| 34 |
+
| |--images
|
| 35 |
+
| |--test2015
|
| 36 |
+
| | |--HICO_test2015_00000001.jpg
|
| 37 |
+
| | |--HICO_test2015_00000002.jpg
|
| 38 |
+
| | ...
|
| 39 |
+
| `--train2015
|
| 40 |
+
| |--HICO_train2015_00000001.jpg
|
| 41 |
+
| |--HICO_train2015_00000002.jpg
|
| 42 |
+
| ...
|
| 43 |
+
`── Logic_Rules
|
| 44 |
+
|--gather_rule.pkl
|
| 45 |
+
`--read_rules.py
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### Start annotation
|
| 49 |
+
#### Modify the data_path, model_path, output_dir='outputs' by your configuration in "{ROOT}/scripts/annotate.sh".
|
| 50 |
+
```
|
| 51 |
+
IDX={YOUR_GPU_IDS}
|
| 52 |
+
export PYTHONPATH=$PYTHONPATH:./
|
| 53 |
+
|
| 54 |
+
data_path={DATA_ROOT}
|
| 55 |
+
model_path={ROOT}/model_weights/{YOUR_MODEL_NAME}
|
| 56 |
+
output_dir={ROOT}/outputs
|
| 57 |
+
|
| 58 |
+
if [ -d ${output_dir} ];then
|
| 59 |
+
echo "dir already exists"
|
| 60 |
+
else
|
| 61 |
+
mkdir ${output_dir}
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
+
CUDA_VISIBLE_DEVICES=$IDX OMP_NUM_THREADS=1 torchrun --nnodes=1 --nproc_per_node={NUM_YOUR_GPUs} --master_port=25005 \
|
| 65 |
+
tools/annotate.py \
|
| 66 |
+
--model-path ${model_path} \
|
| 67 |
+
--data-path ${data_path} \
|
| 68 |
+
--output-dir ${output_dir} \
|
| 69 |
+
```
|
| 70 |
+
#### Start auto-annotation
|
| 71 |
+
```
|
| 72 |
+
bash scripts/annotate.sh
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Annotation format
|
| 76 |
+
A list of dict that contains the following keys:
|
| 77 |
+
```
|
| 78 |
+
{
|
| 79 |
+
'file_name': 'HICO_train2015_00009511.jpg',
|
| 80 |
+
'image_id': 0,
|
| 81 |
+
'keypoints': a 51-elements list (17x3 keypoints with x, y, v),
|
| 82 |
+
'vis': a 51-elements list (17 keypionts, each has 3 visiblity flags),
|
| 83 |
+
'instance_id':0,
|
| 84 |
+
'action_labels': [{'human_part': part_id, 'partstate': state_id}, ...],
|
| 85 |
+
'height': 640,
|
| 86 |
+
'width': 480,
|
| 87 |
+
'human_bbox': [126, 258, 150, 305],
|
| 88 |
+
'object_bbox': [128, 276, 144, 313],
|
| 89 |
+
'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."
|
| 90 |
+
}
|
| 91 |
+
```
|