/SketchGraphs

A dataset of 15 million CAD sketches with geometric constraint graphs.

Primary LanguagePythonMIT LicenseMIT

SketchGraphs: A Large-Scale Dataset for Modeling Relational Geometry in Computer-Aided Design

SketchGraphs is a dataset of 15 million sketches extracted from real-world CAD models intended to facilitate research in both ML-aided design and geometric program induction.

blah

Each sketch is represented as a geometric constraint graph where edges denote designer-imposed geometric relationships between primitives, the nodes of the graph.

Sketch and graph

Video: https://youtu.be/ki784S3wjqw
Paper: https://arxiv.org/abs/2007.08506

See demo notebook for a quick overview of the data representions in SketchGraphs as well as an example of solving constraints via Onshape's API.

Installation

SketchGraphs can be installed using pip:

>> pip install -e SketchGraphs 

This will provide you with the necessary dependencies to load and explore the data. However, to train the models, you will need to additionally install pytorch and torch-scatter.

Data

We provide our dataset in a number of forms, some of which may be more appropriate for your desired usage. The following data files are provided:

  • The raw json data as obtained from Onshape. This is provided as a set of 128 tar archives which are compressed using zstandard. They total about 43GB of data. In general, we only recommend these for advanced usage, as they are heavy and require extensive processing to manipulate. Users interested in working with the raw data may wish to inspect sketchgraphs.pipeline.make_sketch_dataset and sketchgraphs.pipeline.make_sequence_dataset to view our data processing scripts. The data is available for download here.

  • A dataset of construction sequences. This is provided as a single file, stored in a custom binary format. This format is much more concise (as it eliminates many of the unique identifiers used in the raw JSON format), and is better suited for ML applications. It is supported by our Python libraries and forms the baseline on which our models are trained. The data is available for download here (warning: 15GB file!).

  • A filtered dataset of construction sequences. This is provided as a single file, similarly stored in a custom binary format. This dataset is similar to the sequence dataset, but simplified by filtering out sketches that are too large or too small, and only includes a simplified set of entities and constraints (while still capturing a large portion of the data). Additionally, this dataset has been split into training, testing and validation splits for convenience. We train our models on this subset of the data. You can download the splits here: train validation test

For full documentation of the processing pipeline, see https://princetonlips.github.io/SketchGraphs.

The original creators of the CAD sketches hold the copyright. See Onshape Terms of Use 1.g.ii for additional licensing details.

Models

In addition to the dataset, we also provide some baseline model implementations to tackle the tasks of generative modeling and autoconstrain. These models are based on Graph Neural Network approaches and model the sketch as a graph where vertices are given by the entities in the sketch, and edges by the constraints between those entities. For more details, please refer to https://princetonlips.github.io/SketchGraphs/models.

Citation

If you use this dataset in your research, please cite:

@inproceedings{SketchGraphs,
  title={Sketch{G}raphs: A Large-Scale Dataset for Modeling Relational Geometry in Computer-Aided Design},
  author={Seff, Ari and Ovadia, Yaniv and Zhou, Wenda and Adams, Ryan P.},
  booktitle={ICML 2020 Workshop on Object-Oriented Learning},
  year={2020}
}