PetrichorY commited on
Commit
672c3e8
·
verified ·
1 Parent(s): 877a129

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +57 -182
README.md CHANGED
@@ -1,201 +1,76 @@
1
- <div align="center">
2
-
3
- <h1>
4
- <img src="static/images/benchmark.svg" width="40" align="absmiddle" alt=""/>&nbsp; FG-BMK
5
- </h1>
6
-
7
- <br/>
8
-
9
- <a href="https://arxiv.org/abs/2606.19053">
10
- <img src="https://img.shields.io/badge/arXiv%20(EXTEND)-2606.19053-b31b1b.svg?style=for-the-badge&logo=arxiv&logoColor=white" alt="arXiv EXTEND version"/>
11
- </a>
12
- <a href="https://arxiv.org/abs/2504.14988">
13
- <img src="https://img.shields.io/badge/arXiv%20(ICLR)-2504.14988-b31b1b.svg?style=for-the-badge&logo=arxiv&logoColor=white" alt="arXiv ICLR version"/>
14
- </a>
15
- <a href="https://fg-bmk.github.io/">
16
- <img src="https://img.shields.io/badge/Project-Page-0f6e63.svg?style=for-the-badge&logo=githubpages&logoColor=white" alt="Project Page"/>
17
- </a>
18
- <a href="https://github.com/SEU-VIPGroup/FG-BMK">
19
- <img src="https://img.shields.io/badge/Code-GitHub-181717.svg?style=for-the-badge&logo=github&logoColor=white" alt="Code"/>
20
- </a>
21
-
22
- </div>
23
-
24
  ---
