Giter VIP home page Giter VIP logo

pytorch-3d-point-cloud-generation's Introduction

Pytorch: Learning Efficient Point Cloud Generation for Dense 3D Object Reconstruction

A Pytorch implementation of the paper: Learning Efficient Point Cloud Generation for Dense 3D Object Reconstruction


Training/evaluating the network

Prerequisites

This code is developed with Python3 (python3). Pytorch 0.4+ is required.

Dataset

(Provided in TF's repo) The dataset (8.8GB) can be downloaded by running the command

wget https://cmu.box.com/shared/static/s4lkm5ej7sh4px72vesr17b1gxam4hgy.gz

This file includes:

After downloading, run tar -zxf s4lkm5ej7sh4px72vesr17b1gxam4hgy.gz under the main directory. The files will be extracted to the data directory. (Please also cite the relevant papers if you plan to use this dataset package.)

Running the code

The following scripts gives examples for running the code.

  • Pretraining the network: scripts/train-stg1.sh
  • Fine-tuning with joint 2D optimization: scripts/train-stg2.sh
  • Evaluating on the test set: scripts/evaluate.sh
  • Computing the error metrics: scripts/evaluate_dist.sh

Checkpoints are stored in models/${EXPERIMENTATION}, summaries are stored in runs/_${EXPERIMENTATION}, and evaluated point clouds are stored in results_${GROUP}. The list of optional arguments can be found by executing python3 train-stg1.py --help.


Rendering ground-truth depth images

(Provided in TF's repo) We provide the code to render depth images for supervision.

Prerequisites

This code requires the following:

  • Blender as the rendering engine. This code was developed with Blender 2.78. After installation, please make sure the command blender is callable (use which blender to check installation).
  • The OpenEXR Python binding for .exr to .mat file conversion.

Dataset

The raw ShapeNet dataset can be downloaded here. This rendering code was developed to use ShapeNetCore v2. (The provided depth images were rendered from ShapeNetCore v1.)

Running the code

Under render, run ./run.sh 03001627 8 to render depth images for fixed and arbitrary viewpoints, and convert them to .mat files. This will convert all objects in the ShapeNet chair category (03001627) with 8 fixed viewpoints. The rendered files will be stored in the output directory.


Creating densified point clouds of CAD models for evaluation

(Provided in TF's repo) We also provide the code to densify the vertices of CAD models to a specified number. This code can be run independently; only the ShapeNet dataset is required. It repeats the process of adding a vertex to the center of the longest edge of the triangular mesh and subsequently re-triangulating the mesh. This will create (generally) uniformly densified CAD models.

Running the code

Under densify, run ./run.sh 03001627 to run densification. The densified CAD models will be stored in the output directory.

pytorch-3d-point-cloud-generation's People

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

pytorch-3d-point-cloud-generation's Issues

Nan error on run

I forked the project and had to update a few functions based on the error and suggested fixes. When running the pre-training script as is, I get NaN errors and after further investigation it's in trainer.py line 81-82 when computing the l1 loss on the depth.masked_select

Question about point cloud transformation

Hi, I'm very new to deal with point cloud. So maybe my question is not quite related to your repository.
I want to ask if I have a point cloud(Nx3), a rotation matrix(3x3) and translation matrix(1x3). How could I get the point cloud after the transformation(rotation and translation→4X4)?
For rotation, I guess just multiply with the matrix? And how about translation?
Your help will be highly appreciated.

Visualization of the predicted output

I used your model to train and test it works great, but currently, I am able to understand .mat file output.
As per your code, you are using Scipy to save in mat with image and cloud points, but how can I convert to exr for viewing in the blender?

Great work by the way.

pose of the point cloud

Thanks for sharing this project. I am working on 6d pose estimation.
I want to ask, whether this model output the pointcloud ,that in object coordinate locates. I mean, different images of the same object generates the same 3D pointcloud, right ?
cause I'm focusing on the pose of the object, and the same object in different images has different pose and different coordinate.
looking forward to your reply.

Issue with accessing model_normalized.obj

Hi,

I've noticed that both render.py and render_fixed.py try to access a file called 'model_normalized.obj', which is supposed to be under the 'models' directory for each object code in the specified series (for example: '/dataset/ShapeNetCore.v1/03001627/1006be65e7bc937e9141f9b58470d646/models/model_normalized.obj')
But it seems that such a file or directory doesn't exist.

I downloaded the image zip file for the chair synset ( synset id: 03001627) under the ShapeNetCore v1 dataset from shapenet.org.

I'd really like to know how model_normalized.obj is created. Is it supposed to be available in the zip file? Or have I missed out any steps in between scripts/evaluate_dist.sh and ./run.sh 03001627 8?

Any help is highly appreciated. Thanks in advance!

Encounter a runtime error when trying to run train_stg1.py

Hi, I am very new to this repo and when I tried to run train_stg1.py, the following runtime error occurs and I am a bit puzzled of the reason why:

======= TRAINING START =======
Epoch 0:
Traceback (most recent call last):
File "../train_stg1.py", line 45, in
hist = trainer.train(model, optimizer, scheduler)
File "/pytorch-3d-point-cloud-generation/trainer.py", line 31, in train
train_epoch_loss = self._train_on_epoch(model, optimizer)
File "/pytorch-3d-point-cloud-generation/trainer.py", line 76, in _train_on_epoch
XYZ, maskLogit = model(input_images)
File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/pytorch-3d-point-cloud-generation/PCGModel.py", line 123, in forward
latent = self.encoder(x)
File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/pytorch-3d-point-cloud-generation/PCGModel.py", line 66, in forward
x = self.fc1(x.view(-1, 4096))
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

In addition, the user is required to create a logs folder under scripts folder such that a log file can be created automatically before training. I suggest including this information in the README.

Thanks!

Question about model

After conv4 (encoder) we have an output shape of XY with 256 channels.
But the input in fc1 is 4096, shouldn't the input be X
Y256 or can this model only work with input images of size 6464 (that's the one case when the input is 4096)

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.