TempFit / README.md
Daisy-1227's picture
Publish TempFit dataset ZIP and download instructions
d37caa9 verified
|
Raw History Blame Contribute Delete
5.1 kB
---
pretty_name: TempFit
license: cc-by-nc-4.0
extra_gated_heading: "Request access to TempFit"
extra_gated_description: "Complete the form to request access for non-commercial use."
extra_gated_button_content: "Submit request"
extra_gated_fields:
Full name: text
Affiliation: text
Intended use: text
"I agree to the dataset license and non-commercial use": checkbox
tags:
- cad
- vector-graphics
- industrial-layout
- template-fitting
size_categories:
- 1K<n<10K
---
# TempFit Dataset
TempFit contains industrial CAD scenes represented as line segments, with instance annotations for semantic class, primitive template, translation, rotation, scale, and reflection. It supports research on template-based CAD scene understanding and reconstruction.
[Code and installation](https://github.com/Daisy-1227/TempFit)
## Dataset contents
| Split | Scenes | Annotated instances | Line segments |
|---|---:|---:|---:|
| `train` | 2,112 | 27,774 | 69,612,738 |
| `test` | 494 | 5,884 | 13,523,488 |
The dataset includes 23 semantic classes, 76 primitive templates, and a training augmentation donor bank with 21,085 instances from 1,985 training scenes. The complete package occupies approximately 12.33 GB before compression.
Instance counts describe the stored annotations; evaluation applies the TempFit loader's range and validity filters.
## Directory structure
```text
data/industrycad/
├── template-v1/
│ ├── train/
│ │ ├── svg/ # Input line-segment JSON
│ │ └── gt/ # Instance annotations
│ ├── test/
│ │ ├── svg/
│ │ └── gt/
│ ├── primitive_mapping.json
│ ├── invalid_scene.txt
│ └── DATA_MANIFEST.json
└── resources/
├── templates/ # 0.json ... 75.json
├── model_mapping.json
├── donor/
└── invalid_train.txt
splits/
├── train.json # Training filenames
└── test.json # Test filenames
```
Scene filenames follow `PPPP-BBBB.json`: `PPPP` identifies the parent drawing and `BBBB` identifies its block. Input and GT files share the same basename.
## Data format
Each input JSON stores line endpoints, RGB colors, widths, layer indices, and source primitive groups. Each GT JSON is a list of instances with template and geometric attributes.
| Field | Meaning |
|---|---|
| Input `coords` | Line endpoints `[x1, y1, x2, y2]` in drawing coordinates |
| Input `primitive_ids` | Indices into source CAD primitive groups |
| Input `instance_ids` | Source-group instance references; `i` refers to `GT[i-1]` |
| Input `semantic_ids` | Source-group semantic class IDs, `0`–`22` |
| GT `semantic_id` | Semantic class ID, `0`–`22` |
| GT `template_id` | Template ID, `0`–`75` |
| GT `translation` | Translation in the centered scene frame |
| GT `rotate` | Rotation angle in degrees |
| GT `scale` | Template scale factors `[sx, sy]` |
| GT `flip` | Whether to mirror template x before scaling and rotation |
All input lines belong to annotated instances. Input and GT semantic class IDs both range from `0` to `22`. Input `primitive_ids` identify source geometry groups, while GT `template_id` identifies a template.
To obtain the semantic class for each line segment:
```python
line_semantic_ids = [scene["semantic_ids"][p] for p in scene["primitive_ids"]]
```
`line_semantic_ids[i]` is the class ID (`0`–`22`) of `coords[i]`.
See [SCHEMA.txt](SCHEMA.txt) for the complete format and coordinate transformation, and [LABELS.json](LABELS.json) for semantic-to-template IDs.
## Download
Request access on [Hugging Face](https://huggingface.co/datasets/Daisy-1227/TempFit). Once access is granted, download and extract the dataset:
```bash
pip install -U huggingface_hub
hf auth login
hf download Daisy-1227/TempFit TempFit.zip TempFit.zip.sha256 --repo-type dataset --local-dir downloads
(cd downloads && sha256sum -c TempFit.zip.sha256)
python -m zipfile -e downloads/TempFit.zip tempfit-data
python tempfit-data/verify_package.py
```
The archive contains the directory structure shown above.
## Usage
Place `data/` and `splits/` from `tempfit-data/` at the root of a [TempFit](https://github.com/Daisy-1227/TempFit) checkout. The training and inference configurations use the paths shown above.
To read a scene directly:
```python
import json
from pathlib import Path
root = Path("data/industrycad/template-v1")
test_names = json.loads(Path("splits/test.json").read_text())
name = test_names[0]
scene = json.loads((root / "test" / "svg" / name).read_text())
instances = json.loads((root / "test" / "gt" / name).read_text())
```
To verify the downloaded package:
```bash
python verify_package.py
```
## License and access
The dataset is licensed under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). You may share and adapt it for non-commercial purposes with attribution. See [LICENSE](LICENSE) for the full terms.
To download the dataset from Hugging Face, complete the access request form.