-
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 do not have:
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? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
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 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 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:
DiffeRT is optimized for 3D, not 2D. However, as the Master student did, you can model your 2D scene in 3D using a constant 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).
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 However, I'd be very happy if you are willing to help to implement diffraction or refraction coefficients, and integration with
Yes! The easiest (to me) would be to (1) use prior knowledge in the parameter initialization when calling Let me know if that helped or if some things are still unclear :-) |
Beta Was this translation helpful? Give feedback.
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: