diff --git a/LICENSE b/LICENSE index 56e4667..baafa78 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,8 @@ MIT License Copyright (c) 2017 Hiroharu Kato Copyright (c) 2018 Nikos Kolotouros -A PyTorch implementation of Neural 3D Mesh Renderer (https://github.com/hiroharu-kato/neural_renderer) +Copyright (c) 2021 Yida Wang +A PyTorch implementation of Neural 3D Mesh Renderer (https://github.com/wangyida/neural_renderer) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 7211620..4ab21a2 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,19 @@ -# Neural 3D Mesh Renderer (CVPR 2018) +# Neural 3D Mesh Renderer This repo contains a PyTorch implementation of the paper [Neural 3D Mesh Renderer](http://hiroharu-kato.com/projects_en/neural_renderer.html) by Hiroharu Kato, Yoshitaka Ushiku, and Tatsuya Harada. -It is a port of the [original Chainer implementation](https://github.com/hiroharu-kato/neural_renderer) released by the authors. -Currently the API is the same as in the original implementation with some smalls additions (e.g. render using a general 3x4 camera matrix, lens distortion coefficients etc.). However it is possible that it will change in the future. +The renderer is modified from [neural-render](https://github.com/daniilidis-group/neural_renderer) which fits for latest PyTorch with version higher than 1.6. The library is fully functional and it passes all the test cases supplied by the authors of the original library. Detailed documentation will be added in the near future. -## Requirements -Python 2.7+ and PyTorch 0.4.0. -The code has been tested only with PyTorch 0.4.0, there are no guarantees that it is compatible with older versions. -Currently the library has both Python 3 and Python 2 support. +## Requirements +PyTorch 1.6.0+. Currently the library has both Python 3 and Python 2 support. **Note**: In some newer PyTorch versions you might see some compilation errors involving AT_ASSERT. In these cases you can use the version of the code that is in the branch *at_assert_fix*. These changes will be merged into master in the near future. ## Installation You can install the package by running ``` -pip install neural_renderer_pytorch +pip3 install neural_renderer_pytorch ``` Since running install.py requires PyTorch, make sure to install PyTorch before running the above command. ## Running examples diff --git a/neural_renderer/__init__.py b/neural_renderer/__init__.py index b66896f..43860c6 100644 --- a/neural_renderer/__init__.py +++ b/neural_renderer/__init__.py @@ -11,5 +11,5 @@ from .save_obj import save_obj from .vertices_to_faces import vertices_to_faces -__version__ = '1.1.3' +__version__ = '1.1.4' name = 'neural_renderer_pytorch' diff --git a/neural_renderer/cuda/create_texture_image_cuda.cpp b/neural_renderer/cuda/create_texture_image_cuda.cpp index c2c449d..006976d 100644 --- a/neural_renderer/cuda/create_texture_image_cuda.cpp +++ b/neural_renderer/cuda/create_texture_image_cuda.cpp @@ -10,6 +10,10 @@ at::Tensor create_texture_image_cuda( // C++ interface +#ifndef AT_CHECK +#define AT_CHECK TORCH_CHECK +#endif + #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor") #define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x " must be contiguous") #define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x) diff --git a/neural_renderer/cuda/load_textures_cuda.cpp b/neural_renderer/cuda/load_textures_cuda.cpp index 8cb99bc..a44a682 100644 --- a/neural_renderer/cuda/load_textures_cuda.cpp +++ b/neural_renderer/cuda/load_textures_cuda.cpp @@ -12,6 +12,10 @@ at::Tensor load_textures_cuda( // C++ interface +#ifndef AT_CHECK +#define AT_CHECK TORCH_CHECK +#endif + #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor") #define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x " must be contiguous") #define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x) diff --git a/neural_renderer/cuda/rasterize_cuda.cpp b/neural_renderer/cuda/rasterize_cuda.cpp index ce7a3e5..aabe478 100644 --- a/neural_renderer/cuda/rasterize_cuda.cpp +++ b/neural_renderer/cuda/rasterize_cuda.cpp @@ -63,6 +63,10 @@ at::Tensor backward_depth_map_cuda( // C++ interface +#ifndef AT_CHECK +#define AT_CHECK TORCH_CHECK +#endif + #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor") #define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x " must be contiguous") #define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x) diff --git a/setup.py b/setup.py index 75a796b..2b26cc0 100644 --- a/setup.py +++ b/setup.py @@ -28,10 +28,10 @@ def test_all(): setup( description='PyTorch implementation of "A 3D mesh renderer for neural networks"', - author='Nikolaos Kolotouros', - author_email='nkolot@seas.upenn.edu', + author='Yida Wang', + author_email='yida.wang@tum.de', license='MIT License', - version='1.1.3', + version='1.1.4', name='neural_renderer_pytorch', test_suite='setup.test_all', packages=['neural_renderer', 'neural_renderer.cuda'],