learned_primal_dual icon indicating copy to clipboard operation
learned_primal_dual copied to clipboard

in “mayo_learned_primal_dual.py”

Open mimeng123 opened this issue 3 years ago • 11 comments

dear adler I have some question about your work,I run the “mayo_learned_primal_dual.py” ,the value of resuslut would became nan or inf. I compare the “mayo_learned_primal_dual_log.py”,As shown in the figure below,it has the Statement on line 36 and 37 ,but “mayo_learned_primal_dual.py” don't have. I want to ask Is this two statements necessary for “mayo_learned_primal_dual.py”?why? 微信图片_20200830142611

mimeng123 avatar Aug 30 '20 06:08 mimeng123

Do I need to add these two sentences?

mimeng123 avatar Aug 30 '20 06:08 mimeng123

That should not be needed (in fact, in the non-linear case the forward operator has units and the scaling actually matters).

When this happens, it's commonly the case that astra has been installed wrongly, have you tried running the ODL test suite?

adler-j avatar Aug 30 '20 13:08 adler-j

Dear adler: I had tried running the ODL test suite these days. I received the error as follow . how to slove this problem? $ py.test ============================================== test session starts =============================================== platform linux -- Python 3.7.7, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 rootdir: /home4/ypb plugins: hypothesis-5.30.0, odl-1.0.0.dev0 collected 0 items / 1 error ===================================================== ERRORS ===================================================== _________________________________________ ERROR collecting test session __________________________________________ anaconda3/envs/ct_tf=1.14/lib/python3.7/site-packages/_pytest/config/init.py:557: in _importconftest mod = import_path(conftestpath, mode=importmode) anaconda3/envs/ct_tf=1.14/lib/python3.7/site-packages/_pytest/pathlib.py:540: in import_path raise ImportPathMismatchError(module_name, module_file, path) E _pytest.pathlib.ImportPathMismatchError: ('pywt.conftest', '/home4/ypb/anaconda3/envs/ct_tf=1.14/lib/python3.7/site-packages/pywt/conftest.py', PosixPath('/home4/ypb/anaconda3/envs/ct_odl/lib/python3.7/site-packages/pywt/conftest.py')) ============================================ short test summary info ============================================= ERROR - _pytest.pathlib.ImportPathMismatchError: ('pywt.conftest', '/home4/ypb/anaconda3/envs/ct_tf=1.14/lib/p... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

mimeng123 avatar Sep 02 '20 08:09 mimeng123

In what folder did you run py.test?

adler-j avatar Sep 02 '20 13:09 adler-j

In what folder did you run py.test?

I installed odl by pip. I dont't choose any folder, I run py.test in root directory. excurse me,do I run in the wrong folder?

mimeng123 avatar Sep 02 '20 13:09 mimeng123

You need to tell pytest which tests to run, e.g. by going to the ODL folder. If you installed with pip, you should probably run odl.test() from python.

adler-j avatar Sep 02 '20 13:09 adler-j

dear adler,thank for your help.

just now,I have tried the command python -c "import odl; odl.test()" , I received 1 xfailed ,but there are no relevant tips .

sorry,I am not familiar with pytest , I want to ask if I need to deal with this problem , how can I find the detail about this?

mimeng123 avatar Sep 02 '20 14:09 mimeng123

Pytest is a very widely used python library for testing and there's heaps of documentation online.

What was the error message you got, more exactly?

adler-j avatar Sep 03 '20 12:09 adler-j

dear adler, Sorry for the late response. I was re-installed the odl, I had passed the test. Thanks for your help.

mimeng123 avatar Sep 10 '20 01:09 mimeng123

Ok great to hear! If this is solved can we close it?

adler-j avatar Sep 10 '20 08:09 adler-j

dear adler.I also have a problem which I want to ask you. In the "mayo_learned_primal_dual_log.py",why you deal with log_noisy_data need multiply the (1 / opnorm) ? (in the "log_noisy_data = np.log(noisy_data) * (-1 / mu_water) * (1 / opnorm)")

- def generate_data(validation=False):
-     """Generate a set of random data."""
-     n_iter = 1 if validation else n_data
- 
-     y_arr = np.empty((n_iter, operator.range.shape[0], operator.range.shape[1], 1), dtype='float32')
-     x_true_arr = np.empty((n_iter, space.shape[0], space.shape[1], 1), dtype='float32')
- 
-     for i in range(n_iter):
-         if validation:
-             fi = "../../../DataSet/water/L_test/L064_008.npy"
-         else:
-             fi = "../../../DataSet/water/L_train/" + file_loader.next_file()
- 
-         data = np.load(fi)
- 
-         phantom = space.element(np.rot90(data, -1))
-         phantom /= 1000.0  # convert go g/cm^3
- 
-         data = ray_transform(phantom)
-         data = np.exp(-data * mu_water)
- 
-         noisy_data = odl.phantom.poisson_noise(data * photons_per_pixel)
-         noisy_data = np.maximum(noisy_data, 1) / photons_per_pixel
- 
-         log_noisy_data = np.log(noisy_data) * (-1 / mu_water) * (1 / opnorm)
- 
-         x_true_arr[i, ..., 0] = phantom
-         y_arr[i, ..., 0] = log_noisy_data
- 
-     return y_arr, x_true_arr

mimeng123 avatar Sep 10 '20 13:09 mimeng123