Coder Social home page Coder Social logo

google / ldif Goto Github PK

View Code? Open in Web Editor NEW
311.0 15.0 34.0 19.39 MB

3D Shape Representation with Local Deep Implicit Functions.

Home Page: https://ldif.cs.princeton.edu

License: Apache License 2.0

Shell 1.82% Python 83.42% Cuda 4.78% Makefile 0.10% C++ 8.60% Jupyter Notebook 1.28%
ldif sif shape-reconstruction 3d-vision graphics cvpr2020 iccv2019

ldif's Introduction

Overview

alt text alt text

This is a joint codebase for LDIF (Local Deep Implicit Functions for 3D Shape) and SIF (Learning Shape Templates with Structured Implicit Functions). Note that LDIF was previously called Deep Structured Implicit Functions. It contains code to reproduce the results of those papers, convert input meshes into the LDIF and SIF representations, and visualize and extract meshes. representations.

All .py and .sh files in the top-level ldif/ directory are entry points into the code (train.py, eval.py, meshes2dataset.py, unit_test.sh, and reproduce_shapenet_autoencoder.sh). The rest of this README provides information on initial setup and basic documentation for those files. For additional documentation, please see each file.

Environment

To set up the LDIF/SIF environment, follow these steps:

1. Set up the python environment

The code was tested with python 3.6 and tensorflow 1.15 on linux. There is a requirements.txt containing all dependencies.

If you use anaconda, run the following:

conda env create --name ldif -f environment.yml
conda activate ldif

If you use a system pip installation, run pip install -r requirements.txt

After this, the python environment should be ready to go. Please activate the environment before proceeding. The build scripts include some python.

2. Build GAPS

./build_gaps.sh

GAPS is a geometry processing library used by this package to generate the data and create interactive visualizations. The script build_gaps.sh does the following. One, it installs the necessary dependencies with apt. If sudo is not available on the system, the requirements are that GAPS have include access to standard OpenGL and GLu library headers (GL/gl.h, GL/glu.h) (on both linux and macos), and that OSMesa static libraries can be linked (on linux). If these are satisfied, the sudo line can be commented out. Two, it clones the GAPS repository from GitHub, make some changes, and builds it. It also moves the qview folder into the gaps repository and modifies the makefiles. The qview executable is a C++ program written using GAPS to visualize SIF and LDIF representations. Finally, the script compiles all necessary GAPS C++ executables, which are called by the python code. If this step was successful, running ./gaps_is_installed.sh should echo Ready to go!

GAPS should compile with no warnings. Please report any warnings by opening a GitHub issue- the information would be greatly appreciated.

3. Build the inference kernel (Optional, but highly recommended)

./build_kernel.sh

If successful, there should be a binary ldif2mesh in the ldif/ldif2mesh/ subdirectory. Note that the inference kernel assumes the CUDA toolkit is installed and that a gpu supporting compute 6.1 (Pascal, so 10-series or newer) is available. The nvcc command is part of the CUDA toolkit. If you have an older gpu, you can try older compute versions for --gpu-architecture and --gpu-code, but performance may be reduced and some newer features are used, so it might not compile.

If you do not want to use the inference kernel or don't have a GPU, then you can pass --nouse_inference_kernel to eval.py, which is the only script that typically calls the kernel. It will then use pure tensorflow ops for evaluating LDIF, as is done during training (for autodiff support). However, it would be orders of magnitude slower, so it is really not recommended if more than ~20 meshes need to be evaluated.

The kernel should compile with no warnings. Please report any warnings by opening a GitHub issue- this information would be greatly appreciated.

Datasets

To run LDIF/SIF, first a dataset should be made. The input to this step is a directory of watertight meshes, and the output is a directory containing the files needed to train and evaluate LDIF/SIF.

Create an input directory somewhere on disk, with the following structure:

[path/to/root]/{train/val/test}/{class names}/{.ply files}

