Skip to content

[🐛 bug report] Vertex Positions Loss Backpropagating Incorrectly #348

@nauman-tintash

Description

@nauman-tintash

Summary

When I keep vertex positions buffer as optimization parameters, the loss is apparently being backpropogated incorrectly. Even if I keep the reference image and new image exactly the same, over a few iterations, the vertex positions keep getting updated and the loss keeps increasing.

System configuration

  • Platform: Ubuntu 20.4
  • Compiler: CMAKE 3.16.3
  • Python version: 3.8.5
  • Mitsuba 2 version: mitsuba-2
  • Branch : pathreparam-optix7
  • Compiled variants:
    • scalar_rgb
    • gpu_autodiff_rgb

Description

Even if my source and target scene is exactly the same, if I keep the vertex positions buffer as differentiable parameter, the loss keep getting increased. Following is a sample of losses and corresponding images for the first 4 iterations from one example.

Reference Render:

ref

Iteration 1 : (Loss = 4.21295e-16)
ref

Iteration 2 : (Loss = 0.000416789)
it2

Iteration 3 : (Loss = 0.0170517)
it3

Following is my relevant code snippet :

scene = load_file('bagel/scene.xml')
image_ref = render(scene, spp=2)

params = traverse(scene)
params.keep(['object.vertex_positions_buf'])
opt = Adam(params, lr=.02)

for it in range(iterations):
      image = render(scene, spp=2)
      ob_val = ek.hsum(ek.sqr(image - image_ref)) / len(image)
      ek.backward(ob_val)
      opt.step()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions