Weld-Bench / README.md
jujeongho's picture
Card: benchmark and evaluation protocol only
8f4e3b2 verified
|
Raw History Blame Contribute Delete
12 kB
---
license: other
task_categories:
- visual-question-answering
- object-detection
- image-segmentation
language:
- en
tags:
- welding
- industrial-inspection
- benchmark
configs:
- config_name: RIAWELC
data_files:
- split: test
path: RIAWELC/test-*
- config_name: LoHi-WELD-hweld
data_files:
- split: test
path: LoHi-WELD-hweld/test-*
- config_name: RefWeld
data_files:
- split: test
path: RefWeld/test-*
- config_name: Khvatskii
data_files:
- split: test
path: Khvatskii/test-*
---
# Weld-Bench
Evaluation benchmark for vision-language models (VLMs) on welding imagery: four test sets in one repository. **Use it for evaluation only; do not train on any of it.**
Every subset follows the prompt of a public evaluation benchmark:
* multiple choice follows the official **MMMU** format (the default multiple-choice instruction of lmms-eval);
* grounding and segmentation follow the **HumanRef** task of lmms-eval: every class is asked for every image, an answer may hold zero, one or several objects, and the scoring is HumanRef's DensityF1 and rejection accuracy.
| Subset | Task | Rows | Image modality | Metric |
|---|---|---|---|---|
| `RIAWELC` | 4-way defect classification | 2,443 | X-ray radiograph patches, 227×227 grayscale | accuracy |
| `LoHi-WELD-hweld` | defect grounding, one row per (image, class) | 820 (205 images × 4 classes) | robotic MAG weld-bead crops (high-resolution subset), RGB | DensityF1@0.5:0.95 · rejection accuracy |
| `RefWeld` | component grounding (box) and segmentation (polygon), one row per (image, class, task) | 1,188 (85 images × 7 classes × box/poly, see below) | screenshots of welding videos | DensityF1@0.5:0.95 · rejection accuracy, per task |
| `Khvatskii` | weld acceptability judgement per use context | 459 (153 images × 3 contexts) | field / web photos of welds | precision · recall · F1 |
All setting: **zero-shot**. Prompts name the classes but give **no class definitions**.
## Access and loading
The repository is public but gated (manual approval). After approval:
```python
from datasets import load_dataset
riawelc = load_dataset("jujeongho/Weld-Bench", "RIAWELC", split="test")
lohi = load_dataset("jujeongho/Weld-Bench", "LoHi-WELD-hweld", split="test")
refweld = load_dataset("jujeongho/Weld-Bench", "RefWeld", split="test")
khv = load_dataset("jujeongho/Weld-Bench", "Khvatskii", split="test")
```
Schema. `RIAWELC`, `LoHi-WELD-hweld` and `RefWeld` have `sample_id`, `image` (PIL image, original pixels, never resized), `question` and `answer` (strings). `Khvatskii` has `sample_id`, `image`, `system`, `question1`, `question2`, `answer` and `narrative` (the expert's rationale; not scored).
## Common protocol
* **Prompt**: one user turn with the image followed by the `question` string, verbatim. No system prompt, no few-shot examples, no extra format hints.
* **Image**: send the `image` column as is. If an engine must downscale, cap the longer side at 1536 px (only Khvatskii images exceed it) and use the same cap for every model.
* **Decoding**: greedy (temperature 0) unless the subset says otherwise; reasoning / "thinking" modes **off** for every model; `max_tokens` ≥ 2048. If a model still emits a reasoning block, only the text after the last `</think>` is scored.
* **Coordinates in the answers**: integers in a 0–999 frame normalized to the image (`x` = column / width × 1000, `y` = row / height × 1000; `x1, y1` = top-left, `x2, y2` = bottom-right). The prompts do not state a frame (as in HumanRef); see the coordinate rule in the grounding section.
* **Report** the model size, decoding settings and the number of truncated replies (`finish_reason == "length"`) next to every score.
## RIAWELC — radiograph defect classification
Source: Totino, Spagnolo, Perri, *RIAWELC: A Novel Dataset of Radiographic Images for Automatic Weld Defects Classification* (ICMECE 2022) and Perri et al., *Welding Defects Classification Through a Convolutional Neural Network* (Manufacturing Letters 2023); data from github.com/stefyste/RIAWELC ("released freely"; cite both papers). We use the authors' official `testing` folder (2,443 patches) unchanged.
* **Rows**: classes crack 765, porosity 632, lack of penetration 446, no defect 600. Option order is shuffled per row; answers are balanced across letters.
* **Question** (MMMU format):
```
This is a patch cropped from an industrial weld radiograph (X-ray). Classify it.
Options:
(A) lack of penetration
(B) no defect
(C) crack
(D) porosity
Answer with the option's letter from the given choices directly.
```
* **Answer**: the letter only, e.g. `C`.
* **Scoring**: the prediction is the first `(X)` in the reply; else a leading bare letter (`C`, `C.`, `**C**`); else the single option name mentioned in the reply (two or more names = no prediction). **Metric = accuracy over 2,443 rows.** Chance is 25%.
## Grounding and segmentation: LoHi-WELD-hweld and RefWeld
Both subsets use the prompt and the metric of the **HumanRef** task in lmms-eval (`lmms_eval/tasks/humanref/utils.py`, a port of IDEA-Research/HumanRef `metric/recall_precision_densityf1.py`). Every class of the subset is asked for every image, so some rows have no target.
* **Question**:
* box rows: `Locate <class>, output its bbox coordinates using JSON format.`
* polygon rows (RefWeld only): `Locate <class>, output its polygon coordinates using JSON format.`
* **Answer**: a JSON list with one entry per object of that class, `[{"bbox_2d": [x1, y1, x2, y2], "label": "<class>"}, ...]` or `[{"polygon_2d": [[x1, y1], ..., [x8, y8]], "label": "<class>"}, ...]`, and `[]` when the class is not in the image. Boxes are listed by the x + y of their top-left corners, smallest first; polygons have 8 points in clockwise order starting from the vertex with the smallest x + y. Order does not affect the score.
* **Parsing** (as HumanRef): take the text after the last `</think>`; an empty reply, `[]`, `{}`, `null` or `none` means no prediction. Otherwise parse JSON (first fenced block, the whole reply, or the outermost `[...]` / `{...}`) and collect every box under the keys `bbox_2d`, `bbox`, `box`, `coordinates`, `bounding_box` or any bare 4-number list; if none is found, collect every bracketed 4-number tuple with a regex. Boxes with `x2 <= x1` or `y2 <= y1` are dropped. Polygons are read from `polygon_2d`, `polygon`, `points` or any bare list of ≥ 3 `[x, y]` points. The `label` field is not used: the class is the one in the question.
* **Coordinate rule** (as HumanRef): the whole reply is read in each of four conventions — absolute pixels, a 0–1000 grid, 0–1 (only if every value is ≤ 1) and Qwen2.5-VL resized pixels (`smart_resize`, factor 28) — and the reading with the best DensityF1@0.5:0.95 is kept, so models are not penalised for their native format. The answer is mapped to pixels with `v / 1000 × size`.
* **Scoring, rows with a target**: for each IoU threshold t ∈ {0.50, 0.55, …, 0.95}, every ground-truth object takes the unused prediction with the highest IoU ≥ t (greedy one-to-one matching); recall = matches / #GT, precision = matches / #predictions, and **DensityF1 = F1 × min(1, #GT / #predictions)**, which penalises predicting more objects than there are. The row's score is the mean over the 10 thresholds. **DensityF1@0.5:0.95** is the mean over all rows with a target. Box rows use box IoU in pixels; polygon rows use **mask IoU**: both polygons are rasterized as binary masks at the image size (pixels inside = 1), IoU = intersection pixels / union pixels.
* **Scoring, rows without a target**: the row is correct if the reply contains no prediction. **Rejection accuracy** is the share of correct rows among rows without a target.
* **Report** DensityF1@0.5:0.95 and rejection accuracy for each subset (and for RefWeld box and polygon separately).
### LoHi-WELD-hweld — weld-bead defect grounding
Source: Block, da Silva, Lazzaretti, Minetto, *LoHi-WELD: A Novel Industrial Dataset for Weld Defect Detection and Classification, a Deep Learning Study, and Future Perspectives* (IEEE Access 2024); data from github.com/SylvioBlock/LoHi-Weld (free for research and commercial use with citation). Rows are the authors' official hold-out test crops of the **high-resolution subset (hweld)**; the low-resolution subset is excluded because its ~10 px boxes are beyond the localization precision of current VLMs.
* **Rows**: 205 crops (~785×195 px) × 4 classes = 820 rows; `sample_id` = `lohi_high_<crop>_<class>`. 609 rows have a target (1,928 boxes: pore 86, deposit 390, discontinuity 596, stain 856), 211 rows have none.
* **Classes**: pore, deposit, discontinuity, stain. For readers only (not shown to the model): pore = small fill gap from an air bubble; deposit = excess welding material along the bead; discontinuity = partial absence of weld material along the bead; stain = slight alteration of the weld surface.
* **Answer coordinates**: from the authors' YOLO labels, `round(v × 1000)` clipped to 0–999.
### RefWeld — welding-component grounding and segmentation
Own data. 85 screenshots of publicly available welding videos (torch-side camera views), annotated with polygons by four people in CVAT, reviewed and corrected by one reviewer, near-duplicate frames removed. Every class has at most one instance per image.
* **Classes**: wire, nozzle, pool, bead, arc, groove, seam. For readers only: wire = filler wire protruding from the nozzle; nozzle = gas nozzle / contact tip; pool = molten pool under the arc; bead = solidified weld metal; seam = joint line before welding; groove = joint gap; arc = electric discharge at the wire tip.
* **Rows**: `sample_id` = `refweld_img<001–085>_<class>_<box|poly>`.
* box: 595 = 85 × 7 (396 with a target, 199 without);
* poly: 593 (394 with a target, 199 without) — two pool instances whose 8-point polygon self-intersected have no polygon answer, so their poly rows are left out.
* **Polygon answers**: the annotated polygon canonicalized to 8 points (Visvalingam–Whyatt removal when there are more vertices, longest-edge midpoint insertion when fewer), clockwise on screen, starting at the vertex with the smallest x + y. The model may output any number of points.
## Khvatskii — weld acceptability per use context
Follows the paper's own protocol.
Source: Khvatskii, Lee, Angst, Gibbs, Landers, Chawla, *Do Multimodal Large Language Models Understand Welding?* (Information Fusion 120, 2025; arXiv 2503.16537); data and prompts from github.com/x0wllaar/Do-LLMs-Understand-Welding.
* **Rows**: 459 = 153 images × 3 use contexts (`RV & Marine`, `Aeronautical`, `Farming`). `sample_id` = `khv_<real|online>_<guid8>_<rvmarine|aeronautical|farming>`; `real` = 95 photos taken by welding instructors, `online` = 58 web photos.
* **Conversation (per row, independent)**: `system` → `user` [image + `question1`] → model turn 1 (≤ 5 sentences of plain text) → `user` [`question2`] → model turn 2 (a JSON object `{"acceptable": true|false}`).
* **Sampling**: run each row **3 times** with seeds 0, 1, 2 at temperature 0.7, top_p 0.8; the row's prediction is the **majority vote** of the three turn-2 answers. Turn 2 is parsed with `"acceptable"\s*:\s*(true|false)`, falling back to a bare `true` / `false`; an unparsable turn 2 counts as `false`.
* **Answer**: `{"acceptable": true}` or `{"acceptable": false}`.
* **Scoring**: positive class = acceptable. Report precision, recall and F1 for each context × source cell and the **micro F1 over all contexts for `real` (285 judgements) and `online` (174)**, which are the headline numbers.
* **Reference (same protocol, from the paper)**: micro F1 real / online — GPT-4o 0.536 / 0.675, LLaVA-1.6-Mistral-7B 0.210 / 0.481.
## Citation
Please cite the source datasets (RIAWELC [both papers], LoHi-WELD, Khvatskii et al.) and, for the prompt and metric, MMMU (Yue et al., CVPR 2024), HumanRef / RexSeek (Jiang et al., 2025) and lmms-eval.