The properties of the dataset (# and name of classes, size of the splits, name of examples, etc.) are determined from the directory structure. If you want to reproduce the shapenet results, then see ./reproduce_shapenet_autoencoder.sh. A dataset doesn't need to have a train, test, and val split, only whichever splits you want to use. You could make a dataset with just a test split for a comparison, for example. Note that for convenience the code tries to check if the class names are wordnet synsets and will convert them to shapenet names (i.e. 02691156 -> airplane) if they are-- if it can't detect a synset it will just use the folder name as the class name.

Note that .ply files are required, but the GAPS library provides a shell utility for converting between file formats. You can do ./ldif/gaps/bin/x86_64/msh2msh mesh.obj mesh.ply as an example conversion, which will read mesh.obj and write a new file mesh.ply to disk.

It is very important that the input meshes be watertight at training time. GAPS provides a program msh2df that can do the conversion, if you are not interested in exactly replicating the OccNet experiment's process. Here is an example command that will make a unit-cube sized mesh watertight:

./ldif/gaps/bin/x86_64/msh2df input.ply tmp.grd -estimate_sign -spacing 0.002 -v
./ldif/gaps/bin/x86_64/grd2msh tmp.grd output.ply
rm tmp.grd

Msh2df outputs an SDF voxel grid, while grd2msh runs marching cubes to extract a mesh from the generated SDF grid. The msh2df algorithm rasterizes the mesh to a voxel grid and then floodfills at a resolution determined by the -spacing parameter in order to determine the sign. The smaller the value, the higher the resolution, the smaller the smallest allowable hole in the mesh, and the slower the algorithm. The bigger the value, the lower the resolution, the bigger the smallest allowable hole in the mesh, and the faster the algorithm. The run time of both msh2df and of the rest of the dataset creation pipeline will vary greatly depending on the -spacing parameter. The default value of 0.002 is quite high resolution for a mesh the size of a unit cube.

While msh2df is provided as a utility, it was not used to generate the data for the trained LDIF+SIF models. For reproducing the shapenet results, please use the TSDF fusion package used by the OccNet repository, not msh2df.

To actually make a dataset once watertight meshes are available, run:

python meshes2dataset.py --mesh_directory [path/to/dataset_root] \
  --dataset_directory [path/to/nonexistent_output_directory]

Please see meshes2dataset.py for more flags and documentation. To avoid excess disk usage (and avoid having to pass in the input directory path to all subsequent scripts), symlinks are created during this process that point to the meshes in the input directory. Please do not delete or move the input directory after dataset creation, or the code won't have access to the ground truth meshes for evaluation.

The dataset generation code writes 7-9mb of data per mesh (about 330GB for shapenet-13).

Training

To train a SIF or LDIF, run the following:

python train.py --dataset_directory [path/to/dataset_root] \
  --experiment_name [name] --model_type {ldif, sif, or sif++}

The dataset directory should be whatever it was set to when running meshes2dataset.py. The experiment name can be arbitrary, it is a tag used to load the model during inference/eval/interactive sessions. The model_type determines what hyperparameters to use. ldif will train a 32x32 LDIF with 16 symmetric and 16 asymmetric elements. sif will replicate the SIF representation proposed in the SIF paper. sif++ will train an improved version of SIF using the loss and network from LDIF, as well as gaussians that support rotation, but without any latent codes per element. By default trained models are stored under {root}/trained_models/, but this can be changed with the --model_directory flag. For more flags and documentation, please see train.py.

It is also possible to make model types besides the paper version of LDIF/SIF. For details, please see ldif/model/hparams.py. Both LDIF and SIF are stored as specific hparam combos. Adding a new combo and/or new hyperparameters would be the easiest way to evaluate how a modification to LDIF/SIF would change the performance. It would also be how to turn off partial symmetry, or adjust the number of shape elements or size of the latent codes. The only special hyperparameter is batch size, which is read directly by the train.py script, and always set to 1 during inference.

While training, the model write tensorboard summaries. If you don't have tensorboard, you can install it with conda install tensorboard or pip install tensorboard. Then you can run

tensorboard --logdir [ldif_root]/trained_models/sif-transcoder-[experiment_name]/log

assuming that --model_root was set to the default ldif_root]/trained_models/

Warning: Training an LDIF from scratch takes a long time. SIF also takes a while, though not nearly as long. The expected performance with a V100 and a batch size of 24 is 3.5 steps per second for LDIF, 6 steps per second for SIF. LDIF takes about 3.5M steps to fully converge on ShapeNet, while SIF takes about 700K. So that is about 10 days to train an LDIF from scratch, and about 32 hours for SIF. Note that LDIF performance is pretty reasonable after 3-4 days, so depending on your uses it may not be necessary to wait the whole time. The plan is to 1) add pretrained checkpoints (the most pressing TODO) and 2) add multi-gpu support, later on, to help mitigate this issue. Another practical option might be switching out the encoder for a smaller one, because most of the training time is the forward+backward pass on the ResNet50.