25
-
26
- > 📄 This repository contains the **data** and **evaluation code** for **FG-BMK**.
27
- > For an interactive leaderboard, dataset overview, and key findings, visit the **[project page](https://fg-bmk.github.io/)**.
28
-
29
- ## 🔔 News
30
-
31
- - 🔥 (***new***) An extended version of our paper is now on [arXiv](https://arxiv.org/abs/2606.19053).
32
- - ✨ Major benchmark update — we added new dataset and expanded the suite with additional experimental validation and analysis.
33
- - 🎉 Our paper has been **accepted to ICLR 2026**! The ICLR version is available on [arXiv](https://arxiv.org/abs/2504.14988).
34
- - 🚀 We released our **FG-BMK** benchmark!
35
-
36
- ## 📖 Introduction
37
-
38
- <p align="center">
39
- <img src="FG-BMK.png" width="92%" alt="FG-BMK overview"/>
40
- </p>
41
-
42
- **FG-BMK** is a comprehensive fine-grained evaluation benchmark — **1.01 million questions** over **0.28 million images** — providing a robust test bed for evaluating LVLMs. It incorporates two complementary evaluation paradigms:
43
-
44
- - **🧑 Human-oriented evaluation** — employs dialogue-like interactions to assess a model's ability to understand and respond to fine-grained visual queries in a conversational context.
45
- - **🤖 Machine-oriented evaluation** — focuses on two core fine-grained vision tasks, **image retrieval** and **recognition**, to directly measure the feature-representation capabilities of LVLMs.
46
-
47
- Compared with existing efforts — which primarily focus on fine-grained classification or use a limited number of questions — FG-BMK enables a comprehensive assessment of LVLMs' fine-grained feature representation and semantic recognition abilities. Our evaluations of **eight open-source LVLMs/VLMs** uncover key findings on the influence of training paradigms, modality alignment, perturbation susceptibility, and fine-grained category reasoning on task performance.
48
-
49
  ---
50
 
51
- # 🚀 Evaluation Guidelines
52
-
53
- ## 1. Dataset Preparation
54
-
55
- Before running inference, download the corresponding dataset images. Links to the source dataset projects are provided below — you can download the datasets to any location:
56
-
57
- | Dataset | Dataset | Dataset |
58
- |:--|:--|:--|
59
- | [FGVC-Aircraft (aircraft)](https://www.robots.ox.ac.uk/~vgg/data/fgvc-aircraft/) | [CUB-200-2011 (cub)](https://www.vision.caltech.edu/datasets/cub_200_2011/) | [DeepFashion (deepfashion)](http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion.html) |
60
- | [Oxford 102 Flower (flowers102)](https://www.robots.ox.ac.uk/~vgg/data/flowers/102/) | [Food-101 (food101)](https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/) | [iNat2021 (iNat2021)](https://github.com/visipedia/inat_comp/tree/master/2021) |
61
- | [Products-10K (products10k)](https://products-10k.github.io/challenge.html#downloads) | [SkinCon (skincon)](https://skincon-dataset.github.io/) | [Stanford Car (stanfordcar)](https://www.sighthound.com/products/alpr) |
62
- | [Stanford Dog (stanforddog)](http://vision.stanford.edu/aditya86/ImageNetDogs/) | [VegFru (vegfru)](https://github.com/ustc-vim/vegfru) | [Wine (wine)](https://tianchi.aliyun.com/dataset/110147) |
63
- | [MTARSI (mtarsi)](https://huggingface.co/datasets/amistele/MTARSI-fixed) | | |
64
-
65
- - **Human-oriented evaluations** — questions are pre-generated for each image, e.g. `benchmark/human-oriented/attribute_recognition/cub_attribute_questions.jsonl`.
66
- - **Machine-oriented evaluations** — dataset categories and the corresponding `train.csv` / `test.csv` splits live in directories such as `benchmark/machine-oriented/aircraft`.
67
 
68
- ## 2. Environment & Checkpoint Preparation
69
 
70
- Our evaluation covers **eight LVLMs/VLMs**. The table below lists the project and checkpoint for each model, to help you configure the environment and download the relevant weights:
71
 
72
- | Model Project | Checkpoint |
73
- |:--|:--|
74
- | [InternVL](https://github.com/OpenGVLab/InternVL) | [InternVL-Chat-V1.1](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-1) |
75
- | [LLaVA-1.5](https://github.com/haotian-liu/LLaVA) | [LLaVA-1.5-7B](https://huggingface.co/liuhaotian/llava-v1.5-7b) |
76
- | [Qwen-VL](https://github.com/QwenLM/Qwen-VL) | [Qwen-VL-Chat](https://huggingface.co/Qwen/Qwen-VL-Chat) |
77
- | [BLIP-2](https://github.com/salesforce/LAVIS/tree/main/projects/blip2) | [BLIP-2-FLAN-T5-XL](https://huggingface.co/Salesforce/blip2-flan-t5-xl) |
78
- | [EVA-CLIP](https://github.com/baaivision/EVA/tree/master/EVA-CLIP) | [EVA02_CLIP_L_psz14_s4B](https://huggingface.co/QuanSun/EVA-CLIP/blob/main/EVA02_CLIP_L_psz14_s4B.pt) |
79
- | [BEiT3](https://github.com/microsoft/unilm/blob/master/beit3/README.md) | [BEiT3-large-itc](https://github.com/addf400/files/releases/download/beit3/beit3_large_itc_patch16_224.pth) |
80
- | [CoCa](https://github.com/mlfoundations/open_clip#fine-tuning-coca) | [CoCa-L](https://github.com/mlfoundations/open_clip#fine-tuning-coca) |
81
- | [DINOv2](https://github.com/facebookresearch/dinov2) | [DINOv2-L](https://dl.fbaipublicfiles.com/dinov2/dinov2_vitl14/dinov2_vitl14_pretrain.pth) |
82
 
83
- ## 3. Inference
84
 
85
- ### 🧑 Human-oriented Evaluation
86
 
87
- To use your own model and produce final answers, first modify the model-loading code in `human_evaluation_demo.py` to adapt it to your model. Here is an example of loading the **InternVL** model:
 
 
 
 
 
 
 
 
 
 
88
 
89
- ```python
90
- # Load InternVL model, tokenizer, and image processor
91
- from transformers import AutoModel, AutoTokenizer, CLIPImageProcessor
92
- model = AutoModel.from_pretrained(
93
- args.model_path,
94
- torch_dtype=torch.bfloat16,
95
- low_cpu_mem_usage=True,
96
- use_flash_attn=True,
97
- trust_remote_code=True).eval().cuda()
98
- tokenizer = AutoTokenizer.from_pretrained(args.model_path, trust_remote_code=True, use_fast=False)
99
- image_processor = CLIPImageProcessor.from_pretrained(args.model_path)
100
- ```
101
-
102
- The model then answers the questions through its inference code, e.g.:
103
 
104
- ```python
105
- # Load images
106
- image = Image.open(image_path).resize((448, 448))
107
- pixel_values = image_processor(images=image, return_tensors='pt').pixel_values.to(torch.bfloat16).cuda()
108
- # Generate response
109
- generation_config = dict(max_new_tokens=1024, do_sample=True)
110
- response = model.chat(tokenizer, pixel_values, prompt_text, generation_config)
111
- ```
112
 
113
- After modifying the loading code, configure **`model-path`** (checkpoint), **`question-file`**, **`image-folder`** (path to the dataset), and **`answers-file`** (output path) in `run_human_demo.sh`, then run:
 
 
 
 
114
 
115
- ```bash
116
- bash run_human_demo.sh
117
- # The code splits the question file by the number of GPUs and runs inference concurrently.
118
- ```
119
 
120
- The outputs are merged into a single file in the following format:
 
 
 
121
 
122
- ```json
123
- {"question_id": 1, "image": "images/001.Black_footed_Albatross/Black_Footed_Albatross_0078_796126.jpg", "prompt": "Is the genus of the object geococcyx? Answer with yes or no.", "text": "No", "class": "no", "category": "generic"}
124
- {"question_id": 2, "image": "images/001.Black_footed_Albatross/Black_Footed_Albatross_0003_796136.jpg", "prompt": "Is the genus of the object raven? Answer with yes or no.", "text": "No", "class": "no", "category": "generic"}
125
- ```
126
 
127
- Finally, compute accuracy with `answer_acc.py`:
128
 
129
- ```bash
130
- python answer_acc.py
131
- ```
132
 
133
- > See the [example output](https://github.com/MrPetrichor/FG-BMK/blob/main/demo/human_evaluation/example_output.jsonl) for a detailed prediction-file format. We also provide reference inference code for **Qwen-VL** and **BLIP-2**.
 
 
 
134
 
135
- ### 🤖 Machine-oriented Evaluation
136
-
137
- To evaluate an LVLM's feature-representation ability, first modify the feature-extraction code in `models.py`. Here is an example of **CoCa** feature extraction:
138
-
139
- ```python
140
- def coca(model_name, pretrained, cache_dir):
141
- from open_clip import create_model_and_transforms
142
-
143
- def _hook(self, _, input, output):
144
- self.feat.append(output.transpose(0, 1))
145
-
146
- def get_intermediate_layers(self, x, n=1, return_class_token=True):
147
- self.feat = []
148
- self(x)
149
- class_tokens = [out[:, 0] for out in self.feat]
150
- outputs = [out[:, 1:] for out in self.feat]
151
- return tuple(zip(outputs, class_tokens))
152
-
153
- model, _, preprocess = create_model_and_transforms(model_name, pretrained, cache_dir=cache_dir)
154
- model = model.visual
155
- model.eval()
156
- model.cuda()
157
- model.__class__._hook = _hook
158
- model.__class__.get_intermediate_layers = get_intermediate_layers
159
- model.transformer.resblocks[-2].register_forward_hook(model._hook)
160
- model.transformer.resblocks[-1].register_forward_hook(model._hook)
161
- return model
162
- ```
163
-
164
- In this module we use **`_hook`** and the defined **`get_intermediate_layers`** method to extract visual features from the last two layers of the vision encoder. We then concatenate the **cls token** and **image tokens** in the predefined order and return an instance of the **CoCa model**. Examples of visual feature extraction using **EVA-CLIP** and **Qwen-VL** are already provided in `model.py`.
165
-
166
- Once modified, import the model in `eval_linear.py` or `eval_retrieval.py`:
167
-
168
- ```python
169
- from dinov2.utils.config import setup
170
- from models import coca
171
- torch.backends.cudnn.benchmark = True
172
- model = coca('coca_ViT-L-14', 'laion2b_s13b_b90k', '.cache')
173
- config = setup(args)
174
- autocast_dtype = torch.float16
175
- ```
176
-
177
- Then run the demo:
178
-
179
- ```bash
180
- python eval_linear.py
181
- # or
182
- python eval_retrieval.py
183
- ```
184
-
185
- The output log will look like:
186
-
187
- ```
188
- I20240504 13:34:23 16157 dinov2 helpers.py:103] Training [ 0/10000] eta: 8:13:21 loss: 143.1147 (143.1147) lr: 0.0005 (0.0005) time: 2.960182 data: 2.449736 max mem: 2711
189
- ...
190
- ```
191
-
192
- After the training process completes, the code automatically runs inference on the test set of the fine-grained dataset and reports the results.
193
-
194
- ---
195
-
196
- ## 📌 Citation
197
-
198
- If you find FG-BMK useful for your research, please consider citing:
199
 
200
  ```bibtex
201
  @article{yu2026fgbmk,
@@ -206,6 +81,6 @@ If you find FG-BMK useful for your research, please consider citing:
206
  }
207
  ```
208
 
209
- <div align="center">
210
- <sub>For questions or issues, please open a <a href="https://github.com/SEU-VIPGroup/FG-BMK/issues">GitHub issue</a>.</sub>
211
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ pretty_name: FG-BMK
3
+ license: other
4
+ language:
5
+ - en
6
+ task_categories:
7
+ - image-classification
8
+ - image-retrieval
9
+ - visual-question-answering
10
+ tags:
11
+ - fine-grained-recognition
12
+ - large-vision-language-models
13
+ - benchmark
14
+ - image-retrieval
15
+ - visual-question-answering
16
+ size_categories:
17
+ - 100K<n<1M
 
 
 
 
 
 
 
 
18
  ---
19
 
20
+ # FG-BMK
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
+ FG-BMK is a fine-grained evaluation benchmark for large vision-language models and vision-language models. It contains benchmark metadata, generated questions, train/test splits, class lists, and evaluation code for studying fine-grained visual understanding from both semantic and feature-representation perspectives.
23
 
24
+ The benchmark covers 1.01 million questions over 0.28 million images. It evaluates two complementary settings:
25
 
26
+ - Human-oriented evaluation: dialogue-style fine-grained visual questions, including hierarchical category recognition, attribute recognition, and knowledge-bias estimation.
27
+ - Machine-oriented evaluation: fine-grained recognition and image retrieval using predefined train/test splits and class files.
 
 
 
 
 
 
 
 
28
 
29
+ This repository contains the benchmark files and evaluation code. Image archives are hosted separately as companion Hugging Face dataset repositories.
30
 
31
+ ## Companion Image Repositories
32
 
33
+ | Dataset subset | Repository | Archive |
34
+ |---|---|---|
35
+ | FGVC-Aircraft | [SEU-VIPGroup/FG-BMK-image-Aircraft](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-Aircraft) | `aircraft.zip` |
36
+ | CUB-200-2011 | [SEU-VIPGroup/FG-BMK-image-CUB](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-CUB) | `CUB.zip` |
37
+ | DeepFashion | [SEU-VIPGroup/FG-BMK-image-DeepFashion](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-DeepFashion) | `deepfashion.tar` |
38
+ | Oxford 102 Flowers | [SEU-VIPGroup/FG-BMK-image-Flowers102](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-Flowers102) | `flowers102.tar` |
39
+ | Food-101 | [SEU-VIPGroup/FG-BMK-image-Food101](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-Food101) | `food101.tar` |
40
+ | iNat2021 validation images | [SEU-VIPGroup/FG-BMK-image-Val](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-Val) | `val.tar.gz` |
41
+ | SkinCon | [SEU-VIPGroup/FG-BMK-image-SkinCon](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-SkinCon) | `skincon.tar` |
42
+ | Stanford Dogs | [SEU-VIPGroup/FG-BMK-image-Dog](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-Dog) | `dog.zip` |
43
+ | VegFru | [SEU-VIPGroup/FG-BMK-image-VegFru](https://huggingface.co/datasets/SEU-VIPGroup/FG-BMK-image-VegFru) | `vegfru.zip` |
44
 
45
+ Other subsets referenced by the benchmark should be obtained from their original dataset sources when they are not mirrored in the companion repositories.
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
+ ## Repository Contents
 
 
 
 
 
 
 
48
 
49
+ - `benchmark/human-oriented/`: question files for human-oriented LVLM evaluation.
50
+ - `benchmark/machine-oriented/`: class lists and train/test splits for recognition and retrieval evaluation.
51
+ - `demo/human_evaluation/`: example inference and answer-scoring code.
52
+ - `demo/machine_evaluation/`: example feature extraction, linear evaluation, and retrieval evaluation code.
53
+ - `static/` and project assets: figures and supporting files for the benchmark release.
54
 
55
+ ## Basic Use
 
 
 
56
 
57
+ 1. Download this repository.
58
+ 2. Download the needed image archive from the companion repository above.
59
+ 3. Extract the archive locally.
60
+ 4. Point the evaluation scripts to the extracted image folder and to the corresponding FG-BMK question or split file.
61
 
62
+ For human-oriented evaluation, use files under `benchmark/human-oriented/` and run the demo code in `demo/human_evaluation/`.
 
 
 
63
 
64
+ For machine-oriented evaluation, use files under `benchmark/machine-oriented/<dataset>/` and run the demo code in `demo/machine_evaluation/`.
65
 
66
+ ## Paper and Code
 
 
67
 
68
+ - Project page: https://fg-bmk.github.io/
69
+ - Code repository: https://github.com/SEU-VIPGroup/FG-BMK
70
+ - arXiv extended version: https://arxiv.org/abs/2606.19053
71
+ - arXiv ICLR version: https://arxiv.org/abs/2504.14988
72
 
73
+ ## Citation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  ```bibtex
76
  @article{yu2026fgbmk,
 
81
  }
82
  ```
83
 
84
+ ## License and Data Terms
85
+
86
+ The benchmark metadata and evaluation code follow the terms provided by the project authors. Image archives are derived from their corresponding source datasets; users must also follow the license and usage terms of each original dataset.