odl icon indicating copy to clipboard operation
odl copied to clipboard

Docs are unclear about optional dependencies (in particular ray trafo backends)

Open james-zhang-jz opened this issue 4 years ago • 9 comments

import tensorflow as tf
import numpy as np
import odl
import odl.contrib.tensorflow
from util import random_phantom, conv2d


sess = tf.compat.v1.InteractiveSession()

# Create ODL data structures
size = 128
space = odl.uniform_discr([-64, -64], [64, 64], [size, size],
                          dtype='float32')

geometry = odl.tomo.parallel_beam_geometry(space, num_angles=30)
operator = odl.tomo.operators.ray_trafo.RayTransform(space, geometry)
pseudoinverse = odl.tomo.fbp_op(operator)

# Ensure operator has fixed operator norm for scale invariance
opnorm = odl.power_method_opnorm(operator)
operator = (1 / opnorm) * operator
pseudoinverse = pseudoinverse * opnorm

I was running these lines of code and the error was raised at where I define the operator using RayTransform.

I have followed the instruction on the ODL docs page and installed all the packages, extensions and dependencies with pip install

I have a feeling that this is caused by a trivial mistake, if anyone has dealt with the same issue, please help asap.

Much appreciated! Cheers

james-zhang-jz avatar May 18 '20 07:05 james-zhang-jz

Hey @james-zhang-jz ! You need to install a package for the computation of ray transforms, preferably the ASTRA toolbox. Admittedly the docs are not very clear about this, but I also don't think that the pip path is optimal as the ASTRA toolbox does not provide wheels. You'd need to compile it from source to install it. With conda it would be much easier, I suggest that you consider going that path.

kohr-h avatar May 18 '20 07:05 kohr-h

On our side, I think we should restructure the install docs a bit, with a separate section about optional packages and more prominent references to it.

kohr-h avatar May 18 '20 07:05 kohr-h

I think I have resolved the issue by using the miniconda environment with the ODL specified version of python 3.5. However, I have other issues that link with different versions of packages.

Could you specify the version of packages you are using in this project such as tensorflow? I am getting errors like tensorflow packages has no attributes xxxxxxxxxx. It looks like it is caused by using a different version of packages.

Thanks in advance.

james-zhang-jz avatar May 18 '20 18:05 james-zhang-jz

I'm not an expert on the TF integration, @adler-j should know more.

What I suspect, though, is that our TF code is based on the 1.x API and breaks with tensorflow 2.x. I know the old API is still supported, but probably requires some changes in the import. You can try to install a 1.x version of tensorflow and see if it works.

kohr-h avatar May 19 '20 12:05 kohr-h

You can run import tensorflow.compat.v1 as tf, but we should fix TF2 support as well. Could you link the error messages you are getting?

adler-j avatar May 19 '20 13:05 adler-j

Thank you both for the feedback, I will post the error once I am certain with the cause of it. Let me explore some more and get back to you guys.

Thanks again!

james-zhang-jz avatar May 19 '20 17:05 james-zhang-jz

Hi again,

I have successfully installed the pack on one machine without problems, and now trying to install it on a remote machine. I have encountered the following issue when installing with the following command: CUDA_ROOT=/usr/local/cuda CUDA_COMPUTE=30 conda build ./conda I have the CUDA_ROOT set to the /usr/local/cuda directory.

I am not sure whether it is the problem with the remote machine or the odlcuda packages, sorry for the interruption.

Please assist, thanks in advance. [ Screen Shot 2020-05-30 at 14 34 40

james-zhang-jz avatar May 30 '20 21:05 james-zhang-jz

You shouldn't need odlcuda. Why is it being installed here?

adler-j avatar May 31 '20 14:05 adler-j

Thanks for your response, I didn't read the warnings carefully on your docs.

james-zhang-jz avatar May 31 '20 20:05 james-zhang-jz