Evaluation and Inference

To evaluate a fully trained LDIF or SIF network, run the following:

python eval.py --dataset_directory [path/to/dataset_root] \
  --experiment_name [name] --split {test, val, or train}

This will compute metrics over the dataset and then print out the result to the terminal. By default, it will print out a table of results and LaTeX code. In addition, there are flags --save_results, --save_meshes, and --save_ldifs, which can be set to true. If they are set, the code will also write

  1. pandas-readable CSV files containing the metrics for each mesh and class,
  2. a directory of result meshes generated by the algorithm, and/or
  3. a directory of txt files containing the actual LDIF/SIF representation (parseable by qview, ldif2mesh, and the Decoder class in the ipynb). If these flags are set, then --result_directory must also be provided indicating where they should be written.

Interactive Sessions

You can run the code interactively in an Jupyter notebook. To do so, open the provided file ldif_example_inference.ipynb with Jupyter and attach it to a python 3.6 kernel with the requirements.txt installed. Then follow the prompts in the notebook. The notebook has a demo of loading a mesh, creating an example, running inference, visualizing the underlying SIF elements, extracting a mesh, and computing metrics. There is additional documentation in the .ipynb.

Unit Tests

There is a script unit_test.sh. If you want to check whether the code is installed correctly and works, run it with no arguments. It will make a small dataset using open source models and train/evaluate an LDIF network. Note that it doesn't train to convergence so that it doesn't take very long to run. As a result, the final outputs don't look very good. You can fix this by setting the step count in unit_test.sh higher (around 50K steps is definitely sufficient).

The code also has some unit tests for various pieces of functionality. To run a test, cd into the directory of the *_test.py file, and run it with no arguments. Please be aware that not all of the code is tested, and that the unit tests aren't well documented. The easiest way to check if the code still works is by running ./unit_test.sh.

Other code and PyTorch

In addition to the scripts described above, there are also model definitions and beam pipelines provided for generating datasets and running inference on a larger scale. To use these scripts, it would be necessary to hook up your own beam backend.

There is also very limited PyTorch support in the ldif/torch directory. This code is a basic implementation of SIF that can't train new SIF models, but can load and evaluate SIFs generated by the tensorflow training+evaluation code. It is mainly intended for using SIF correspondences as a building block of another unrelated project in PyTorch. Note that PyTorch is not included in the requirements.txt, and the torch/ subdirectory is independent from the rest of the code base (it interacts only through the .txt files written by the tensorflow code and takes no dependencies on the rest of this codebase). To use it, it is probably easiest to just download the torch/ folder and import the sif.py file as a module.

Updates to the code

  • The code now supports tfrecords dataset generation and usage. This reduces the IO workload done during training. It is enabled by default. Existing users can git pull, rerun meshes2dataset.py with --optimize and --optimize_only, and then resume training where they left off with the new dataset improvements. If you currently experience less than 100% GPU utilization, it is highly recommended. Note it increases dataset size by 3mb per example (and can be disabled with --nooptimize).

  • Support for the inference kernel on Volta, Turing and CC 6.0 Pascal cards should now work as intended. If you had trouble with the inference kernel, please git pull and rerun ./build_kernel.sh.

TODOS

This is a preliminary release of the code, and there are a few steps left:

  • Pretrained model checkpoints are on the way. In the mean-time, please see reproduce_shapenet_autoencoder.sh for shapenet results.
  • This code base does not yet support training a single-view network. In the mean-time, the single-view network architecture has been provided (see ldif/model/hparams.py for additional information).
  • While the eval code is fast enough for shapenet, the post-kernel eval code is written in numpy and is an unnecessary bottleneck. So inference at 256^3 takes a few seconds per mesh, even though the kernel completes in ~300ms.
  • Pressing the 'f' key in a qview visualization session will extract a mesh and show it alongside the SIF elements; however it only considers the analytic parameters. Therefore, it shows a confusing result for LDIF representations, which also have neural features.
  • To make setup easier, we would like to provide a docker container that is ready to go.

ldif's People

Contributors

