Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion neural_renderer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
4 changes: 4 additions & 0 deletions neural_renderer/cuda/create_texture_image_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions neural_renderer/cuda/load_textures_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions neural_renderer/cuda/rasterize_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def test_all():

setup(
description='PyTorch implementation of "A 3D mesh renderer for neural networks"',
author='Nikolaos Kolotouros',
author_email='[email protected]',
author='Yida Wang',
author_email='[email protected]',
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'],
Expand Down