Views
No views yet

We propose Rex-Thinker, a Chain-of-Thought (CoT) reasoning model for object referring that addresses two key challenges: lack of interpretability and inability to reject unmatched expressions. Instead of directly predicting bounding boxes, Rex-Thinker reasons step-by-step over candidate objects to determine which, if any, match a given expression. Rex-Thinker is trained in two stages: supervised fine-tuning to learn structured CoT reasoning, followed by reinforcement learning with GRPO to enhance accuracy, faithfulness, and generalization. Our approach improves both prediction precision and interpretability, while enabling the model to abstain when no suitable object is found. Below is an example of the model's reasoning process:


1conda create -n rexthinker -m python=3.10
2pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu124
3pip install -v -e .
4
5# additional packages Grounding DINO
6git clone https://github.com/IDEA-Research/GroundingDINO.git
7cd GroundingDINO
8## To support torch2.6
9git remote add quantumope https://github.com/QuantuMope/GroundingDINO.git
10git fetch quantumope PR/andrew/add-torch26-support-ms-deform-attn
11git merge quantumope/PR/andrew/add-torch26-support-ms-deform-attn
12## Continue with installation
13pip install -v -e .
14mkdir weights
15wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth -P weights
16cd ..1git lfs install
2git clone https://huggingface.co/IDEA-Research/Rex-Thinker-GRPO-7B IDEA-Research/Rex-Thinker-GRPO-7B1CUDA_VISIBLE_DEVICES=0 python demo/inference_single_image.py \
2 --image_path demo/example_images/demo_helmet.png \
3 --cate_name helmet \
4 --ref_exp the forth helmet from left \
5 --vis_path vis/example_output.jpg 1<think>OK, the user needs us to detect the fourth helmet from left. To accomplish this task, I need to break it down into the following steps:
2- Step 1: Sort the helmets from left to right.
3- Step 2: Find the fourth helmet from the sorted list.
4
5# Step 1: Sort the helmets from left to right
6I see 6 helmets in this image, and their order from left to right is [Helmet 5, Helmet 1, Helmet 3, Helmet 2, Helmet 4, Helmet 6].
7
8# Step 2: Find the fourth helmet from the sorted list
9From the sorted list [Helmet 5, Helmet 1, Helmet 3, Helmet 2, Helmet 4, Helmet 6], the fourth helmet from the left is Helmet 2.
10
11# Summarize and Re-Check answer
12Let’s now recheck our answer and put ✅ for the target helmet and ❌ for others
13- Helmet 5: It is the first helmet from left → ❌
14- Helmet 1: It is the second helmet from left → ❌
15- Helmet 3: It is the third helmet from left → ❌
16- Helmet 2: It is the fourth helmet from left → ✅
17- Helmet 4: It is the fifth helmet from left → ❌
18- Helmet 6: It is the sixth helmet from left → ❌</think><answer>json
19[{"bbox_2d": [578, 359, 825, 580], "label": "the forth helmet from left"}]
20</answer>
1CUDA_VISIBLE_DEVICES=0 python demo/gradio_demo.py \
2 --model_path IDEA-Research/Rex-Thinker-GRPO-7B \
3 --server_ip 0.0.0.0 \
4 --server_port 7860http://localhost:7860 to see the Gradio demo. You can input the image path, category name, and referring expression to test the model.
1@misc{jiang2025rexthinkergroundedobjectreferring,
2 title={Rex-Thinker: Grounded Object Referring via Chain-of-Thought Reasoning},
3 author={Qing Jiang and Xingyu Chen and Zhaoyang Zeng and Junzhi Yu and Lei Zhang},
4 year={2025},
5 eprint={2506.04034},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2506.04034},
9}