GithubHelp home page GithubHelp logo

skanti / scan2cad Goto Github PK

View Code? Open in Web Editor NEW
413.0 26.0 64.0 30.82 MB

[CVPR'19] Dataset and code used in the research project Scan2CAD: Learning CAD Model Alignment in RGB-D Scans

Home Page: https://www.scan2cad.org

License: Other

C++ 86.99% Makefile 0.09% Python 12.44% C 0.02% C 0.30% Shell 0.09% CMake 0.07%
deeplearning 3dscan cad cvpr2019 cvpr alignment cad-models voxel-grid annotations

scan2cad's Introduction

Scan2CAD (CVPR 2019 Oral)

We present Scan2CAD, a novel data-driven method that learns to align 3D CAD models from a shape database to 3D scans.

Scan2CAD

Download Paper (.pdf)

See Youtube Video

Link to the annotation webapp source code

Scan2CAD Benchmark Link

Get the Scan2CAD dataset - we reply very quickly:)

Demo samples

Scan2CAD Alignments

Loadu

Orientated Bounding Boxes for Objects

Scan2CAD

Description

Dataset used in the research project: Scan2CAD: Learning CAD Model Alignment in RGB-D Scans

For the public dataset, we provide annotations with:

  • 97607 keypoint correspondences between Scan and CAD models
  • 14225 objects between Scan and CAD
  • 1506 scans

An additional annotated hidden testset, that is used for our Scan2CAD benchmark contains:

  • 7557 keypoint correspondences between Scan and CAD models
  • 1160 objects between Scan and CAD
  • 97 scans

Benchmark

We published a new benchmark for CAD model alignment in 3D scans (and more tasks to come) here.

Get started

  1. Clone repo:

git clone https://github.com/skanti/Scan2CAD.git

  1. Ask for dataset: (see sections below. You will need ScanNet, ShapeNet and Scan2CAD).

  2. Copy dataset content into ./Routines/Script/.

  3. Visualize data:

python3 ./Routines/Script/Annotation2Mesh.py

  1. Compile c++ programs
cd {Vox2Mesh, DFGen, CropCentered}
make
  1. Voxelize CADs (shapenet):

python3 ./Routines/Script/CADVoxelization.py

  1. Generate data (correspondences):

python3 ./Routines/Script/GenerateCorrespondences.py

  1. Start pytorch training for heatmap prediction:
cd ./Network/pytorch
./run.sh
  1. Run alignment algorithm:
cd Routines/Scripts
python3 Alignment9DoF.py --projectdir /Network/pytorch/output/dummy
  1. Mesh and view alignment result:
cd Routines/Scripts
python3 Alignment2Mesh.py --alignment ./tmp/alignments/dummy/scene0470_00.csv --out ./

Download Scan2CAD Dataset (Annotation Data)

If you would like to download the Scan2CAD dataset, please fill out this google-form.

A download link will be provided to download a .zip file (approx. 8MB) that contains the dataset.

Format of the Datasets

Format of "full_annotions.json"

The file contains 1506 entries, where the field of one entry is described as:

[{
id_scan : "scannet scene id",
trs : { // <-- transformation from scan space to world space 

    translation : [tx, ty, tz], // <-- translation vector
    rotation : (qw, qx, qy, qz], // <-- rotation quaternion
    scale :  [sx, sy, sz], // <-- scale vector
    },
aligned_models : [{ // <-- list of aligned models for this scene
    sym : "(__SYM_NONE, __SYM_ROTATE_UP_2, __SYM_ROTATE_UP_4 or __SYM_ROTATE_UP_INF)", // <-- symmetry property only one applies
    catid_cad  : "shapenet category id",
    id_cad : "shapenet model id"
    trs : { // <-- transformation from CAD space to world space 
        translation : [tx, ty, tz], // <-- translation vector
        rotation : [qw, qx, qy, qz], // <-- rotation quaternion
        scale : [sx, sy, sz] // <-- scale vector
	},
    keypoints_scan : { // <-- scan keypoints 
        n_keypoints` : "(int) number of keypoints",
        position :  [x1, y1, z1, ... xN, yN, zN], // <--  scan keypoints positions in world space
	},
    keypoints_cad : { // <-- cad keypoints 
        n_keypoints` : "(int) number of keypoints",
        position :  [x1, y1, z1, ... xN, yN, zN], // <--  cad keypoints positions in world space
	},
     // NOTE: n_keypoints (scan) = n_keypoints (CAD) always true
    }]
},
{ ... },
{ ... },
]

Format of "cad_appearances.json"

This file is merely a helper file as the information in this file are deducible from "full_annotations.json". The file contains 1506 entries, where the field of one entry is described as:

{ 
  scene00001_00 : { // <-- scan id as key
   "00000001_000000000000abc" : 2, // <-- catid_cad + "_" + id_cad as key, the number denotes the number of appearances of that CAD in the scene
   "00000003_000000000000def" : 1,
   "00000030_000000000000mno" : 1,
   ...
  },
  scene00002_00 : {
    ...
  },
},

Visualization of the Dataset + BBoxes

Once you have downloaded the dataset files, you can run ./Routines/Script/Annotation2Mesh.py to preview the annotations as seen here (toggle scan/CADs/BBox):

Data Generation for Scan2CAD Alignment

Scan and CAD Repository

In this work we used 3D scans from the ScanNet dataset and CAD models from ShapeNetCore (version 2.0). If you want to use it too, then you have to send an email and ask for the data - they usually do it very quickly.

Here is a sample (see in ./Assets/scannet-sample/ and ./Assets/shapenet-sample/):

ScanNet Color ScanNet Labels
ShapeNet Trashbin ShapeNet Chair ShapeNet Table

