Update README.md
Browse files
README.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
| 2 |
|
| 3 |
# SD-VLM-8B
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
**1. Base VLM**: Utilizes the LLaVA-1.5-7B framework, consisting of a CLIP-ViT vision encoder, a Vicuna large language model (LLM), and a linear projector connecting them.
|
| 8 |
|
|
@@ -12,4 +15,93 @@ This simple addition injects explicit 3D spatial priors into the model without a
|
|
| 12 |
|
| 13 |
**3. Training Approach**: The model is efficiently fine-tuned on the MSMU spatial dataset for one epoch using LoRA, keeping the vision encoder frozen. This allows the LLM and projector to learn how to interpret the depth-enhanced visual features for quantitative reasoning.
|
| 14 |
|
| 15 |
-
In essence, SD-VLM's structure is defined by a streamlined integration: it upgrades a standard VLM to understand 3D space by fusing depth information into visual features through a parameter-free additive operation, all trained efficiently on targeted data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
# SD-VLM-8B
|
| 4 |
|
| 5 |
+
[**🌐 Homepage**](https://cpystan.github.io/SD_VLM_pages/) | [**🤗 Dataset**](https://huggingface.co/datasets/cpystan/MSMU) | [**📖 arXiv**](https://arxiv.org/abs/2509.17664) | [**GitHub**](https://github.com/cpystan/SD-VLM)
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
🎯 **The SD-VLM architecture enhances a standard Vision-Language Model (VLM) with 3D spatial awareness through a minimal yet effective modification.**
|
| 9 |
|
| 10 |
**1. Base VLM**: Utilizes the LLaVA-1.5-7B framework, consisting of a CLIP-ViT vision encoder, a Vicuna large language model (LLM), and a linear projector connecting them.
|
| 11 |
|
|
|
|
| 15 |
|
| 16 |
**3. Training Approach**: The model is efficiently fine-tuned on the MSMU spatial dataset for one epoch using LoRA, keeping the vision encoder frozen. This allows the LLM and projector to learn how to interpret the depth-enhanced visual features for quantitative reasoning.
|
| 17 |
|
| 18 |
+
In essence, SD-VLM's structure is defined by a streamlined integration: it upgrades a standard VLM to understand 3D space by fusing depth information into visual features through a parameter-free additive operation, all trained efficiently on targeted data.
|
| 19 |
+
|
| 20 |
+
### Model Framework
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
<img src="https://huggingface.co/spaces/cpystan/images/resolve/main/framework.png"
|
| 24 |
+
width="56%" />
|
| 25 |
+
|
| 26 |
+
### Quick Start!
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
from llava.model.builder import load_pretrained_model
|
| 30 |
+
from llava.mm_utils import get_model_name_from_path
|
| 31 |
+
from llava.eval.run_llava import eval_model
|
| 32 |
+
from llava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN
|
| 33 |
+
import copy
|
| 34 |
+
|
| 35 |
+
model_path = "cpystan/SD-VLM-7B"
|
| 36 |
+
|
| 37 |
+
tokenizer, model, image_processor, context_len = load_pretrained_model(
|
| 38 |
+
model_path=model_path,
|
| 39 |
+
model_base=None,
|
| 40 |
+
model_name=get_model_name_from_path(model_path)
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
input_ids = tokenizer_image_token(prompt, tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).cuda()
|
| 44 |
+
image = Image.open(os.path.join(image_folder, image_file)).convert('RGB')
|
| 45 |
+
ori_img = copy.deepcopy(image)
|
| 46 |
+
image_tensor = process_images([image], image_processor, model.config)[0]
|
| 47 |
+
|
| 48 |
+
with torch.inference_mode():
|
| 49 |
+
output_ids = model.generate(
|
| 50 |
+
input_ids,
|
| 51 |
+
images=image_tensor.unsqueeze(0).half().to(input_ids.device),
|
| 52 |
+
image_sizes=[image.size],
|
| 53 |
+
do_sample=True if temperature > 0 else False,
|
| 54 |
+
temperature=0.2,
|
| 55 |
+
top_p=None,
|
| 56 |
+
num_beams=1,
|
| 57 |
+
ori_imgs = [ori_img],
|
| 58 |
+
max_new_tokens=1024,
|
| 59 |
+
use_cache=True,)
|
| 60 |
+
response= tokenizer.batch_decode(output_ids, skip_special_tokens=True)[0].strip()
|
| 61 |
+
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
## 🏆 Mini-Leaderboard
|
| 66 |
+
We show a mini-leaderboard here. It shows the results of each sub-category and the overall performance.
|
| 67 |
+
|
| 68 |
+
# Results on MSMU-Bench
|
| 69 |
+
|
| 70 |
+
| Model | Existence | Object<br>Counting | Scale<br>Est. | Grounding | Relative<br>Position | Absolute<br>Distance | Scale<br>Comparison | Ref. Object<br>Est. | Average |
|
| 71 |
+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
| 72 |
+
| **Large Language Models (LLMs): Text only** |||||||||
|
| 73 |
+
| GPT-4-Turbo | 12.76 | 5.21 | 13.51 | 12.64 | 24.84 | 7.50 | 36.79 | 12.04 | 15.66 |
|
| 74 |
+
| Qwen2.5 | 4.25 | 0.00 | 0.78 | 13.79 | 0.62 | 0.00 | 16.04 | 1.57 | 4.63 |
|
| 75 |
+
| DeepSeek-V3 | 0.00 | 5.24 | 1.54 | 6.90 | 10.56 | 0.00 | 25.47 | 5.24 | 7.39 |
|
| 76 |
+
| **Vision-Language Models (VLMs): Image + Text** |||||||||
|
| 77 |
+
| GPT-4o | 44.68 | 41.67 | 3.86 | 27.59 | 67.08 | 20.00 | 54.72 | 2.09 | 32.28 |
|
| 78 |
+
| Gemini-2 | 38.30 | 43.75 | 23.94 | 19.54 | 54.66 | 12.50 | 69.81 | 18.85 | 35.17 |
|
| 79 |
+
| Qwen2.5-VL-72B | 59.57 | 35.42 | 1.54 | 13.79 | 57.76 | 2.50 | 66.04 | 9.95 | 30.82 |
|
| 80 |
+
| Qwen2.5-VL-32B | 29.79 | 41.67 | 10.81 | 18.39 | 60.25 | 2.50 | 46.23 | 10.99 | 27.59 |
|
| 81 |
+
| Qwen2.5-VL-7B | 12.76 | 4.17 | 0.00 | 1.15 | 1.24 | 0.00 | 5.66 | 0.52 | 3.19 |
|
| 82 |
+
| Intern-VL3-78B | 47.62 | 42.71 | 6.47 | 26.32 | 56.94 | 13.33 | 64.10 | 16.46 | 33.63 |
|
| 83 |
+
| Intern-VL3-8B | 36.17 | 41.67 | 4.63 | 18.39 | 60.25 | 2.50 | 49.06 | 8.38 | 28.54 |
|
| 84 |
+
| LLaVA-1.5-7B | 1.54 | 36.46 | 5.02 | 20.69 | 42.86 | 5.00 | 38.68 | 0.52 | 19.45 |
|
| 85 |
+
| **Depth-encoded VLMs: Image + Depth + Text** |||||||||
|
| 86 |
+
| SpatialBot | 10.64 | 46.88 | 15.83 | 28.74 | 66.46 | 5.00 | 50.94 | 8.90 | 29.17 |
|
| 87 |
+
| SpatialRGPT | 10.64 | 36.46 | 20.08 | 17.24 | 60.25 | 15.00 | 62.26 | 9.95 | 28.98 |
|
| 88 |
+
| **SD-VLM-8B** |87.23 | 47.92 | 51.35 | 42.53 | 75.16 | 40.00 | 55.66 | 46.07 | **56.31** |
|
| 89 |
+
|
| 90 |
+
# Examples
|
| 91 |
+
|
| 92 |
+
<img src="https://huggingface.co/spaces/cpystan/images/resolve/main/result_vis.png"
|
| 93 |
+
width="56%" />
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
## Citation
|
| 97 |
+
|
| 98 |
+
**BibTeX:**
|
| 99 |
+
```bibtex
|
| 100 |
+
@misc{chen2025sdvlm,
|
| 101 |
+
title={SD-VLM: Spatial Measuring and Understanding with Depth-Encoded Vision-Language Models},
|
| 102 |
+
author={Pingyi Chen and Yujing Lou and Shen Cao and Jinhui Guo and Lubin Fan and Yue Wu and Lin Yang and Lizhuang Ma and Jieping Ye},
|
| 103 |
+
year={2025},
|
| 104 |
+
url={https://arxiv.org/abs/2509.17664},
|
| 105 |
+
}
|
| 106 |
+
```
|
| 107 |
+
|