Giter Site home page Giter Site logo

paper_implementation_sgsppc's Introduction

Paper implementation

Paper - https://arxiv.org/pdf/1707.06267

Below is the implementation of the same

Tasks

  1. Kdtree
  2. PCA
  3. Iterative Point Ordering
  4. GAN
  5. Training

Setup and running the files

Run the following code: (windows specific venv env activate cmd)

pip -m env preimage_env
cd preimage_env && Scripts/activate
git clone https://github.com/SairajLoke/Preimage_Tasks
cd Preimage_Tasks/shapgen
pip install -r requirements.txt

create additional directionaries namely

  • models
  • point_cloud_matrices ( to keep intermediate U Vt Sigma & PointCloud data in matrix format)
  • train (required while training)

now your setup is ready!

To quickly run inference run -

python .\task6_inference.py

mention appropriate

  • training id and epochs associated with the model to load
  • paths for U and Sigma matrices stored as npy files (shared on google drive)
  • path for loading generator

you can expect a point cloud window popup, along with the correspond pcd stored in inference folder something like this generated_tid1_e8

About the files and folders

files -

  • configs: has all the params to tweak and the paths
  • tests: tests i performed on various lib methods during the entire process
  • notes: some pts
  • colab configs and colab notebook were used to use colab specs in a better way
  • other task related files mentioned below

folders

  • You can viz all plots in plots folders
  • latest : impt results to look at from the different tasks
  • point_cloud_matrices : Intermediate sorted npy matrices are saved in folder ( their (matrices) size is too big, so sharing them files through google drive)
  • models : has all the checkpoints saved ( as given in the configs - constant: GENERATOR_MODEL_DIR
  • train : not necessary (just to store the Vt matrices used in training), can be changed by paths in configs
  • inference : has saved pcd files of generated ptclds

Inside shapgen folder -

To do a kdtree based space partitioning of given point clouds

python task1_space_partitioning_point_cloud.py

In this the order is inorder traversal of the kdtree.

PCA using SVD code can be found in task2_pca.py

To do further optimization over the order of points run python task3_optimizing_pt_ordering.py (the torch version of the file is also given, but wasnt that useful)

I think we can further optimize this by swapping a set of adjacent points with another adjacent set of points rather than just 2.

The GAN has been implemented using 4 Linear each in disc + gen, the architecture is a bit modified (compared to the paper), specifically - tanh as activation in generator (instead of relu), to generate negative vals as well

To train a GAN run python task5_training_new.py Training uses the Discrimator's activation based loss for generator and vanilla GAN loss for discriminator. Moreover Discriminator trains only if accuracy of Disc < 0.8

To run inference using pretrained gan weigths python task6_inference.py

Some selected results from PCA

Sorting using the algo mentioned ( used a matrix representation for calculating the recon error for all shapes rather than iterating over all the vertical pt clouds separately, this considerably reduced the pca recon error calc time ( around 3times less for particular configs)

for 2000 chair shapes ( 5k was taking too long) in the SVD section. 10 swaps per iterations for 50 iterations PCA recon error

GAN and training

The Trained GAN models (Generator and Discriminator(not needed for inference) ) can be found in models directory -

The training losses can be seen as follows : (saved in train plots)

Gerror Derror

References

papers

for theory:

PCD

https://pointclouds.org/documentation/tutorials/pcd_file_format.html https://www.open3d.org/

Kdtree:

https://youtu.be/Ash4Q06ZcHU?si=ifr9WVh2NGxC7A4f https://pcl.readthedocs.io/projects/tutorials/en/master/kdtree_search.html

PCA and SVD

https://youtu.be/XwTW_YA3HG0?si=uAE2fRClRvlPbdTw https://www.cs.toronto.edu/~jepson/csc420/notes/introSVD.pdf

GANs

https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html https://arxiv.org/pdf/1406.2661 (GANs 2014 pseudo code)

Others

Pytorch , numpy , Open3d Documentation . stackoverflow ( for quick referencing queries like matrix to open3d pt cloud, etc)

paper_implementation_sgsppc's People

Contributors

sairajloke avatar

Watchers

 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.