kylegenova 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

ldif's Issues

IO Performance Issues

Previously (See #3) a user reported poor IO performance that was bottlenecking training. In response to this, a recent commit 801f5b1 added new flags to meshes2dataset.py "--optimize" and "--optimize_only". These flags generate a sharded and compressed tfrecords dataset for reduced IO overhead. The files are written to a subdirectory inside the dataset_directory path. The train.py script looks for that directory, and if available uses it for training rather than the existing files (which remain because they are useful for interactive visualization and the evaluation scripts).

Commit f78dbc4 enables this behavior by default. If you are an existing user experiencing less than 100% GPU utilization, please ctrl+c training, git pull, rerun the meshes2dataset.py script with the flags --optimize and --optimize_only (the latter flag skips the first part of dataset creation, which was already run), and rerun the training command (no change to the training command is required; it will resume using the new tfrecords data). Unfortunately this new meshes2dataset.py step can take several hours on shapenet, and also consumes ~3mb extra disk space per dataset element (totaling 129GB extra on ShapeNet). However, in the tested cases it has resulted in 100% gpu utilization. With this change, I experience ~3.5 steps/sec with a batch size of 24 on a V100, and ~2 steps/sec with a batch size of 24 on a P100.

The size of the shards and their contents could be further optimized, but without a failing example I'm not sure what the optimal settings are. If you experience less than 100% gpu utilization after this change, please comment below and I will do my best to address your issue. Similarly, if you can confirm 100% utilization on a networked HDD, that would be highly appreciated, since I can't easily test on that setup.

One other minor note is that a byproduct of this change is that the 10K points per sample are no longer randomly chosen from 100K each time a mesh is seen; instead the same 10K points are used each time. Because those 10K points are never seen by the network directly, but rather used to generate local pointclouds based on the SIF elements, I anticipate no effect from this change, unless the dataset is extremely small. However I will verify this quantitatively before closing the issue.

/process_mesh_local.sh: line 47: 13856 Bus error (core dumped) ${gaps}/msh2msh $mesh_in $mesh -scale_by_pca -translate_by_centroid -scale 0\.25 -debug_matrix ${outdir}/orig_to_gaps.txt

I have built ./build_gaps.sh successfully.
And /gaps_is_installed.sh print out Ready to go!
But I still get this Bus error "/process_mesh_local.sh: line 47: 13856 Bus error (core dumped) ${gaps}/msh2msh $mesh_in $mesh -scale_by_pca -translate_by_centroid -scale 0.25 -debug_matrix ${outdir}/orig_to_gaps.txt"
when runing

python meshes2dataset.py --mesh_directory [path/to/dataset_root]
--dataset_directory [path/to/nonexistent_output_directory]

Anyone knows why?

Visualization with qview: scaling issue

Hi, we're trying to visualize ellipsoids overlayed on a mesh (as in Fig 5 in the paper). But the scale of the mesh that we put into qview is not consistent with the scale of the ellipsoids. How can we scale the mesh so they're on the same scale?

For example, when visualizing ldif/ldif2mesh/test-ldif.txt with ldif/ldif2mesh/test-ldif-output.ply we notice their scales are inconsistent. In fact the ellipsoids are much smaller than the mesh (only appearing as a dot on the left):
image

When visualizing ldif/ldif2mesh/test-ldif.txt with ldif/ldif2mesh/test-ldif.ply however we have them correctly displayed on the same scale:
image

We've tried to normalize test-ldif-output.ply to a unit sphere but still the scales are inconsistent:
image

I would imagine ldif/ldif2mesh/test-ldif.ply was scaled/translated from ldif/ldif2mesh/test-ldif-output.ply. Where can I find the script to do this?

Fix issues while running ./build_gaps.sh

Platform: Ubuntu 18.04.3 LTS

./build_gaps.sh
fatal error: GL/osmesa.h: No such file or directory

Fix for this error

apt-get install libosmesa6-dev

Second error while running

./build_gaps.sh
In file included from scn2cam.cpp:13:0:
/usr/include/GL/osmesa.h:124:1: error: ‘GLAPI’ does not name a type; did you mean ‘GLEWAPI’?
 GLAPI OSMesaContext GLAPIENTRY

Fix for this error
Near the end of glew.h is the line:
#undef GLAPI
Delete it

Ready to go!

Abnormal chamfer metric reproduced on ShapeNet

Hi Kyle:

I'm trying to reproduce the results with original settings (model type: ldif, batch size: 24) on ShapeNet. Watertight mesh generation was done using code from OccNet before preprocessing with your code make_dataset.py. The data is randomly split into train, val, test set like in the paper. The sizes of the meshes are unchanged, which are whin a cube with side length 2.

However, after 200k iterations of training (which is less than 1M in the paper), I've got the following results on the val split:
mean: IoU=81.78, Chamfer=0.03, F-Score=90.25
Comparing to the results in your paper (mean: IoU=90.00, Chamfer=0.4, F-Score=92.20) and other works, the IoU and F-Score metrics seem Alright considering less training. However, Chamfer metric is abnormally low.

I can't find any mistake before data preprocessing. It would be kind if you can give some hints about the process. It would be better if you can publish pretrained model, watertight mesh generation code and preprocessed data.

Best wishes
Cheng

The result of unit_test.sh

Hi,

What is the result of unit_test.sh supported to be? I only got a full black openGL window. Is it normal?

test or val issue

I 've already trained the model ,but when i want to test it,i failed a lot time

CalledProcessError Traceback (most recent call last)
~/ldif/ldif/inference/predict.py in _grid_eval_cuda(self, sif_vector, resolution, extent)
845 try:
--> 846 cmd_result = sp.check_output(cmd, shell=True)
847 log.info(cmd_result.decode('utf-8').replace('\n', ''))

~/anaconda3/lib/python3.7/subprocess.py in check_output(timeout, *popenargs, **kwargs)
410 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 411 **kwargs).stdout
412

