Comments (11)
I converted the current code of gerchberg-saxton method to torch with (f5e0a16).
The results may not match exactly because of the differences we noticed in #10 but they seem close to each other. These are the current reconstruction results from the numpy/cupy and torch versions with (edc9872):
from odak.
This routine is verified with a real holography setup. @askaradeniz in case you are interested in transferring this piece of code to learn
module, the Numpy/Cupy version is ready.
from odak.
Well, actually, I think even if we don't fix it right now, having an issue is a reminder for the future.
from odak.
Gerchberg-Saxton phase retrieval method for Numpy/Cupy case is added with commit d2c4e3f .
A test routine can be found as in here. @askaradeniz please do not start conversion to torch until I verify this routine with a real holography setup.
from odak.
I suppose this concludes and closes this case.
from odak.
In fact, we may be able to overcome that tiny difference in results by comparing:
-
odak.wave.set_amplitude
andodak.learn.set_amplitude
, -
fftn
andifftn
in torch with respect tofft2
andifft
in numpy, cupy.
I should also highlight that when @rongduo experimented the absolute maximum difference was 10, in her case she uses numpy. In my case it was 15, I use cupy. At the very least above two comparisons may help us understand further. Shall we initiate and examine those two at a separate issue @askaradeniz ? Would you be willing to take the lead on that?
from odak.
I suspect that the difference in absolute distance you see is due to the randomization of the input field.
https://github.com/kunguz/odak/blob/edc987256afe6bfad16aae4031e047a717999b60/test/test_learn_beam_propagation.py#L73
Ofcourse, I can take the lead about the matching issue.
from odak.
Makes perfect sense. Do we get the same results without it? If so no additional issue is needed, all we need to do is to comment that line.
But wait, I thought torch and numpy comparison uses the same original field, no?
https://github.com/kunguz/odak/blob/edc987256afe6bfad16aae4031e047a717999b60/test/test_learn_beam_propagation.py#L79
from odak.
I mean they can give different absolute difference everytime we run the test case because of the randomization. So, it is normal to have different absolute differences at each run. However, our problem is that 10 or 15 difference should be much smaller as both of them use the same field.
from odak.
Maybe we can just leave it as is and reopen the issue when someone needs more precise matching. @kunguz Would it be OK?
from odak.
Sure, but we don't have an understanding at the moment on where does the difference come from. U1 returns same for example but right after final fft2 results diverges. Analysing set_amplitude
should be straight forward.
from odak.
Related Issues (20)
- Band-limited angular spectrum method HOT 16
- Double phase hologram method HOT 2
- Wide-window angular spectrum method for diffractionpropagation in far and near field HOT 1
- Adaptive-sampling angular spectrum method withfull utilization of space-bandwidth product HOT 1
- Fraunhofer beam propagation HOT 1
- Lens phase function generation HOT 2
- Pytorch and numpy/cupy comparison for beam propagation HOT 4
- Adding Stochastic Gradient Descent based hologram calculation HOT 2
- Thinning the dependencies HOT 5
- How to set up parallel computing HOT 1
- Dimensions fo quadratic phase function HOT 1
- Double Phase Encoding Implementation HOT 1
- [Feature Request] Add `.pre-commit-config.yml` HOT 3
- Gerchberg Saxton bug HOT 3
- Loading images with Odak in a normalized manner HOT 1
- Zero padding and cropping in beam propagation HOT 2
- Drawing multiple rays with visualize submodule.
- A question about calculating the pooling area in make_pooling_size_map_pixels HOT 2
- Wirtinger hologram generation routine HOT 1
- AttributeError: 'display_color_hvs' object has no attribute 'rgb_to_lms' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odak.