w_cad2 / README.md
weipang142857's picture
dataset card
732bfb0 verified
|
Raw
History Blame Contribute Delete
8.33 kB
---
dataset_info:
- config_name: recode
features:
- name: query
dtype: string
- name: image
dtype: image
- name: cadquery
dtype: string
- name: annot
dtype: string
- name: reasoning
dtype: string
- name: cate
dtype: string
- name: task
dtype: string
- name: metadata
dtype: string
splits:
- name: train
num_bytes: 44352340921
num_examples: 953081
download_size: 44303666055
dataset_size: 44352340921
- config_name: comprehension
features:
- name: query
dtype: string
- name: image
dtype: image
- name: cadquery
dtype: string
- name: annot
dtype: string
- name: reasoning
dtype: string
- name: cate
dtype: string
- name: task
dtype: string
- name: metadata
dtype: string
splits:
- name: train
num_bytes: 483614230
num_examples: 953081
download_size: 433648394
dataset_size: 483614230
configs:
- config_name: recode
data_files:
- split: train
path: recode/recode-*
- config_name: comprehension
data_files:
- split: train
path: comprehension/comprehension-*
license: cc-by-nc-4.0
pretty_name: CAD-Recode as VLM data - renders to CadQuery, and code comprehension
tags:
- smart-manufacturing
- cad
- cadquery
- code-generation
- multi-view
- brep
task_categories:
- image-to-text
- visual-question-answering
extra_gated_prompt: Released for research use; access is granted manually. Please state your name, affiliation,
and intended use.
extra_gated_fields:
Name: text
Affiliation: text
Intended use: text
---
# w_cad2 — CAD-Recode as VLM data
Two tracks derived from [`AI4Manufacturing/cad_recode`](https://huggingface.co/datasets/AI4Manufacturing/cad_recode)
(CAD-Recode v1.5: 982,847 CadQuery programs, from
[Rukhovich et al.](https://github.com/filaPro/cad-recode)).
| config | records | given | answer |
|---|---|---|---|
| `recode` | 953,081 | an **eight-view render** of a solid, and nothing else | the CadQuery program that builds it |
| `comprehension` | 953,081 | the **program as text**, no image | a property of the solid it builds |
```python
from datasets import load_dataset
r = load_dataset("AI4Manufacturing/w_cad2", "recode", split="train")
c = load_dataset("AI4Manufacturing/w_cad2", "comprehension", split="train")
```
## The source has no model input at all
This is the point of the release. CAD-Recode ships **programs and nothing else** — its own metadata
says `has_input: false`. There are no images and no stored point clouds, so the task it names,
recover the program, cannot actually be posed from what ships. Every program here was **executed**
and the resulting solid rendered; that is what makes the question answerable.
Two tracks, deliberately sharing no evidence: `recode` carries an image and a null `cadquery`
column (the program is the *answer* there), `comprehension` carries the program and no image. A
record that offered both would let a model read the answer instead of looking.
## ⚠️ Exact code match is not a valid score
The same shape has **many** valid programs. Scoring a prediction by string comparison against
`annot` will mark correct reconstructions wrong. Execute the prediction and compare **geometry**
(Chamfer distance / IoU). This warning is repeated in every record's `metadata.eval_note`.
## Every render is varied, per record, from a seed
Fixed camera angles, lighting and colour are a **format** a model can learn instead of the
geometry, and nothing learned that way transfers to a CAD screenshot taken elsewhere. So each
record's render varies: view direction by up to 12° about a random axis, camera roll up to 8°, key
light up to 18°, plus material grey, ambient level, framing slack and background.
**Never varied**, because they carry meaning rather than style: orthographic projection, the single
framing shared by all eight views of a solid, and the number of views.
The seed is derived from the program text, so **a rebuild is pixel-identical**, and the values
actually used are in `metadata.jitter_applied` — each record documents its own render. Measured
over 200,000 consecutive records: 200,000 distinct seeds.
Renders are produced by a deterministic software rasteriser (no GPU, no driver, no sampling), so
the same program gives the same pixels on any machine.
## Know what you are training on
The generator unions random primitives and nothing forces them to touch, so these are frequently
**not single connected parts**:
| bodies in one "solid" | share of the 953,081 shipped |
|---|---|
| 1 — a single connected part | **40.8%** |
| 2 | 39.8% |
| 3 | 15.3% |
| 4 or more | 4.1% |
Most remain legible — the median solid covers 22% of the frame — but **40,365 records (4.2%) are
flagged `likely_unreadable`** (footprint under 2% of frame, or more than three loose bodies). A
shape too small or scattered to see cannot determine a program; filter on the flag if that matters
to you.
## Deduplicated, and what is still flagged
**3.03% of the source's train programs are exact duplicates** — 29,766 extra copies, one program
repeated 60 times, which over-weights those samples in a generative task. This release ships the
**deduplicated set**: 952,099 distinct train programs + all 982 val = **953,081**. Every record has
`duplicate_rank == 0`; the field is kept so the filter is auditable.
Still flagged rather than removed:
| flag | meaning |
|---|---|
| `also_in_train` | **35 of the 982 val programs appear verbatim in train.** val is a same-distribution holdout from the same generator — a training monitor, never a benchmark — and this part of it is leaked. The source's own evaluation is done on external datasets (DeepCAD / Fusion360 / CC3D). |
| `likely_unreadable` | footprint < 2% of frame, or > 3 disconnected bodies |
| `footprint_mean` | share of the frame the solid covers, averaged over the eight views |
| `n_bodies`, `n_faces`, `bbox_dims` | measured from the executed solid |
## The `r` convention, if you execute predictions
The final solid must be bound to a variable named **`r`**. That is not our rule — every official
CAD-Recode consumer reads `globals()['r'].val()`, and their conversion code swallows failures with
a bare `except: pass`, so a program binding anything else does not error, it silently produces
nothing. Our executor surfaces it instead. The prompt states the requirement explicitly.
## Roles
**Roles:** `annot` is the **machine-parseable gold** and, for now, also the SFT target — the default
view is `query` (+ `image` for `recode`, + `cadquery` for `comprehension`) → `annot`. `reasoning` is
**null by design**: chain-of-thought is a separate annotation stage. In `recode` the answer is a
program, so it is a *generation* target scored geometrically (see above); in `comprehension` it is a
short value (a count or three integers) and is exactly checkable. When a CoT layer is added later it
becomes the imitation target and `annot` stays the gold — it is never overwritten.
## Fields
`query` (from 32 hand-written paraphrases per track; the source had one) · `image` (`recode` only,
2078×1042, eight 512 px panels) · `cadquery` (`comprehension` only — **null in `recode`**, where it
would be the answer) · `annot` · `reasoning` (null) · `cate` = `E` · `task` = `T-E1` · `metadata`.
**Splits.** Everything ships as one `train` split; the source's split is preserved in
`metadata.split_official` (952,099 train / 982 val). Both tracks derive from the same programs, so
**split by `metadata.model_id` across tracks** if you use both, or a program seen in one will leak
into the other's evaluation.
## Provenance
Built by `forge_model/CAD_RECODE/cadrecode_build.py --dedup` on the `forge_cad` toolkit
(`forge_agent/forge_cad`), verified by `verify_cadrecode_build.py`, published by
`publish_w_cad2.py`. **No model API was used** — the gold is the source's own program, and every
derived property is computed by executing it. Verification re-executes a sample of the gold and
recomputes the properties from the fresh solid: 236/236 executed, 236/236 properties matched.
Derived from CAD-Recode, **CC BY-NC 4.0** (non-commercial). Please cite the original:
> Rukhovich, D., Cherenkova, K., Kacem, A., Aouada, D. et al. *CAD-Recode: Reverse Engineering CAD
> Code from Point Clouds.*