code for our ICCV 2021 paper "DeepCAD: A Deep Generative Network for Computer-Aided Design Models"

Overview

DeepCAD

This repository provides source code for our paper:

DeepCAD: A Deep Generative Network for Computer-Aided Design Models

Rundi Wu, Chang Xiao, Changxi Zheng

ICCV 2021 (camera ready version coming soon)

We also release the Onshape CAD data parsing scripts here: onshape-cad-parser.

Prerequisites

  • Linux
  • NVIDIA GPU + CUDA CuDNN
  • Python 3.7, PyTorch 1.5+

Dependencies

Install python package dependencies through pip:

$ pip install -r requirements.txt

Install pythonocc (OpenCASCADE) by conda:

$ conda install -c conda-forge pythonocc-core=7.5.1

Data

Download data from here (backup) and extract them under data folder.

  • cad_json contains the original json files that we parsed from Onshape and each file describes a CAD construction sequence.
  • cad_vec contains our vectorized representation for CAD sequences, which serves for fast data loading. They can also be obtained using dataset/json2vec.py. TBA.
  • Some evaluation metrics that we use requires ground truth point clouds. Run:
    $ cd dataset
    $ python json2pc.py --only_test

The data we used are parsed from Onshape public documents with links from ABC dataset. We also release our parsing scripts here for anyone who are interested in parsing their own data.

Training

See all hyper-parameters and configurations under config folder. To train the autoencoder:

$ python train.py --exp_name newDeepCAD -g 0

For random generation, further train a latent GAN:

# encode all data to latent space
$ python test.py --exp_name newDeepCAD --mode enc --ckpt 1000 -g 0

# train latent GAN (wgan-gp)
$ python lgan.py --exp_name newDeepCAD --ae_ckpt 1000 -g 0

The trained models and experment logs will be saved in proj_log/newDeepCAD/ by default.

Testing and Evaluation

Autoencoding

After training the autoencoder, run the model to reconstruct all test data:

$ python test.py --exp_name newDeepCAD --mode rec --ckpt 1000 -g 0

The results will be saved inproj_log/newDeepCAD/results/test_1000 by default in the format of h5 (CAD sequence saved in vectorized representation).

To evaluate the results:

$ cd evaluation
# for command accuray and parameter accuracy
$ python evaluate_ae_acc.py --src ../proj_log/newDeepCAD/results/test_1000
# for chamfer distance and invalid ratio
$ python evaluate_ae_cd.py --src ../proj_log/newDeepCAD/results/test_1000 --parallel

Random Generation

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

# run latent GAN to generate fake latent vectors
$ python lgan.py --exp_name newDeepCAD --ae_ckpt 1000 --ckpt 200000 --test --n_samples 9000 -g 0

# run the autoencoder to decode into final CAD sequences
$ python test.py --exp_name newDeepCAD --mode dec --ckpt 1000 --z_path proj_log/newDeepCAD/lgan_1000/results/fake_z_ckpt200000_num9000.h5 -g 0

The results will be saved inproj_log/newDeepCAD/lgan_1000/results by default.

To evaluate the results by COV, MMD and JSD:

$ cd evaluation
$ sh run_eval_gen.sh ../proj_log/newDeepCAD/lgan_1000/results/fake_z_ckpt200000_num9000_dec 1000 0

The script run_eval_gen.sh combines collect_gen_pc.py and evaluate_gen_torch.py. You can also run these two files individually with specified arguments.

Pre-trained models

Download pretrained model from here (backup) and extract it under proj_log. All testing commands shall be able to excecuted directly, by specifying --exp_name=pretrained when needed.

Visualization and Export

We provide scripts to visualize CAD models and export the results to .step files, which can be loaded by almost all modern CAD softwares.

$ cd utils
$ python show.py --src {source folder} # visualize with opencascade
$ python export2step.py --src {source folder} # export to step format

Script to create CAD modeling sequence in Onshape according to generated outputs: TBA.

Acknowledgement

We would like to thank and acknowledge referenced codes from DeepSVG, latent 3d points and PointFlow.

Cite

Please cite our work if you find it useful:

@article{wu2021deepcad,
title={Deepcad: A deep generative network for computer-aided design models},
author={Wu, Rundi and Xiao, Chang and Zheng, Changxi},
journal={arXiv preprint arXiv:2105.09492},
year={2021}
}
Owner
Rundi Wu
Incoming PhD student at Columbia University
Rundi Wu
Document Layout Analysis Projects

Layout_Analysis Introduction This is an implementation of RLSA and X-Y Cut with OpenCV Dependencies OpenCV 3.0+ How to use Compile with g++ : g++ -std

22 Dec 08, 2022
An unofficial implementation of the paper "AutoVC: Zero-Shot Voice Style Transfer with Only Autoencoder Loss".

AutoVC: Zero-Shot Voice Style Transfer with Only Autoencoder Loss This is an unofficial implementation of AutoVC based on the official one. The reposi

Chien-yu Huang 27 Jun 16, 2022
Face Detection with DLIB

Face Detection with DLIB In this project, we have detected our face with dlib and opencv libraries. Setup This Project Install DLIB & OpenCV You can i

