193-counting / README.md
weipang142857's picture
card: document metadata.geometry (auto-generated numbers)
13c89b3 verified
|
Raw
History Blame Contribute Delete
11.6 kB
---
tags:
- smart-manufacturing
- sft
- industrial
- vision
license: other
pretty_name: 193-counting
extra_gated_fields:
Name: text
Affiliation: text
Intended use: text
extra_gated_prompt: >-
This dataset is released for **research use**. Access is reviewed and granted
**manually** by the maintainers. Please state your name, affiliation, and intended use.
dataset_info:
features:
- name: query
dtype: string
- name: image
dtype: image
- name: annot
dtype: string
- name: reasoning
dtype: 'null'
- name: cate
dtype: string
- name: task
dtype: string
- name: metadata
dtype: string
splits:
- name: train
num_examples: 10870
---
# 193-counting
Counting of **separated surface-defect regions** on Severstal cold-rolled steel-strip imagery —
**10,870 records** (all `train`), derived **deterministically** (no LLM/teacher) from the base
[`AI4Manufacturing/193`](https://huggingface.co/datasets/AI4Manufacturing/193) masks. `annot` is a
single integer as a string (`"0"` on goods). Anonymous class (defect-agnostic), matching the
[`193-grounding`](https://huggingface.co/datasets/AI4Manufacturing/193-grounding) sibling.
## Task — an HONEST referent
**Count the separated defect regions** on the strip — the number of `>=12px`-separated
transitive-merge components, **NOT** a physical defect count. A single fragmented extended defect counts
as its **separated regions**; the query asks *"how many separated regions of surface defect are present"*
throughout (never "distinct defects"). Composition:
- **4,968** anomalous images (merge-stable + fully legible; see pool below).
- **5,902** good images shipped as **count `0`** — the goods carve-out.
- **Answer prior (with goods): 54.3%** are count-**0** (5,902 of 10,870).
- Among the anomalous-only pool the counts are diverse: **majority-1 is 46.6%** (< 60%),
mean **2.0087**, max **11**, 11 distinct values.
## Schema (7 columns, answer-only)
| field | type | meaning |
|---|---|---|
| `query` | str | student question — domain-conditioned; **34** pooled variants; ends with the verbatim directive `Answer with a single integer.` |
| `image` | Image | the raw steel-strip surface photo (bytes; never cropped) |
| `annot` | str | machine-parseable **gold**: a single integer (`"0"` on goods) |
| `reasoning` | null | none — deterministic derivation, answer-only |
| `cate` / `task` | str | `B` / `T-B1` (inherited from parent 193) |
| `metadata` | str (JSON) | `image_sha256`, `negative`, `count` (== `annot`), `separation_threshold_px`, `referent`, `sensitivity_note`, `pool`, `derivation`, `anonymous_class`, `disclosures`, family + gate provenance |
## Roles (regime 3)
**Roles:** this is an **answer-only** tier — there is no reasoning content (`reasoning` is `null` on every
record). `annot` is both the machine-parseable **gold** AND the **direct-answer SFT target** in the exact
format the `query` specifies (regime 3: the final format the query requests == the `annot` format); it is
also the exact-match / IoU **reward key** for RLVR.
## Pool — deliberately stricter than grounding
The count is a **pure function of the separation threshold**, so the pool ships only images whose count is
**stable across the 8-12-20px band** AND whose **every canonical component is legible at the 1568 long-side
render** — a deliberately stricter margin than grounding's per-box floor, because **one illegible component
flips the count**. Floor: 16px short side @ native/2.36MP (scale 1.0); counting all-components-legible margin @1568 long-side. Goods contribute count `0` under the absence carve-out.
## Count-vs-threshold sensitivity (frozen battery)
The count depends on the `>=12px` separation definition. The shipped golds use **12px**; the frozen
pre-build battery reports the full anomalous-image count distribution at four thresholds:
| separation threshold | majority-1 share | share >=2 | mean | max | distinct counts |
|---|---|---|---|---|---|
| **8px** | 37.1% | 62.9% | 2.5596 | 16 | 16 |
| **12px** (shipped) | 38.0% | 62.0% | 2.4709 | 15 | 15 |
| **20px** | 39.8% | 60.2% | 2.3249 | 14 | 14 |
| **30px** | 42.4% | 57.6% | 2.1812 | 12 | 12 |
## Anonymous, area-metric-free
No defect *type* token and **no area-fraction / percentage** appears in any field (build-gate asserts 0
leaks) — the referent is purely the count of separated regions.
## Anonymous defect classes
Severstal's four surface-defect classes are **anonymous**: the maker never released what they
physically mean (the labels are only the numeric ids 1-4; typology not given — see Carvalho et al.,
[arXiv:2305.13261](https://arxiv.org/abs/2305.13261)). With no released semantics, this rung is
**defect-agnostic** — no defect *type* token appears anywhere in `query` or `annot` (matching the
sibling [`181-grounding`](https://huggingface.co/datasets/AI4Manufacturing/181-grounding), also an
anonymous-class, box-only rung with no `type` field). The build-gate asserts **0** query/annot cells
carry a phenomenon-noun/type token. (The "pitted / crazing / scratches / patches" names that
circulate online are **NEU-DET's** and are mis-attributed to Severstal; they are not used here.)
## Query design (build-gate 9)
The `query` is drawn from a fixed **34-variant** domain-conditioned pool (selected by an
independent salted per-image hash). Each variant names the domain (cold-rolled steel-strip surface
inspection) and defers to *"this line's / this setting's defect standard"* **without enumerating which
phenomena count as defects** — the model learns the good/anomalous boundary from the data, not the
prompt. The pool reuses the parent `query_pool._FORBIDDEN` guard: a machine gate confirms **0** variants
leak a phenomenon noun and every variant ends with the verbatim answer-format directive
`Answer with a single integer.`
## Provenance / reproduction
Derived **read-only** from the class-indexed segmentation masks of base
[`AI4Manufacturing/193`](https://huggingface.co/datasets/AI4Manufacturing/193) (Severstal Steel Defect
Detection, Kaggle 2019). Answers are a **pure function of the mask****$0 teacher, no LLM anywhere** in
this rung: each box list / count is recomputed by a **transitive union-find merge @12px** of the mask's
connected components to a growing-extent fixpoint. Built by
[`forge_model`](https://github.com/AI4Manufacturing/forge_model) `annotate/193/rungs/`
(`build_rungs.py`, `query_pool_rungs.py`, `prebuild_gates_v2.py`; cards by `gen_cards.py`, all numbers
read from frozen reports). Every choice is salted-hash seeded; a rerun reproduces the artifact exactly.
- **Derivation script** `build_rungs.py` sha256 `bf42ab24790ce37bc2d791023880c853a1b23bcbbb343a8c94d825797f76185e`.
- **11 deterministic checks (re-derived from the written parquet's mask)** re-derived every gold from the *written* parquet's mask: grounding boxes —
**0 mismatches vs mask re-derivation; 15646 boxes total**; counting FINAL count — **0 mismatches vs mask re-derivation (FINAL == component count)**.
- Boxes are canonical **native-px COCO xywh**. Convert to your model's grounding convention at train
time — regenerate, don't regex; see `common/box_convert.py` in forge_model.
Upstream license **other** — respect the upstream terms. Public, **manual access review**
(`gated=manual`).
## Split & family carve manifest
**Train-only** — every record is `split=train` (no val split; uniform-split policy). Eval carving is
fully **downstream**, keyed on `metadata.image_sha256` across the whole **193 family** (parent 193 +
grounding + counting share images), so a machine-checkable carve manifest is shipped alongside the
build (`outputs/193/rungs/family_carve_manifest.json`, keyed on `image_sha256`):
| member | records |
|---|---|
| parent `193` | 12,568 |
| `193-grounding` | 12,420 |
| `193-counting` | 10,870 |
| in **both** rungs | 10,870 |
Family size (distinct images) = **12,568**. The two rungs pose **different questions**
(boxes vs count) over **overlapping images** — same evidence: carve them **jointly** on `image_sha256`,
and never place the same image on both sides of a train/eval split.
## Overlap / de-duplication (§8)
Inherits base `193`'s image relationships (Kaggle **test** GT withheld and the mirror's derived YOLO
labels are excluded upstream). Every record carries `metadata.image_sha256`; the grounding and counting
rungs share images with each other and the parent — reconstruct any overlap and carve jointly via the
family manifest above.
## Companions
[`193`](https://huggingface.co/datasets/AI4Manufacturing/193) (base binary good/anomalous),
[`193-grounding`](https://huggingface.co/datasets/AI4Manufacturing/193-grounding) (defect-region boxes).
<!-- GEOMETRY-BLOCK:BEGIN -->
## Geometry (`metadata.geometry`)
Every record carries a **`geometry`** block inside the existing `metadata` JSON string, so that its
gold can be **re-derived at any render size**. No schema column changed; existing loaders are
unaffected.
Coordinates are **native pixels** of the image in that record. `scale` is `1.0` throughout — this
repo publishes at source resolution, nothing was downscaled at publish time.
```jsonc
"geometry": {
"image_wh": [W, H], // dims of the image in THIS record
"source_wh": [W, H], // dims of the original source image
"scale": 1.0, // image_wh / source_wh; < 1.0 would disclose a publish-time downscale
"n_instances": 2,
"instances": [
{ "instance_id": 1, "bbox_xywh": [x, y, w, h], "min_side_px": 65, "class": null }
],
"n_dropped_subminimum": 0, // components removed by the filters below
"union_box_fallback": false,// true => boxes are per-class unions, NOT real instances
"conventions": { ... } // see table
}
```
**`instances` is present even when empty.** `[]` means the record genuinely has no defects; an
*absent* block would mean geometry could not be recovered. Those are different states and are never
conflated.
### Conventions used to derive it
There is no universal definition of "one defect instance" — it depends on the mask the source
shipped. This repo's is stated, not implied:
| field | value |
|---|---|
| `algorithm` | `transitive_box_merge` |
| `binarisation` | `gt:0` |
| `connectivity` | `8` |
| `merge` | `box_transitive:12` |
| `min_area_px` | `0` |
| `max_instances` | `None` |
| `artifact` | `fine` |
| `fill_floor` | `None` |
| `legibility_floor_px` | `None` |
| `min_side_floor_px` | `None` |
| `spec_sha` | `4619037bbfa82f39` |
### Provenance and verification
| | |
|---|---|
| records | 10,870 |
| carrying a geometry block | **10,870 / 10,870** |
| instances per record | `0`: 5,902, `1`: 2,313, `2`: 1,400, `3`: 665, `4`: 302, `5+`: 288 |
| total instances | 9,979 |
| image dimensions | 1600×256 (10,870) |
| `scale` values present | [1.0] |
Derived from the [`AI4Manufacturing/193`](https://huggingface.co/datasets/AI4Manufacturing/193)
masks and **verified against this repo's own published answers before it was written** — a
recomputation that disagreed with the shipped gold would have aborted the update rather than
overwritten it.
### Using it
Coordinates only stay correct if they are rescaled with the image. A patch-based VLM does **not**
render at native size: Qwen2-VL's processor snaps both dimensions to a multiple of 28, so a
1600×256 strip is rendered 1596×252 and native-pixel boxes are then wrong by a few pixels.
`forge_model/193/adapt.py` regenerates coordinates for a target render size, re-derives counts, and
drops records whose gold no longer holds there.
<!-- GEOMETRY-BLOCK:END -->