Skip to content

Navigation Menu

Sign in
Sign up

Is there a way to use priors for estimated parameters? #277

Answered by jeertmans
ogencoglu asked this question in Q&A
Discussion options

First of all thank you for this work!

I would like to understand first if my use case can be solved with DiffeRT. Use case is to model very large indoor scenes (2D) for WiFi propagation.
I have:

  • WiFi strength measurements and their coordinates (X, Y). They might cover only part of the scene.
  • Walls represented as line segments meaning their endpoint coordinates (X, Y). Number of walls can be couple of thousands.

I do not have:

  • transmitter locations
  • transmitter power
  • wall properties, types, materials, attenuation coefficients etc.

Goal is to have a fast wifi strength prediction simply by giving 4 input features: transmitter coords and the coords of the predicted location.

To my understanding differentiable ray tracing can estimate the parameters that I do not have that will minimize some loss (let's say MSE) based on ray tracing i.e., reflections and diffractions (diffractions matter more in this use case).

Can I incorporate prior probabilities to the parameters that are unknown and being estimated? Surely I have some info and constraints on what transmit power or wall attenuations can be. Can you roughly outline the functions and methods to model this problem in your library?

You must be logged in to vote

Hi @ogencoglu, your question actually reminds me of a recent paper I read, RayLoc: Wireless Indoor Localization via Fully Differentiable Ray-tracing, but also of a Master Thesis subject I am supervising, Wireless indoor source localization
as an inverse problem
, that uses DiffeRT to perform all the simulations.

To start, I suggest that you simplify the task a bit, by assuming a received power that decreases with respect to the inverse squared length of the path, and a single, constant reflection coefficient (in practice, it depends on the angle of reflection).

Here is the pseudocode:

scene = TriangleScene(receivers=..., mesh=...)
def power_at_rxs(tx_positions: Float[Array, "num_tx 3"], t...

Replies: 2 comments 5 replies

Comment options

Hi @ogencoglu, your question actually reminds me of a recent paper I read, RayLoc: Wireless Indoor Localization via Fully Differentiable Ray-tracing, but also of a Master Thesis subject I am supervising, Wireless indoor source localization
as an inverse problem
, that uses DiffeRT to perform all the simulations.

To start, I suggest that you simplify the task a bit, by assuming a received power that decreases with respect to the inverse squared length of the path, and a single, constant reflection coefficient (in practice, it depends on the angle of reflection).

Here is the pseudocode:

scene = TriangleScene(receivers=..., mesh=...)
def power_at_rxs(tx_positions: Float[Array, "num_tx 3"], tx_powers: Float[Array, " num_tx"], coef: Float[Array, " "]) -> Float[Array, "num_rx "]:
 # Update TX positions
 scene = eqx.tree_at(lambda s: s.transmitters, scene, tx_positions)
 # Paths have shape [num_tx num_rx num_path_candidates ...]
 paths: Paths = scene.compute_paths(...)
 # We reduce on all path candidates and TXs
 # vertices.shape[-2]-2 = number of reflections (i.e, number of points - TX - RX)
 powers: Float[Array, "num_rx "] = paths.reduce(
 lambda vertices: tx_powers[:, None, None] \
 * coef**(vertices.shape[-2]-2) \
 / path_lengths(vertices)**2,
 axis=(0, 2)
 )
 return powers
def loss(x: Float[Array, "num_tx*4 + 1", measurements: Float[Array, " num_rx"]) -> Float[Array, " "]:
 tx_positions, tx_powers, coef = ... # Split x into arguments
 return (power_at_rxs(tx_positions, tx_powers, coef) - measurements)**2).sum()
optimal_x = minimize(loss, ...)

Then, to have actual power (in Watt) and true reflection coefficients, I recommend that you read one of the tutorials I wrote, e.g., Coherent vs. Non-Coherent Radio Wave Propagation. With this, you could scale to per-object reflection coefficient (or material properties). E.g., you could assume that each radio-material can be represented using the ITU model, and thus only require learning 4 variables, see from_itu_properties.

Warning

Learning one material per-object can be extremely difficult when there are many objects, as it could dramatically increase the number of unknowns and create an optimization landscape with multiple local (or even global) minima.


Now, a few comments that are specific to your problem:

Use case is to model very large indoor scenes (2D) for WiFi propagation.

DiffeRT is optimized for 3D, not 2D. However, as the Master student did, you can model your 2D scene in 3D using a constant z value, and represent each wall by a pair of triangles.

A dummy way to do so would be to create such mesh by appending planes (one for each wall) altogether:

mesh = sum(
 (TriangleMesh.plane(...) for line_segment in line_segments),
 start=TriangleMesh.empty()
)

If this is too slow, come back to me, and we will see if we can have a better way to generate (i.e., avoiding for loops).

To my understanding differentiable ray tracing can estimate the parameters that I do not have that will minimize some loss (let's say MSE) based on ray tracing i.e., reflections and diffractions (diffractions matter more in this use case).

Yes, you can differentiate the RT output with respect to (almost) any input variable, which you can then use to solve an inverse problem.

Unfortunately, diffraction (and refraction) phenomena are not fully implemented yet. You could implement them yourself (basic building blocks are present), but scene.compute_paths will only simulate reflection at the moment.

However, I'd be very happy if you are willing to help to implement diffraction or refraction coefficients, and integration with compute_paths!

Can I incorporate prior probabilities to the parameters that are unknown and being estimated? Surely I have some info and constraints on what transmit power or wall attenuations can be. Can you roughly outline the functions and methods to model this problem in your library?

Yes! The easiest (to me) would be to (1) use prior knowledge in the parameter initialization when calling minimize and (2) use variable clipping or projection in the gradient descend (either you implement a custom optimizer that implements projections or you implement a custom minimize function yourself).

Let me know if that helped or if some things are still unclear :-)

You must be logged in to vote
3 replies
Comment options

Thanks for the detailed response. Very much appreciated.

I will have to dig in deeper.

Comment options

You’re welcome, I will be glad to hear from you!

Comment options

Edit: the Master Thesis is now available at https://hdl.handle.net/2078.2/42843.

Answer selected by jeertmans
Comment options

Unfortunately, diffraction (and refraction) phenomena are not fully implemented yet.

Btw Sionna just added diffraction support: NVlabs/sionna#1010

Would be interesting to have a high-level comparison to Sionna RT in general from you @jeertmans

You must be logged in to vote
2 replies
Comment options

Comment options

Ah yes, I missed that. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested

AltStyle によって変換されたページ (->オリジナル) /