Can 2 Jan 16, 2022
https://arxiv.org/abs/1904.01941

Character-Region-Awareness-for-Text-Detection- https://arxiv.org/abs/1904.01941 Train You can train SynthText data use python source/train_SynthText.p

DayDayUp 120 Dec 28, 2022
Discord QR Scam Code Generator + Token grab mobile device.

A Python script that automatically generates a Nitro scam QR code and grabs the Discord token when scanned.

Visual 9 Nov 22, 2022
Some Boring Research About Products Recognition 、Duplicate Img Detection、Img Stitch、OCR

Products Recognition 介绍 商品识别,围绕在复杂的商场零售场景中,识别出货架图像中的商品信息。主要组成部分: 重复图像检测。【更新进度 4/10】 图像拼接。【更新进度 0/10】 目标检测。【更新进度 0/10】 商品识别。【更新进度 1/10】 OCR。【更新进度 1/10】

zhenjieWang 18 Jan 27, 2022
Demo for the paper "Overlap-aware low-latency online speaker diarization based on end-to-end local segmentation"

Streaming speaker diarization Overlap-aware low-latency online speaker diarization based on end-to-end local segmentation by Juan Manuel Coria, Hervé

Juanma Coria 185 Jan 01, 2023
RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition

RepMLP RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition Released the code of RepMLP together with an example o

260 Jan 03, 2023
A small C++ implementation of LSTM networks, focused on OCR.

clstm CLSTM is an implementation of the LSTM recurrent neural network model in C++, using the Eigen library for numerical computations. Status and sco

Tom 794 Dec 30, 2022
第一届西安交通大学人工智能实践大赛(2018AI实践大赛--图片文字识别)第一名;仅采用densenet识别图中文字

OCR 第一届西安交通大学人工智能实践大赛(2018AI实践大赛--图片文字识别)冠军 模型结果 该比赛计算每一个条目的f1score,取所有条目的平均,具体计算方式在这里。这里的计算方式不对一句话里的相同文字重复计算,故f1score比提交的最终结果低: - train val f1score 0

尹畅 441 Dec 22, 2022
Motion Detection Squid Game with OpenCV Python

*Motion Detection Squid Game with OpenCV Python i am newbie in python. In this project I made a simple game to follow the trend about the red light gr

Nayan 17 Nov 22, 2022
Write-ups for the SwissHackingChallenge2021 CTF.

SwissHackingChallenge 2021 : Write-ups This repository contains a collection of my write-ups for challenges solved during the SwissHackingChallenge (S

Julien Béguin 3 Jun 07, 2021
Repositório para registro de estudo da biblioteca opencv (Python)

OpenCV (Python) Objetivo do Repositório: Registrar avanços no estudo da biblioteca opencv. O repositório estará aberto a qualquer pessoa e há tambem u

1 Jun 14, 2022
Roboflow makes managing, preprocessing, augmenting, and versioning datasets for computer vision seamless.

Roboflow makes managing, preprocessing, augmenting, and versioning datasets for computer vision seamless. This is the official Roboflow python package that interfaces with the Roboflow API.

Roboflow 52 Dec 23, 2022
scene-linear test images

Scene-Referred Image Collection A collection of OpenEXR Scene-Referred images, encoded as max 2048px width, DWAA 80 compression. All exrs are encoded

Gralk Klorggson 7 Aug 25, 2022
A document scanner application for laptops/desktops developed using python, Tkinter and OpenCV.

DcoumentScanner A document scanner application for laptops/desktops developed using python, Tkinter and OpenCV. Directly install the .exe file to inst

Harsh Vardhan Singh 1 Oct 29, 2021
nofacedb/faceprocessor is a face recognition engine for NoFaceDB program complex.

faceprocessor nofacedb/faceprocessor is a face recognition engine for NoFaceDB program complex. Tech faceprocessor uses a number of open source projec

NoFaceDB 3 Sep 06, 2021
OpenCVを用いたカメラキャリブレーションのサンプルです。2021/06/21時点でPython実装のある3種類(通常カメラ向け、魚眼レンズ向け(fisheyeモジュール)、全方位カメラ向け(omnidirモジュール))について用意しています。

OpenCV-CameraCalibration-Example FishEyeCameraCalibration.mp4 OpenCVを用いたカメラキャリブレーションのサンプルです 2021/06/21時点でPython実装のある以下3種類について用意しています。 通常カメラ向け 魚眼レンズ向け(

KazuhitoTakahashi 34 Nov 17, 2022
Image Detector and Convertor App created using python's Pillow, OpenCV, cvlib, numpy and streamlit packages.

Image Detector and Convertor App created using python's Pillow, OpenCV, cvlib, numpy and streamlit packages.

Siva Prakash 11 Jan 02, 2022
Code for the paper: Fusformer: A Transformer-based Fusion Approach for Hyperspectral Image Super-resolution

Fusformer Code for the paper: "Fusformer: A Transformer-based Fusion Approach for Hyperspectral Image Super-resolution" Plateform Python 3.8.5 + Pytor

Jin-Fan Hu (胡锦帆) 11 Dec 12, 2022