Closed ZheningHuang closed 2 months ago
Hello @ZheningHuang,
dr.select()
is effectively a step function, which is discontinuous and therefore not differentiable. So the error "the argument does not depend on the input variable(s) being differentiated" is the expected result.
I think you will first need to think about a differentiable formulation of your problem (maybe taking inspiration from what is done in PyTorch3D), and then implement it in Mitsuba.
Summary
Rendering a binary image or converting a rendered image to a binary format while preserving differentiability.
System Configuration
System information:
Description
I have been following this notebook on object pose estimation. My goal is to use a real image as the reference but with a binary mask for guidance. In PyTorch3D, this can be done using the
SoftSilhouetteShader
to render a binary image. However, I couldn’t find a similar function in Mitsuba/Dr.Jit, so I tried converting the rendered image (TensorXf) into a binary image manually. Unfortunately, my approach seems to break differentiability. Below is the code I used:This function is used in the optimization loop:
Error
I encounter the following error when running the code:
I think this should not be a challenge issue, any advice would be helpful.