Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenCAD: Image-conditioned Computer-Aided Design Generation with Transformer-based Contrastive Representation and Diffusion Priors

Paper Website

GenCAD Demo


Dataset

The dataset for GenCAD can be downloaded from here and should be placed in the data directory.

Pretrained models

Pretrained models can be found here and should be placed in the data/ckpt directory.

Training the CSR model

Run the following command to train the CSR model from scratch. If you want to start with a checkpoint just add the -ckpt flag with the path, e.g. -ckpt "model/ckpt/ae_ckpt_epoch1000.pth".

python train_gencad.py csr -name test -gpu 0

Training the CCIP model

Run the following command to train the CSR model from scratch. If you want to start with a checkpoint just add the -ckpt flag with the path, e.g. -ckpt "model/ckpt/ae_ckpt_epoch1000.pth". Note that you must provide the pretrained cad autoencoder (csr model) checkpoint which is kept frozen during the image encoder training.

python train_gencad.py ccip -name test -gpu 0 -cad_ckpt "model/ckpt/ae_ckpt_epoch1000.pth"

Training the Diffusion Prior model

Run the following command to train the DP model from scratch. Note that you must provide the image embeddings and cad embeddings to train the DP model. These embeddings are obtained by passing the entire training dataset through the pretrained image encoder and cad encoder respectively.

python train_gencad.py dp -name test -gpu 0 -cad_emb 'data/embeddings/cad_embeddings.h5' -img_emb 'data/embeddings/sketch_embeddings.h5'

Inference

Running the inference code will generate CAD and you can save the CAD as STL or STEP or image. To get images in a headless way, please use xvfb-run infront of the main code. The inference code is very straightforward and easy to modify.

xvfb-run python inference_gencad.py

Evaluation

will be updated soon.

Visualization

We provide a simple script to visualize any STL file using OPENCASCADE and save the image in .png format. Just run the following code or modify as you want.

python stl2img.py -src path/to/stl/files -dst path/to/save/images

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages