Optimization

Optimization

One of the primary use cases of RayTracer.jl is to solve the Inverse Rendering Problem. In this problem, we try to predict the 3D scene given a 2D image of it. Since, "truly" solving this problem is very difficult, we focus on a subproblem where we assume that we have partial knowledge of the 3D scene and now using this image we need to figure out the correct remaining parameters. We do this by iteratively optimizing the parameters using the gradients obtained with the Differentiation API.

We describe the current API for optimizing these parameters below.

Documentation

RayTracer.update!Method.
update!(opt, x, Δ)

Provides an interface to use all of the Optimizers provided by Flux. The type of x can be anything as long as the operations defined by @diffops are available for it. By default all the differentiable types inside the Package can be used with it.

The type of Δ must be same as that of x. This prevent silent type conversion of x which can significantly slow doen the raytracer.

Example:

julia> opt = ADAM()

julia> gs = gradient(loss_function, θ)

julia> update!(opt, θ, gs[1])
source