# TAG: a Tuning-free Attention-driven GUI Grounding method for GUI task automation
AAAI 2025
### Task2: GUI Element Grounding
We evaluate methods on the [ScreenSpot](https://huggingface.co/datasets/rootsautomation/ScreenSpot) dataset.
**Visual Demonstration:**
### Task3: GUI Agent Evaluation
We evaluate methods on the Element accuracy metric on [Mind2Web](https://osu-nlp-group.github.io/Mind2Web/) dataset.
**Visual Demonstration:**
## Installation
### Dataset Preparation
Please download the following three benchmarks: [OCG](https://drive.google.com/drive/folders/1cIwpxUH6NlZ2JX1AKxLa44ule9cS6jOA?usp=sharing), [ScreenSpot](https://drive.google.com/drive/folders/1FuFT05yXOV_QxhwYft85YTLOgaIYm_fS) and Mind2Web [screenshots](https://box.nju.edu.cn/f/33e203d170ab48b0b922/) and [annotations](https://box.nju.edu.cn/f/e30b861fa7604668821b/). Please **DO NOT** redistribute the unzipped data files online to avoid risks such as model overfitting.
### Env Preparation
1. Clone this repository and enter the project folder
```bash
git clone https://github.com/HeimingX/TAG.git
cd TAG
```
2. Create conda environment
```Shell
conda create -n TAG python=3.10 -y
conda activate TAG
```
3. Install dependencies
```shell
pip install -r requirements.txt
```
## Eval Scripts
### Task1: OCG
```shell
MLLM_PATH=openbmb/MiniCPM-Llama3-V-2_5
OCG_DATAPATH=PATH/TO/OCG
IMG_ASPECTS='[[1, 4], [9, 21], [9, 19], [1, 2], [9, 16], [4, 3], [16, 9], [2, 1], [21, 9], [4, 1]]'
# Evaluate with MiniCPMV2.5
python eval_mm/ocg/eval_MiniCPMV2_5.py \
--mllm_path ${MLLM_PATH} \
--data_path ${OCG_DATAPATH} \
--image_aspects "${IMG_ASPECTS}" \
--save-dir output/ocg/mv2_5 \
--sampling
# Evaluate with TAG
python eval_mm/ocg/eval_TAG.py \
--mllm_path ${MLLM_PATH} \
--data_path ${OCG_DATAPATH} \
--image_aspects "${IMG_ASPECTS}" \
--save-dir output/ocg/tag \
--batchsize 4
```
### Task2: ScreenSpot
```shell
MLLM_PATH=openbmb/MiniCPM-Llama3-V-2_5
SCREENSPOT_IMGS=PATH/TO/IMGS
SCREENSPOT_TEST=PATH/TO/TESTSET
# Evaluate with MiniCPMV2.5
python eval_mm/screenspot/eval_MiniCPMV2_5.py \
--mllm_path ${MLLM_PATH} \
--screenspot_imgs ${SCREENSPOT_IMGS} \
--screenspot_test ${SCREENSPOT_TEST} \
--save-dir output/screenspot/mv2_5
# Evaluate with TAG
python eval_mm/screenspot/eval_TAG.py \
--mllm_path ${MLLM_PATH} \
--screenspot_imgs ${SCREENSPOT_IMGS} \
--screenspot_test ${SCREENSPOT_TEST} \
--save-dir output/screenspot/tag
```
### Task3: Mind2Web
```shell
MLLM_PATH=openbmb/MiniCPM-Llama3-V-2_5
MIND2WEB_DATAPATH=PATH/TO/MIND2WEB
TASKTYPES=(task website domain)
for TASK in "${TASKTYPES[@]}"
do
# Evaluate with MiniCPMV2.5
python eval_mm/mind2web/eval_MiniCPMV2_5.py \
--mllm_path ${MLLM_PATH} \
--data_dir ${MIND2WEB_DATAPATH} \
--task ${TASK} \
--save-dir output/mind2web/mv2_5
# Evaluate with TAG
python eval_mm/mind2web/eval_TAG.py \
--mllm_path ${MLLM_PATH} \
--data_dir ${MIND2WEB_DATAPATH} \
--task ${TASK} \
--save-dir output/mind2web/tag \
done
```
> Note: some evaluation [log](https://drive.google.com/drive/folders/1cIwpxUH6NlZ2JX1AKxLa44ule9cS6jOA?usp=sharing) files are provided for reference.
## Acknowledgement
We thank the following [MiniCPM-V](https://github.com/OpenBMB/MiniCPM-V/), [SeeClick](https://github.com/njucckevin/SeeClick) and [Mind2Web](https://github.com/OSU-NLP-Group/Mind2Web) for their impressive work and open-sourced projects.
## Citation
If you find our code/paper helpful, please consider cite our paper 📝 and star us ⭐️!
```bibtext
@inproceedings{xu2025tag,
title={Attention-driven GUI Grounding: Leveraging Pretrained Multimodal Large Language Models without Fine-Tuning},
author={Hai-Ming Xu and Qi Chen and Lei Wang and Lingqiao Liu},
booktitle={The 39th Annual AAAI Conference on Artificial Intelligence},
year={2025},
}
```