GithubHelp home page GithubHelp logo

edgar-tr / patchnets Goto Github PK

View Code? Open in Web Editor NEW
22.0 1.0 5.0 1.14 MB

Open source repository for the code accompanying the paper 'PatchNets: Patch-Based Generalizable Deep Implicit 3D Shape Representations'.

License: MIT License

Python 88.01% C++ 11.99%

patchnets'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

Watchers

 avatar

patchnets's Issues

the preprocessed data does’nt has attribute [pos_normals] or [neg_normals]

I tried to set [use_precomputed]=false but error still happened cause of :

if sdf_samples_with_normals is None:
    if use_precomputed_init:
        return torch.from_numpy(np.load(initialization_file))  
    else:
        npz = np.load(sdf_filename)
        pos_tensor = deep_sdf.data.remove_nans(torch.from_numpy(np.concatenate([npz["pos"], npz["pos_normals"]], axis=1))).numpy()
        neg_tensor = deep_sdf.data.remove_nans(torch.from_numpy(np.concatenate([npz["neg"], npz["neg_normals"]], axis=1))).numpy()

#----------

import numpy as np
cat=np.load('/user-data/patchnets-master/code/data/SdfSamples/ShapeNetV2/02691156/1a29042e20ab6f005e9e2656aff7dd5b.npz')
cat.files
['pos', 'neg']

How to configure the environment?

Hi, thanks for your work.

I want to reproduce this code on my machine, but I find no python environment dependency files in this repo, like environment.yml or requirements.txt. So I wonder how to prepare a satisfied environment? I can not find these files in the repo of DeepSDF either.

Another question is that how to configure the dataset? Which dataset I need to download and where should I put them in order to train the network by my own?

how to get gradient of input xyz

I wanted to get grad of input xyz,but function returned None,and requires_grad=True/certain_grad doesnot work.Is it because the input of network concate x and xyz?
def patch_network_forward(self, input,):
xyz = input[:, -original_coordinate_size:]
...,
for layer in range(0, self.num_layers - 1):
lin = getattr(self, "patch_lin" + str(layer))
if layer in self.latent_in:
x = torch.cat([x, input], 1)
elif layer != 0 and self.xyz_in_all:
x = torch.cat([x, xyz], 1)
x = lin(x)
if layer < self.num_layers - 2:
if (
self.norm_layers is not None
and layer in self.norm_layers
and not self.weight_norm
):
bn = getattr(self, "patch_bn" + str(layer))
x = bn(x)
#x = self.softplus(x)
x = self.relu(x)
#x = self.elu(x)
if self.dropout is not None and layer in self.dropout:
x = F.dropout(x, p=self.dropout_prob, training=self.training)

Pretrained model request

Hello,

Thank you for releasing this amazing work, by the way, could you kindly release your pretrained model so others can evaluate your method rather than training from scratch?

Best.

errors when evaluating

Hi,
an error happened when I tried to use evaluate_patch_network_metrics() on useful_scripts.py
File "useful_scripts.py", line 1702, in main
evaluate_patch_network_metrics()
File "useful_scripts.py", line 1141, in evaluate_patch_network_metrics
visualize_mixture(results_folder=results_folder, grid_resolution=grid_resolution, mesh_files=evaluate_json, data_source=data_source, break_if_latent_does_not_exist=True, output_name=regressed_meshes_folder,checkpoints=3)
File "useful_scripts.py", line 55, in visualize_mixture
network, patch_latent_size, mixture_latent_size, load_weights_into_network, sdf_to_latent, patch_forward, latent_to_mesh, get_training_latent_vectors, specs = _setup_torch_network(results_folder,checkpoint=checkpoints)
File "useful_scripts.py", line 135, in _setup_torch_network
network = Network(patch_latent_size=patch_latent_size,
File "/root/autodl-tmp/patchnets_neuralpull/code/networks/deep_sdf_decoder.py", line 357, in init
self._init_patch_network_training(train_patch_network, patch_network_pretrained_path, results_folder)
File "/root/autodl-tmp/patchnets_neuralpull/code/networks/deep_sdf_decoder.py", line 404, in _init_patch_network_training
self.load_state_dict(current_weights)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1223, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Decoder:
size mismatch for patch_lin0.weight_v: copying a param with shape torch.Size([128, 35]) from checkpoint, the shape in current model is torch.Size([128, 131]).
size mismatch for patch_lin3.bias: copying a param with shape torch.Size([224]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for patch_lin3.weight_g: copying a param with shape torch.Size([224, 1]) from checkpoint, the shape in current model is torch.Size([128, 1]).
size mismatch for patch_lin3.weight_v: copying a param with shape torch.Size([224, 128]) from checkpoint, the shape in current model is torch.Size([128, 128]).

I am confusued .The network recorded between specs train.json and test.json are identical. How to fix it?

Some objects cannot be evaluated

I noticed that some .obj files of ShapeNetV2 cannot be correctly evaluateed. They can be generated when [generate_meshes = True] on useful_scripts.py ,but an error will happen when evaluate_patch_network_metrics runs again with [generate_meshes = False]

Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/root/miniconda3/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "useful_scripts.py", line 1101, in _evaluate_object
iou = intersection_over_union(groundtruth_mesh_file, regressed_trimesh)
File "useful_scripts.py", line 1028, in intersection_over_union
watertight_result = precompute_iou_on_watertight(groundtruth_mesh_file, num_points=num_points) # num_points x 4 (x,y,z, 1.0f if inside else 0.0f)
File "useful_scripts.py", line 1013, in precompute_iou_on_watertight
max_bb, min_bb = _get_bounding_box(groundtruth_trimesh.vertices)
AttributeError: 'Scene' object has no attribute 'vertices'

Is it because these objects are nor water-tight? And how to fix it?

Pre-trained network

Hello, thanks to your amazing work!

Should I get pre-trained weights for skipping training and directly conducting evaluation?

How to get initialize_mixture_latent_vector?

initialization_file = sdf_filename + "init" + str(patch_latent_size) + "" + str(num_patches) + "" + str(surface_sdf_threshold) + "_" + str(final_scaling_increase_factor) + ("_tiny" if use_tiny_patchnet else "") + ".npy"

but there's no such file or directory: 'datasets/shapenet_v2/preprocessed/SdfSamples/ShapeNetV2/04554684/1a23fdbb1b6d4c53902c0a1a69e25bd9.npz_init_128_30_0.02_1.2.npy'
(only have 1a23fdbb1b6d4c53902c0a1a69e25bd9.npz)

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.