Voxelization of Data as Signed Distance Function (sdf) and unsigned Distance Function (df) files

The data must be processed such that scans are represented as sdf and CADs as df voxel grids as illustrated here (see in ./Assets/scannet-voxelized-sdf-sample/ and ./Assets/shapenet-voxelized-df-sample/):

ShapeNet Trashbin Vox ShapeNet Chair Vox ShapeNet Table Vox

In order to create sdf voxel grids from the scans, volumetric fusion is performed to fuse depth maps into a voxel grid containing the entire scene. For the sdf grid we used a voxel resolution of 3cm and a truncation distance of 15cm.

In order to generate the df voxel grids for the CADs we used a modification (see CADVoxelization.py) of this repo (thanks to @christopherbatty).

Creating Training Samples

In order to generate training samples for your CNN, you can run ./Routines/Script/GenerateCorrespondences.py. From the Scan2CAD dataset this will generate following:

  1. Centered crops of the scan
  2. Heatmaps on the CAD (= correspondence to the scan)
  3. Scale (x,y,z) for the CAD
  4. Match (0/1) indicates whether both inputs match semantically

The generated data totals to approximately 500GB. Here is an example of the data generation (see in ./Assets/training-data/scan-centers-sample/ and ./Assets/training-data/CAD-heatmaps-sample/)

Scan Center Vox CAD Heatmap Vox (to be gaussian blurred)

Citation

If you use this dataset or code please cite:

@InProceedings{Avetisyan_2019_CVPR,
author = {Avetisyan, Armen and Dahnert, Manuel and Dai, Angela and Savva, Manolis and Chang, Angel X. and Niessner, Matthias},
title = {Scan2CAD: Learning CAD Model Alignment in RGB-D Scans},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}

scan2cad's People

Contributors

skanti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scan2cad's Issues

Visualization of the .vox files

Hi,

Thank you for sharing this impressive project. I have one question: how did you visualize the generated .vox files? What software/library did you use? Thanks in advance.

Request for downloading the dataset

Sorry to open an issue here, I've already filled the google form that requests for this dataset (for research purpose), could you kindly help check the status? Thank you in advance!

sending the scan2cad dataset

hey guys, sorry for posting here but can you send me the scan2cad dataset for research purposes i have already filled the google forms .

send dataset

Hi, skanti,I have filled out the form, could you please send me the dataset for research purposes.

dataset request

Hi! I've filled the form for requesting dataset at least one week ago, but I received nothing in my mailbox. Maybe there's something wrong with the google form. Could you please send me the dataset? I really need this for research purpose. Thank you very much!

Sending dataset

Hi , I’ve filled out form but have not received a response. Is the dataset still available ?

Reproducing the paper & some more questions

First of all, thank you for sharing the Scan2CAD code online. I tried to reach you via email, however I haven't received any replies yet, so I'm going to post my questions here.

  1. Do you by any chance have a pre-trained network available for testing?

  2. In your paper, you mentioned that you generated both positive & negative training sampled. In the github repository, it seems like you only have code for generating positive samples. Can you share the code for generating negative samples as well? In addition, in the paper you also mentioned that you used a pre-trained CAD encoder. Is the pre-trained encoder included in the repo?

  3. Related to the previous question, is the code in git repo enough for reproducing the results in the Scan2CAD paper, or is there more that needs to be added? Is there an evaluation script that I can use to reproduce the same results as shown in the table in your paper?

  4. What generated data files contain those correspondence information generated by your network?

Thank you in advance!

Data generation script

Hi,

Is it possible to share the actual data generation script used in the paper with us (which includes both positive and negative sample generation)? Thanks!

Is a dataset for validation not provided?

Hello, I'm working on training the network to predict cad alignment on RGB-D scan. In my understaning, the annotation for testset is not provided to prevent the parameter tuning on testset. But is it the same with validation set, either? In main.py script, it seems that a scene list for validation is required but I cannot find it. How can I handle overfitting on train set?

Question of ValueError in Annotation2Mesh.py

I have downloaded the scannet and shapenet data. I run the Annotation2Mesh.py line 145 of Annotation2Mesh.py cad_mesh = pywavefront.Wavefront(cad_file, collect_faces=True, parse=True), which makes the program crash. It raised ValueError ValueError: Trying to merge vertex data with different format: T2F_N3F_V3F.Material material_1_24 has vertexformat. Could you please help me to solve this problem. Thank you a lot.

Apply for dataset

hi, thank you for your constructive work. I'd like to run the code and have applied for the scan2cad dataset, but never recived feedback, and the google-form seems not working anymore. could you please provide me some other channels?

List out of range in Annotation2Mesh.py, line 115

The dataset faces mainly consist of 3 vertices hence the array f is always a 3-tuple array, however in line 115 of Annotation2Mesh.py it just call f[3], which makes the program crash.
Did you notice this apparent error or is there something I missed to cause such problem?

scannet dataset

hi
I use volumetric fusion get the TSDF result of ScanNet(0470_00), the voxel resolution is 3cm and truncation is 15cm(grid num(116,95,46)). The result is very worse, can you give some more detail about obtain TSDF of ScanNet datasets.
屏幕快照 2019-03-14 17 38 50

ShapeNet df

hi, I want to "generate the df voxel grids for the CADs we used this repo", but I can not get the right data, comparing with you provided. And how can I get the grid2world matrix?

Question of the harris keypoint

Hi,

Thank you for the excellent work! I read the paper recently and found that the baseline methods use the patch around the harris keypoints as input. So did the method proposed use the patch around the harris keypoints as input either? If yes, so can i ask what the parameter you use to get the harris keypoints? i try the Harris3D by the software PCLKeypoints but the detector perform bad. I will appreciate if you can give me some hint. Thank you!

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.