thibaultgroueix / 3d-coded Goto Github PK
View Code? Open in Web Editor NEWPytorch Implementation for the project : `3D-CODED` and `Learning Elementary Structure`
Home Page: http://imagine.enpc.fr/~groueixt/3D-CODED/index.html
Pytorch Implementation for the project : `3D-CODED` and `Learning Elementary Structure`
Home Page: http://imagine.enpc.fr/~groueixt/3D-CODED/index.html
Hello,
From the data/generate_data_animals.py
I can generate dogs, cows, cats and hippos. However, I would like to generate other categories such as horses - using the SMALL-R dataset you've mentioned in the paper. Can you please help with generating them?
Thanks
I want to change template model, where do I need to change, and do I need to retrain the model after change template
Hi
I was trying to run model training command "python ./training/train.py ",it reports:
python ./training/train.py
Used fix seed
Random Seed: 1
WARNING:root:Setting up a new session...
creating folder log/02019-10-03T11:24:32.317276
PARAMETER:
batch_size : 32
workers : 10
nepoch : 100
start_epoch : 0
randomize : False
lrate : 0.001
lr_decay_1 : 80
lr_decay_2 : 90
number_points : 2500
faust : INTER
id : 0
env : CODED
display : True
port : 8889
dir_name : log/02019-10-03T11:24:32.317276
dataset_path : ./export/
model :
point_translation : False
dim_template : 3
patch_deformation : False
dim_out_patch : 3
start_from : TEMPLATE
accelerated_chamfer : True
HR : True
LR_input : True
reg_num_steps : 3000
inputA : data/example_0.ply
inputB : data/example_1.ply
num_angles : 100
clean : True
scale : True
project_on_target : False
date : 2019-10-03 11:24:32.317268
logname : log/02019-10-03T11:24:32.317276/log.txt
checkpointname : log/02019-10-03T11:24:32.317276/optimizer_last.pth
reload : False
git repo path : https://github.com/ThibaultGROUEIX/3D-CODED/commit/
Ellapsed time to load dataset: 129.85412502288818
num_vertices 6890
Ellapsed time to load dataset: 0.11727118492126465
num_vertices 6890
num_vertices 6890
Using template to initialize template
bottleneck_size 1027
Traceback (most recent call last):
File "./training/train.py", line 24, in <module>
trainer.train_epoch()
File "/media/lab601/000555B8000E726C/wuy/3D-CODED/training/trainer.py", line 114, in train_epoch
iterator = self.dataloader_train.__iter__()
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in __iter__
return _DataLoaderIter(self)
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 560, in __init__
w.start()
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/multiprocessing/process.py", line 112, in start
self._popen = self._Popen(self)
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/multiprocessing/context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/multiprocessing/context.py", line 277, in _Popen
return Popen(process_obj)
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/multiprocessing/popen_fork.py", line 20, in __init__
self._launch(process_obj)
File "/home/lab601/anaconda2/envs/pytorch-3D-CODED/lib/python3.7/multiprocessing/popen_fork.py", line 70, in _launch
self.pid = os.fork()
OSError: [Errno 12] Cannot allocate memory
I see the code,and find the problem is in dataset.py
_if self.train:
self.datas = torch.load("./data/datas_surreal_train.pth")
else:
self.datas = torch.load("./data/datas_surreal_test.pth")_
The size of file "datas_surreal_train.pth" is 18G,but my computor's GPU memory size is 11G.How can I solve this problem?
Dear professor,
Recently, I have been Interested in your papers,and I have some questions. Questions are as follows,
Hi Thibault,
Can you share the code for calculating the average Euclidean error on SCAPE dataset? Thanks!
Hi Thibault,
This work is excellent. I try to adopt unsupervised training, but I don't know what is network.mesh while training. Which MESH should I use for initialization? Could you provide something about it? thank you very much
Best regards,
is the data download by download_dataset.sh preprocessed?
Hi
I have downloaded the latest code,run script.py and found that the result "XXXFinalReconstruction.ply" is a two-dimensional image rather than a three-dimensional image.This result is different from that of the code version in August,which result "XXXFinalReconstruction.ply" is a three-dimensional image.
Howdy!
Setup : windows10 running ubuntu 16.04
all prior dependencies have been installed but running python in ubuntu inference/correspondences.py
yields error . Any idea as to what is happening or solutions would be greatly appreciated
Thanks in advance.
WARNING:root:Setting up a new session...
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=51 error=30 : unknown error
Traceback (most recent call last):
File "inference/correspondences.py", line 85, in
global_variables.network = AE_AtlasNet_Humans(num_points=opt.num_points)
File "./auxiliary/model.py", line 134, in init
self.vertex = torch.from_numpy(point_set).cuda().float()
File "/home/user/venv/lib/python3.5/site-packages/torch/cuda/init.py", line 163, in _lazy_init
torch._C._cuda_init()
RuntimeError: cuda runtime error (30) : unknown error at /pytorch/aten/src/THC/THCGeneral.cpp:51
The trained model seems to have failed. Can you share again?
Thanks for your jobs. The README file is detailed。
However, in generate_data_human.py, there exist one file I can't find.
mesh_ref = pymesh.load_mesh("/home/thibault/Downloads/MPI-FAUST/training/ref/reg_color_ref.ply")
I have download MPI-FAUST dataset, but the sub-directory [training] has no directory named [ref].
Also, it seems that the MPI-FAUST dataset you used is different from what I download from the website. Do you sure that you download the FAUST dataset from http://faust.is.tue.mpg.de/challenge/Inter-subject_challenge . And you have no further process?
I tried to run the demo using:
python inference/correspondences.py --dir_name learning_elementary_structure_trained_models/1patch_deformation
It downloaded the models successfully but when the network forward
, there is an error:
start regression...
Initial Loss: 0.0002441386750433594
[: 2999/3000] reg loss: 9.243113163392991e-05Traceback (most recent call last):
File "inference/correspondences.py", line 408, in <module>
inf.forward(opt.inputA, opt.inputB)
File "inference/correspondences.py", line 120, in forward
self.reconstruct(inputA)
File "inference/correspondences.py", line 369, in reconstruct
mesh, meshReg = self.run(input, scalefactor, input_p)
File "inference/correspondences.py", line 315, in run
pointsReconstructed1 = self.regress(input_network)
File "inference/correspondences.py", line 180, in regress
pointsReconstructed = self.network.decode_full(input_param) # forward pass
File "./auxiliary/model.py", line 243, in decode_full
rand_grid = self.template[0].template_learned_HR[batch * i:batch * (i + 1)].view(x.size(0), batch,self.dim_template).transpose(1,2).contiguous()
AttributeError: 'GetTemplate' object has no attribute 'template_learned_HR'
I didn't modify the codes and just follow the instructions.
When I went deep to see the codes, I found that self.template
is indeed a GetTemplate
object, in line 178 of auxiliary/model.py:
self.template = [GetTemplate(start_from, dataset_train)]
And it seems that GetTemplate
class indeed doesn't have the attribute template_learned_HR
.
I wonder how to fix this. Did I miss something? Thank you very much.
Hi Thibault,
first of all, thank you for sharing your code with the community.
I have some issues with downloading the data. From what I can gather,there is an issue with authorization. The test data is downloaded, whilst the train data gets an "403: Forbidden" error. I attached a screenshot of the error. Maybe you have some knowledge as to why this is happening.
Also, can I ask you why did you save the data in a .pth format? This way, the data needs to be loaded all at once, which can be infeasible for some.
Thank you in advance for your response.
Hi,
I am trying to build and run the code. However, during building chamfer distance python build.py
, my compilers complain about
Including CUDA code.
/home/zhjiang/Workspace/3D-CODED/nndistance
generating /tmp/tmpXnfonZ/_my_lib.c
setting the current directory to '/tmp/tmpXnfonZ'
running build_ext
building '_my_lib' extension
creating home
creating home/zhjiang
creating home/zhjiang/Workspace
creating home/zhjiang/Workspace/3D-CODED
creating home/zhjiang/Workspace/3D-CODED/nndistance
creating home/zhjiang/Workspace/3D-CODED/nndistance/src
gcc -pthread -B /home/zhjiang/anaconda3/envs/py2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/zhjiang/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include -I/home/zhjiang/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/zhjiang/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/zhjiang/anaconda3/envs/py2/include/python2.7 -c _my_lib.c -o ./_my_lib.o
In file included from /home/zhjiang/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC/THCBlas.h:5:0,
from /home/zhjiang/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC/THC.h:6,
from _my_lib.c:493:
/home/zhjiang/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC/THCHalf.h:16:49: error: unknown type name 'half'
THC_EXTERNC void THCFloat2Half(THCState *state, half *out, float *in, ptrdiff_t len);
I think there might be some version issues here, but I fail to find a solution.
My gcc is 5.5.0, pytorch=0.1.12_2, python=2.7
Any help would be appreciated!
Best,
Zhongshi
Hi, and thanks for sharing a PyTorch implementation of Chamfer loss.
However, I find the returned value from calling distChamfer(points1, points2)
to be surprisingly low when both points1
and points2
are two arbitrary batches of point clouds with dimension [B,N,3] where B is the batch size and N is the number of points.
I found sklearn and numpy implementations of Chamfer Distance in this stackoverflow-response (https://stackoverflow.com/questions/47060685/chamfer-distance-between-two-point-clouds-in-tensorflow).
With points1 and points2 having dimensions [32,1024,3] I typically get a loss of ~0.07 with the PyTorch implementation using
dist1, dist2 = distChamfer(points1, points2)
loss = (torch.mean(dist1)) + (torch.mean(dist2))
while both the sklearn and numpy implementations linked to above give a loss of ~0.3.
Could you point me in the right direction in how to correctly use the provided Chamfer loss implementation?
Could it potentially be a bug?
Hi,
Can you share the code for calculating the geodesic error maps (Fig. 5)? Thanks.
Hello! After running the python inference/correspondences.py --dir_name learning_elementary_structure_trained_models/1patch_deformation
using the provided trained model and the example meshes, I got a folder named results
which contains two files: correspondences.ply
and correspondences.txt
. I was expecting to get pairs of points {(q_r, q_t)}, however we just get a list of point coordinates (in total 177638 points). I am not sure how to interpret these results and how to get the colored meshes as in the readme file.
Thank you for your great work!
and cloud.enpc.fr maybe unstable, download_template.sh always return unavailable, could you give another download address? thank you!
Hello,
It's a great job. However, I encountered a problem when using 3D-CODED(from tag v2.0.0 ) to train unsupervised model. I can't get the same ideal result as in the paper. Could you provide your trained model? It will be very helpful to me, look forward to your reply.
Best
hi Hello, when I run the code, I have the following problem, the folder contains this cpp file but this error is reported
Traceback (most recent call last):
File "/share/home/xxx/workspacce/xx/3dco/training/train.py", line 9, in
import script as script
File "./inference/script.py", line 12, in
import inference.correspondences as correspondences
File "./inference/correspondences.py", line 16, in
import extension.dist_chamfer as ext
File "./extension/dist_chamfer.py", line 10, in
sources=["chamfer_cuda.cpp","chamfer.cu"])
File "/share/home/xxx/.local/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1091, in load
keep_intermediates=keep_intermediates)
File "/share/home/xxx/.local/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1269, in _jit_compile
is_standalone=is_standalone,
File "/share/home/xxx/.local/lib/python3.7/site-packages/torch/utils/_cpp_extension_versioner.py", line 45, in bump_version_if_changed
hash_value = hash_source_files(hash_value, source_files)
File "/share/home/xxxi/.local/lib/python3.7/site-packages/torch/utils/_cpp_extension_versioner.py", line 15, in hash_source_files
with open(filename) as file:
FileNotFoundError: [Errno 2] No such file or directory: 'chamfer_cuda.cpp'
job end time is Fri Nov 26 17:32:50 CST 2021
Dear professor,
I want to use the VAE of convolution operation to reconstruct the model to get better correspondence. Can you give me some suggestions. Thank you very much.
best
Hi,
Thank you for the publishing your code with extensive documentation.
I have a small query, when I run ./data/download_dataset.sh
, datas_surreal_test.pth
and data_surreal_train.pth
are downloaded. However, the download is incomplete which leads to the following unpickling error.
Traceback (most recent call last):
File "", line 1, in
File "/home/vision/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/serialization.py", line 368, in load
return _load(f, map_location, pickle_module)
File "/home/vision/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/serialization.py", line 532, in _load
magic_number = pickle_module.load(f)
_pickle.UnpicklingError: invalid load key, '<'.
I would be grateful if you could provide some guidance on how to resolve the same.
Thanks for sharing the code.
I'm using the latest trimesh 2.36.28. The line 58 (trimesh.io.export.export_mesh(mesh, "results/correspondences.ply")
) in "/inference/correspondences.py" should be modified to mesh.export("results/correspondences.ply")
so as to make the program run smoothly.
trimesh.io module doesn't exist in 2.36.28.
Hi,
During training, when it runs on validation dataset, it does network.eval()
. However, I found that whenever it turns to eval mode, the mode predicts [2, -2, 2]
. And when it stays in train mode, prediction works fine. Did you run into this problem before? Thanks!
I am using default batch size 32 because it seems only layer that will be affected by eval
is BatchNorm
which is related to batch size.
Hi,I'm coming again,I want to train the unsupervision model,but I get an error like this
Traceback (most recent call last):
File "unsup_legacy/train_unsup.py", line 85, in
faces = network.mesh.faces
File "/home/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/nn/modules/module.py", line 535, in getattr
type(self).name, name))
AttributeError: 'AE_AtlasNet_Humans' object has no attribute 'mesh'
how can I do for it
Thanke you!
is the data download by download_dataset.sh preprocessed?
First of all, thank you for this wonderful work!
I'm training a batch now, about six minutes,
How long does it take you to train? My GPU usage rate is only 22%.
Is there any way to improve your training speed? Thank you very much. All the best
Hello Dear @ThibaultGROUEIX professor:
when i am training the code i got the error as the picture,but i can training 1 epoch in the morning ,but when i traing again in the afternoon i got the error, i used training successfully in the january, how should i do ?Thank you
I tested the code and met the flipped reconstruction. According to the readme:
"Sometimes the reconstruction is flipped, which break the correspondences. In the easiest case where you meshes are registered in the same orientation, you can just fix this angle in reconstruct.py line 86, to avoid the flipping problem. Also note from this line that the angle search only looks in [-90°,+90°]."
However, it seems that there is no reconstruct.py
in this master repo. I wonder how to solve the filpped reconstruction problem. Thank you very much.
Hi,
I need to align the trunk axis to the Y axis when processing the dataset, so what should I do? Can you give me some advice?
Thanks,
According to the paper, "The error is the average Euclidean distance between the estimated projection and the ground-truth projection.". How exactly is it computed and is it done somewhere in the code? Is it also averaged for all the given pairs of shapes?
When executing: python setup.py install, after
'gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -m64 -fPIC -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -m64 -fPIC -fPIC ... -c chamfer_cuda.cpp -o build/temp.linux-x86_64-3.7/chamfer_cuda.o -DTORCH_EXTENSION_NAME=chamfer -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11'
I meet lots of errors like "/usr/include/c++/6/tuple:483:67: error: mismatched argument pack lengths while expanding ‘std::is_constructible".
My environment is
Could you kindly help me out? or what''s your cuda and gcc version?
Thank you.
More errors are like these:
/home/jack/miniconda3/envs/py37/lib/python3.7/site-packages/torch/lib/include/ATen/TensorMethods.h:646:36: required from here /usr/include/c++/6/tuple:483:67: error: mismatched argument pack lengths while expanding ‘std::is_constructible<_Elements, _UElements&&>’ return __and_<is_constructible<_Elements, _UElements&&>...>::value; ^~~~~ /usr/include/c++/6/tuple:484:1: error: body of constexpr function ‘static constexpr bool std::_TC<<anonymous>, _Elements>::_MoveConstructibleTuple() [with _UElements = {std::tuple<at::Tensor, at::Tensor, at::Tensor>}; bool <anonymous> = true; _Elements = {at::Tensor, at::Tensor, at::Tensor}]’ not a return-statement } ^ /usr/include/c++/6/tuple: In instantiation of ‘static constexpr bool std::_TC<<anonymous>, _Elements>::_ImplicitlyMoveConvertibleTuple() [with _UElements = {std::tuple<at::Tensor, at::Tensor, at::Tensor>}; bool <anonymous> = true; _Elements = {at::Tensor, at::Tensor, at::Tensor}]’: /usr/include/c++/6/tuple:626:362: required by substitution of ‘template<class ... _UElements, typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), at::Tensor, at::Tensor, at::Tensor>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (3ul >= 1)), bool>::type <anonymous> > constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {std::tuple<at::Tensor, at::Tensor, at::Tensor>}; typename std::enable_if<(((std::_TC<(sizeof... (_UElements) == 1), at::Tensor, at::Tensor, at::Tensor>::_NotSameTuple<_UElements ...>() && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_MoveConstructibleTuple<_UElements ...>()) && std::_TC<(1ul == sizeof... (_UElements)), at::Tensor, at::Tensor, at::Tensor>::_ImplicitlyMoveConvertibleTuple<_UElements ...>()) && (3ul >= 1)), bool>::type <anonymous> = <missing>]’ /home/jack/miniconda3/envs/py37/lib/python3.7/site-packages/torch/lib/include/ATen/TensorMethods.h:646:36: required from here /usr/include/c++/6/tuple:489:65: error: mismatched argument pack lengths while expanding ‘std::is_convertible<_UElements&&, _Elements>’ return __and_<is_convertible<_UElements&&, _Elements>...>::value;
In the paper it says that "As an alternative, we tried to learn a network directly invariant to rotations around the vertical axis."
I was wondering how was this done?
Thanks for sharing this great work.
I am trying to train the supervised model but it seems not to converge. Generated shapes are scaled down too much, as in this image:
I modified the data generation process to use trimesh for loading/saving. To me, the generated scans look similar to the template in orientation and scale (see image above).
However, I only generated half of the suggested dataset size (115000 meshes instead of 230000). Would this be an issue?
Any other hint?
Hi!
I would like to try something new using your code for unsupervised training, but currently cannot find network.mesh while training.
Could you provide something about how to use it? It will be very helpful to me, look forward to your reply.
Best~
Hello!
I've been trying to setup the repository but keep failing in getting the chamfer_distance to work. I set up an anaconda environment as instructed and my system CUDA has version 10.1 and GCC 9.3.0.
Some more of my system specs:
When loading the chamfer_distance cpp_extension the following error occurs:
Traceback (most recent call last):
File "inference/correspondences.py", line 18, in <module>
import dist_chamfer as ext
File "./extension/dist_chamfer.py", line 11, in <module>
"/<path>/3D-CODED/extension/chamfer.cu"])
File "/<path>/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 645, in load
is_python_module)
File "<path>/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 825, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "/<path>/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 968, in _import_module_from_library
return imp.load_module(module_name, file, path, description)
File "/<path>/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/<path>/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /<path>/anaconda3/envs/pytorch-3D-CODED/lib/python3.7/site-packages/torch/../../../libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /tmp/torch_extensions/chamfer/chamfer.so)
(pytorch-3D-CODED)
Could you please advise me on how I could solve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.