~/anaconda3/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
511 raise CalledProcessError(retcode, process.args,
--> 512 output=stdout, stderr=stderr)
513 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command 'CUDA_VISIBLE_DEVICES=1 /home/gemengyuan/ldif/ldif/ldif2mesh/ldif2mesh /tmp/tmp0e9rowkf/ldif.txt /home/gemengyuan/ldif/ldif/ldif2mesh/extracted.occnet /tmp/tmp0e9rowkf/grid.grd -resolution 256' returned non-zero exit status 35.

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in
1 embedding = encoder.run_example(e)
----> 2 mesh = decoder.extract_mesh(embedding, resolution=256)
3 gaps_util.mshview(mesh)

~/ldif/ldif/inference/predict.py in extract_mesh(self, sif_vectors, resolution, extent, return_success, world2local)
959 extent,
960 extract_parts=False,
--> 961 world2local=world2local)
962 grid_out_time = time.time()
963 log.verbose(f'Grid eval time: {grid_out_time - extract_start_time}')

~/ldif/ldif/inference/predict.py in _grid_eval(self, sif_vector, resolution, extent, extract_parts, world2local)
886 log.verbose('Evaluating SDF grid for mesh.')
887 if self.use_inference_kernel and not extract_parts:
--> 888 return self._grid_eval_cuda(sif_vector, resolution, extent)
889 if extract_parts or world2local:
890 log.warning('Part extraction and world2local are not supported with the'

~/ldif/ldif/inference/predict.py in _grid_eval_cuda(self, sif_vector, resolution, extent)
867 'possible.')
868 else:
--> 869 raise ValueError(f'Unrecognized error code {e.returncode} occurred'
870 f' during inference kernel evaluation: {e.output}')
871

ValueError: Unrecognized error code 35 occurred during inference kernel evaluation: b'GPUCheckOk Failure: CUDA driver version is insufficient for CUDA runtime version ldif2mesh.cu 985\n'


CalledProcessError Traceback (most recent call last)
~/ldif/ldif/inference/predict.py in _grid_eval_cuda(self, sif_vector, resolution, extent)
845 try:
--> 846 cmd_result = sp.check_output(cmd, shell=True)
847 log.info(cmd_result.decode('utf-8').replace('\n', ''))

~/anaconda3/lib/python3.7/subprocess.py in check_output(timeout, *popenargs, **kwargs)
410 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 411 **kwargs).stdout
412

