You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently trying to implement an inversion of Hapkes Anisotropic Multiple Scattering Approximation model. I implemented the AMSA code without problems and I am checking it against data obtained from a Matlab version of the code, so far so good! I even implemented a derivation function, which calculates the analytical derivation of the AMSA model.
Now I want to use those two functions to invert the model and obtain the albedo from a measured reflectance using a nonlinear least squares algorithm. This algorithm would have to go through each pixel and execute the least squares function to obtain the albedo and store it in an array. I did exactly that using a for-loop and so far it works, but it is reaaaaally slow. Here is the current implementation of the "inverted" model:
GN takes even longer, but funny enough, is much closer to the actual value in testing!
Clearly this is not going to cut it and I have to somehow get rid of that for-loop. Both amsa and amsa_derivative are jitted and can take vectors as arguments, and this works really great for calculating reflectances from albedo maps ( about 30ms for a 1500x1500 image). How would I approach it here? Can I somehow supply the image and tell it, to optimize along a certain axis?
Small disclaimer: if you ask yourself now "why does he use a nonlinear least squares approach and not a root finder algorithms?" you are certainly correct! For this example a roots function would also suffice. But in the future, the function will take multiple images into account and try to find an albedo that fits all of them (albedo is in this case a constant and does not depend on the viewing geometry).
The text was updated successfully, but these errors were encountered:
I am currently trying to implement an inversion of Hapkes Anisotropic Multiple Scattering Approximation model. I implemented the AMSA code without problems and I am checking it against data obtained from a Matlab version of the code, so far so good! I even implemented a derivation function, which calculates the analytical derivation of the AMSA model.
Now I want to use those two functions to invert the model and obtain the albedo from a measured reflectance using a nonlinear least squares algorithm. This algorithm would have to go through each pixel and execute the least squares function to obtain the albedo and store it in an array. I did exactly that using a for-loop and so far it works, but it is reaaaaally slow. Here is the current implementation of the "inverted" model:
I am testing both scipy's least_squares and GN and LM from jaxopt. In this setup, scipy's least_squares wins.
Here are the runtimes across a 11x11 patch:
GN takes even longer, but funny enough, is much closer to the actual value in testing!
Clearly this is not going to cut it and I have to somehow get rid of that for-loop. Both
amsa
andamsa_derivative
are jitted and can take vectors as arguments, and this works really great for calculating reflectances from albedo maps ( about 30ms for a 1500x1500 image). How would I approach it here? Can I somehow supply the image and tell it, to optimize along a certain axis?Small disclaimer: if you ask yourself now "why does he use a nonlinear least squares approach and not a root finder algorithms?" you are certainly correct! For this example a roots function would also suffice. But in the future, the function will take multiple images into account and try to find an albedo that fits all of them (albedo is in this case a constant and does not depend on the viewing geometry).
The text was updated successfully, but these errors were encountered: