Code Monkey home page Code Monkey logo

brep2seq's Introduction

Brep2Seq

This code for the paper: Brep2Seq: A Dataset and Hierarchical Deep Learning Network for Reconstruction and Generation of Computer-Aided Design Models

The hierarchical network architecture of Brep2Seq

About Brep2Seq

Brep2Seq, a deep neural network that directly takes the B-rep data of 3D CAD models as input, inspired by the Transformer network and its adaptation to graph-structured data, known as Graphformer. This network can encode the B-rep data into a latent space and decode a sequence of CAD feature modeling operations. The sequence comprises two types of modeling operations: one for assembling basic geometric primitives (e.g., cuboid, prism, cylinder, cone, and sphere) to form the primary shape of the CAD model, and another for common mechanical features (e.g., hole, groove, fillet, and chamfer).

Preparation

Environment setup

git clone https://github.com/zhangshuming0668/Brep2Seq.git
cd Brep2Seq
conda env create -f environment.yml
conda activate brep2seq

Data preparation

You can download the synthetic CAD models dataset from this link.

Training

To reconstruct B-rep models, the network can be trained using:

python reconstruction.py train --dataset_path /path/to/dataset --batch_size 64

The logs and checkpoints will be stored in a folder called results/BrepToSeq based on the experiment name and timestamp, and can be monitored with Tensorboard:

tensorboard --logdir results/<experiment_name>

Testing

The best checkpoints based on the smallest validation loss are saved in the results folder. The checkpoints can be used to test the model as follows:

python reconstruction.py test --dataset_path /path/to/dataset --checkpoint ./results/BrepToSeq/best.ckpt --batch_size 64

The predicted reconstruction sequences files are saved in the results folder results/predicted_seq.

Generation

For random generation, further train a latent GAN:

python generation.py train --dataset_path /path/to/dataset --pretrained ./results/best.ckpt --batch_size 64 

After training the latent GAN, run latent GAN to do random generation:

python generation.py generate --checkpoint ./results/best_gan.ckpt --n_samples 256 --batch_size 64 

The generated construction sequences files are saved in the results folder results/generated_seq.

brep2seq's People

Contributors

zhangshuming0668 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.