~/anaconda3/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
511 raise CalledProcessError(retcode, process.args,
--> 512 output=stdout, stderr=stderr)
513 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command 'CUDA_VISIBLE_DEVICES=1 /home/gemengyuan/ldif/ldif/ldif2mesh/ldif2mesh /tmp/tmp0e9rowkf/ldif.txt /home/gemengyuan/ldif/ldif/ldif2mesh/extracted.occnet /tmp/tmp0e9rowkf/grid.grd -resolution 256' returned non-zero exit status 35.

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in
1 embedding = encoder.run_example(e)
----> 2 mesh = decoder.extract_mesh(embedding, resolution=256)
3 gaps_util.mshview(mesh)

~/ldif/ldif/inference/predict.py in extract_mesh(self, sif_vectors, resolution, extent, return_success, world2local)
959 extent,
960 extract_parts=False,
--> 961 world2local=world2local)
962 grid_out_time = time.time()
963 log.verbose(f'Grid eval time: {grid_out_time - extract_start_time}')

~/ldif/ldif/inference/predict.py in _grid_eval(self, sif_vector, resolution, extent, extract_parts, world2local)
886 log.verbose('Evaluating SDF grid for mesh.')
887 if self.use_inference_kernel and not extract_parts:
--> 888 return self._grid_eval_cuda(sif_vector, resolution, extent)
889 if extract_parts or world2local:
890 log.warning('Part extraction and world2local are not supported with the'

~/ldif/ldif/inference/predict.py in _grid_eval_cuda(self, sif_vector, resolution, extent)
867 'possible.')
868 else:
--> 869 raise ValueError(f'Unrecognized error code {e.returncode} occurred'
870 f' during inference kernel evaluation: {e.output}')
871

ValueError: Unrecognized error code 35 occurred during inference kernel evaluation: b'GPUCheckOk Failure: CUDA driver version is insufficient for CUDA runtime version ldif2mesh.cu 985\n'

CalledProcessError Traceback (most recent call last)
~/ldif/ldif/inference/predict.py in _grid_eval_cuda(self, sif_vector, resolution, extent)
845 try:
--> 846 cmd_result = sp.check_output(cmd, shell=True)
847 log.info(cmd_result.decode('utf-8').replace('\n', ''))

~/anaconda3/lib/python3.7/subprocess.py in check_output(timeout, *popenargs, **kwargs)
410 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 411 **kwargs).stdout
412

~/anaconda3/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
511 raise CalledProcessError(retcode, process.args,
--> 512 output=stdout, stderr=stderr)
513 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command 'CUDA_VISIBLE_DEVICES=1 /home/gemengyuan/ldif/ldif/ldif2mesh/ldif2mesh /tmp/tmp0e9rowkf/ldif.txt /home/gemengyuan/ldif/ldif/ldif2mesh/extracted.occnet /tmp/tmp0e9rowkf/grid.grd -resolution 256' returned non-zero exit status 35.

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in
1 embedding = encoder.run_example(e)
----> 2 mesh = decoder.extract_mesh(embedding, resolution=256)
3 gaps_util.mshview(mesh)

~/ldif/ldif/inference/predict.py in extract_mesh(self, sif_vectors, resolution, extent, return_success, world2local)
959 extent,
960 extract_parts=False,
--> 961 world2local=world2local)
962 grid_out_time = time.time()
963 log.verbose(f'Grid eval time: {grid_out_time - extract_start_time}')

~/ldif/ldif/inference/predict.py in _grid_eval(self, sif_vector, resolution, extent, extract_parts, world2local)
886 log.verbose('Evaluating SDF grid for mesh.')
887 if self.use_inference_kernel and not extract_parts:
--> 888 return self._grid_eval_cuda(sif_vector, resolution, extent)
889 if extract_parts or world2local:
890 log.warning('Part extraction and world2local are not supported with the'

~/ldif/ldif/inference/predict.py in _grid_eval_cuda(self, sif_vector, resolution, extent)
867 'possible.')
868 else:
--> 869 raise ValueError(f'Unrecognized error code {e.returncode} occurred'
870 f' during inference kernel evaluation: {e.output}')
871

ValueError: Unrecognized error code 35 occurred during inference kernel evaluation: b'GPUCheckOk Failure: CUDA driver version is insufficient for CUDA runtime version ldif2mesh.cu 985\n'
What might cause these errors SOS!!!

Segmentation fault when train the net

