Package: gendr
GenDR - The Generalized Differentiable RendererOfficial implementation for our CVPR 2022 Paper "GenDR: A Generalized Differentiable Renderer".Paper @ArXiv,
Video @Youtube.💻 Installationgendrcan be installed via pip from PyPI withpipinstallgendr⚠️ Note thatgendrrequires CUDA, the CUDA Toolkit (for compilation), andtorch>=1.9.0(matching the CUDA version).Alternatively, GenDR may be installed from source, e.g., in a virtual environment likevirtualenv-ppython3.env1
..env1/bin/activate
pipinstalltorch==1.9.0+cu111torchvision==0.10.0+cu111-fhttps://download.pytorch.org/whl/torch_stable.html
pipinstall.Make sure that the CUDA version of PyTorch (e.g.,cu111for CUDA 11.1) matches the locally installed version.
However, on some machines, compiling works only with specific subversions that may be unequal to the local subversion,
so a potential quick fix is trying different PyTorch version and CUDA subversion combinations.👩‍💻 DocumentationA differentiable renderer may be defined as followsimportgendrdiff_renderer=gendr.GenDR(image_size=256,dist_func='uniform',dist_scale=0.01,dist_squared=False,aggr_alpha_func='probabilistic',aggr_rgb_func='hard',)In the following, we provide the entire set of arguments ofGenDR.
The most important parameters are marked inbold.
For the essential parametersdist_funcandaggr_alpha_func, we give a set of options.
For a reference, seethe paper.image_sizethe size of the rendered image(default: 256)background_color(default: [0, 0, 0])anti_aliasingrender it at 2x the resolution and average to reduce aliasing (default: False)dist_functhe distribution used for the differentiable occlusion test(default: uniform)hardhard, non-differentiable rendering, Dirac delta distribution, Heaviside function (aliasheaviside)uniformuniform distributioncubic_hermiteCubic-Hermite sigmoid functionwigner_semicircleWigner Semicircle distributiongaussianGaussian DistributionlaplaceLaplace Distributionlogisticlogistic DistributiongudermannianGudermannian function, hyperbolic secant distribution (aliashyperbolic_secant)cauchyCauchy distributionreciprocalreciprocal sigmoid functiongumbel_maxGumbel-max distributiongumbel_minGumbel-min distributionexponentialexponential distributionexponential_revexponential distribution (reversed / mirrored)gammagamma distributiongamma_revgamma distribution (reversed / mirrored)levyLevy distributionlevy_revLevy distribution (reversed / mirrored)dist_scalethe scale parameter of the distribution, tau in the paper(default: 1e-2)dist_squaredoptionally, use the square-root distribution ofdist_func(default: False)dist_shapefor some distributions, we need a shape parameter (default: None)dist_shiftfor some distributions, we need an optional shift parameter (default: None or 0)dist_epspixels further away thandist_scale*dist_epsare ignored for performance reasons (default: 1e4)aggr_alpha_functhe t-conorm used to aggregate occlusion values(default: probabilistic)hardto be used withdist_func='hard'maxmaximum T-conormprobabilisticprobabilistic T-conormeinsteinEinstein sum T-conormhamacherHamacher T-conormfrankFrank T-conormyagerYager T-conormaczel_alsinaAczel-Alsina T-conormdombiDombi T-conormschweizer_sklarSchweizer-Sklar T-conormaggr_alpha_t_conorm_pfor some t-conorms, we need a shape parameter (default: None)aggr_rgb_func(default: softmax)aggr_rgb_eps(default: 1e-3)aggr_rgb_gamma(default: 1e-3)nearvalue for the viewing frustum (default: 1)farvalue for the viewing frustum (default: 100)double_siderender all faces from both sides (default: False)texture_typetype of texture sampling (default: surface; options: surface, vertex)🧪 Experiments🐼 Shape Optimization (opt_shape.py)pythonexperiments/opt_shape.py-sq--gif📽 Camera Pose Optimization (opt_camera.py)pythonexperiments/opt_camera.py-sq--gif✈️ Single-View 3D Reconstruction (train_reconstruction.py)Optimal default parameters for--dist_scaleare automatically used in the script for the set of distributions
and t-conorms that are benchmarked on this task in the paper.pythonexperiments/train_reconstruction.py--distributionuniform--t_conormprobabilistic📖 Citing@inproceedings{petersen2022gendr,title={{GenDR: A Generalized Differentiable Renderer}},author={Petersen, Felix and Goldluecke, Bastian and Borgelt, Christian and Deussen, Oliver},booktitle={IEEE/CVF International Conference on Computer Vision and Pattern Recognition (CVPR)},year={2022}}Licensegendris released under the MIT license. SeeLICENSEfor additional details about it.