python train.py --batch_size 24 --experiment_name shapenet-ldif
--model_directory $models --model_type "ldif"
--dataset_directory $dataset
WARNING:tensorflow:Deprecation warnings have been disabled. Set TF_ENABLE_DEPRECATION_WARNINGS=1 to re-enable them.
INFO: Making dataset...
INFO: Optimized dataset detected at ./shapenet/optimized
INFO: Mapping...
INFO: is_invalid vs lower_coords: [24, 32, 1] vs [24, 32, 3]
INFO: Post-where lower_coords: [24, 32, 3]
INFO: is_invalid vs sdf coords: [24, 32, 1] vs [24, 32, 1]
INFO: In-out image summaries have been removed.
INFO: The 0-th GPU has 22390 MB free.
INFO: TensorFlow can use up to 93.1397945511389% of the total GPU memory.
INFO: Initializing variables...
INFO: No previous checkpoint detected, training from scratch.
Fatal Python error: Segmentation fault

Thread 0x00007fd78cff9700 (most recent call first):
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/threading.py", line 302 in wait
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/queue.py", line 170 in get
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/summary/writer/event_file_writer.py", line 159 in run
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/threading.py", line 932 in _bootstrap_inner
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007fd9b5258340 (most recent call first):
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/client/session.py", line 1441 in _call_tf_sessionrun
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/client/session.py", line 1349 in _run_fn
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/client/session.py", line 1365 in _do_call
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/client/session.py", line 1358 in _do_run
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/client/session.py", line 1179 in _run
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/tensorflow_core/python/client/session.py", line 955 in run
File "train.py", line 263 in main
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/absl/app.py", line 258 in _run_main
File "/home/mayo/anaconda3/envs/tf-1.15/lib/python3.8/site-packages/absl/app.py", line 312 in run
File "train.py", line 283 in
./reproduce_shapenet_autoencoder.sh: line 50: 1295263 Segmentation fault (core dumped) python train.py --batch_size 24 --experiment_name shapenet-ldif --model_directory $models --model_type "ldif" --dataset_directory $dataset

I have generated the dataset from raw ShapnetCoreV1/03001627 models, by converting .obj file to .ply and then generating watertight .ply file using gaps tools. After that I used the command in the script named reproduce_shapenet_autoencoder.sh to make dataset, everything done successfully. But when I tried to train the net with the dataset, it failed and got the log showed above.

BTW, the enviroment with my computer: ubuntu20.04 with RTX3090, cuda version = 11.1, and I run the code on tensorflow-1.15.
Could you give me some advice for this issue?
Thank you!

Is it possible to share your preprocessed data and pretrained model of LDIF?

Hi Kyle:

Thanks for your great work and code on Local Deep Implicit Functions for 3D Shape!

I am trying to reproducing your results. However, I noticed that pretrained model checkpoint is on your TODO list. And preprocessed data is not released too.

I'd like to ask if it is possible to share your preprocessed data? Also when is the time to release the pretrained model checkpoint?

Best wishes
Cheng

Error when unit testing

I tried to run unit_test.sh and I got the following output

INFO: Creating directories...
2it [00:00, 6631.31it/s]
INFO: Making dataset...
100%|█████████████████████████████████████████████| 2/2 [00:00<00:00, 56.32it/s]
Program was not compiled with mesa.  Recompile with make mesa.

/home/origin/codes/ldif-master/ldif/scripts/process_mesh_local.sh:行 59: 47657 已放弃               (核心已转储) ${gaps}/scn2img $mesh $dodeca_path $depth_dir -capture_depth_images $mesa -width 224 -height 224
Program was not compiled with mesa.  Recompile with make mesa.

/home/origin/codes/ldif-master/ldif/scripts/process_mesh_local.sh:行 59: 47659 已放弃               (核心已转储) ${gaps}/scn2img $mesh $dodeca_path $depth_dir -capture_depth_images $mesa -width 224 -height 224
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
    r = call_item()
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/parallel.py", line 253, in __call__
    for func, args, kwargs in self.items]
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/parallel.py", line 253, in <listcomp>
    for func, args, kwargs in self.items]
  File "meshes2dataset.py", line 104, in process_one
    f'{dataset_directory}/{split}/{synset}/{name}/', skip_existing, log_level)
  File "/home/origin/codes/ldif-master/ldif/scripts/make_example.py", line 63, in mesh_to_example
    shell=True)
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '/home/origin/codes/ldif-master/ldif/scripts/process_mesh_local.sh /tmp/tmp.CfwvYtBPnT/input_meshes/train/animal/blub.ply /tmp/tmp.CfwvYtBPnT/output_dataset/train/animal/blub/ /home/origin/codes/ldif-master/ldif' returned non-zero exit status 134.
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "meshes2dataset.py", line 203, in <module>
    app.run(main)
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "meshes2dataset.py", line 151, in main
    FLAGS.skip_existing, FLAGS.log_level) for f in tqdm.tqdm(files))
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/parallel.py", line 1042, in __call__
    self.retrieve()
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/parallel.py", line 921, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
    return future.result(timeout=timeout)
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/home/origin/anaconda3/envs/ldif/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
subprocess.CalledProcessError: Command '/home/origin/codes/ldif-master/ldif/scripts/process_mesh_local.sh /tmp/tmp.CfwvYtBPnT/input_meshes/train/animal/blub.ply /tmp/tmp.CfwvYtBPnT/output_dataset/train/animal/blub/ /home/origin/codes/ldif-master/ldif' returned non-zero exit status 134.

Crash on train

I have setup all the dependencies and my dataset generation script ran without any errors. But, when I run train.py, I get a crash. Here's a complete log I am getting :
`python train.py --dataset_directory data/Dataset --experiment_name ldif_default --model_type ldif --model_directory ./trained_models

INFO: Making dataset...
INFO: Mapping...
INFO: In-out image summaries have been removed.
INFO: The 0-th GPU has 11158 MB free.
INFO: TensorFlow can use up to 86.23409213120631% of the total GPU memory.
INFO: Initializing variables...
INFO: No previous checkpoint detected, training from scratch.
ERROR:tensorflow:Session failed to close after 30 seconds. Continuing after this point may leave your program in an undefined state.
E0802 08:03:47.381119 139974498080576 session.py:1637] Session failed to close after 30 seconds. Continuing after this point may leave your program in an undefined state.
Traceback (most recent call last):
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.OutOfRangeError: 2 root error(s) found.
(0) Out of range: End of sequence
[[{{node IteratorGetNext}}]]
(1) Out of range: End of sequence
[[{{node IteratorGetNext}}]]
[[IteratorGetNext/_3]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 275, in
app.run(main)
File "/home/tintash-rnd/.local/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/tintash-rnd/.local/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "train.py", line 256, in main
[model_config.train_op, summary_op, model_config.loss])
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.OutOfRangeError: 2 root error(s) found.
(0) Out of range: End of sequence
[[node IteratorGetNext (defined at /home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
(1) Out of range: End of sequence
[[node IteratorGetNext (defined at /home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
[[IteratorGetNext/_3]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'IteratorGetNext':
File "train.py", line 275, in
app.run(main)
File "/home/tintash-rnd/.local/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/tintash-rnd/.local/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "train.py", line 187, in main
split=FLAGS.split)
File "/mnt/DeepLearningResearch/ldif/ldif/datasets/local_inputs.py", line 137, in make_dataset
dataset_items = tf.compat.v1.data.make_one_shot_iterator(dataset).get_next()
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/data/ops/iterator_ops.py", line 426, in get_next
name=name)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_dataset_ops.py", line 2518, in iterator_get_next
output_shapes=output_shapes, name=name)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
op_def=op_def)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
attrs, op_def, compute_device)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
op_def=op_def)
File "/home/tintash-rnd/miniconda3/envs/ldif/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in init
self._traceback = tf_stack.extract_stack()`

Error in data preprocessing

Hi. Thanks for sharing the code of this nice work!

I try to go through the whole training process following the instruction. I already obtained the watertight meshes using TSDF fusion method provided by occnet, and save all meshes as .ply files.

However, when I run meshes2dataset.py to process those meshes, I get an error like this:

subprocess.CalledProcessError: Command '/home/disk/diske/ldif/ldif/scripts/process_mesh_local.sh dataset/train/02958343/1005ca47e516495512da0dbf3c68e847.ply processed_data/train/02958343/1005ca47e516495512da0dbf3c68e847/ /home/disk/diske/ldif/ldif' returned non-zero exit status 255.

It seems that something went wrong in the .sh file used to generate SDF values and depth images. I am quite confused because there is no other information tells me what causes this error. Hope you can help me.

Really appreciated .

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.