Python problems

SliceOmatic and Python
Python The SliceOmatic AI mode use the Python language to work.

This means that you need to have Python (and some of the associated modules) installed.

This web page is designed to help you setup Python and the modules you will need to run the AI mode.


GPU acceleration
CUDA Ah, yes, before I forget, if you plan to train your own AI, you may want to have a powerful Cuda graphic card along with the CUDA toolkit and the cuDNN library installed in your computer.

The cuDNN library need to be installed BEFORE you install the "Tensorflow" module in Python. If they are not present when installing Tensorflow, then Python will install a CPU version of the library instead of the GPU version.

Please note that you do not need GPU acceleration to use the AI modules. But it is the difference between waiting 2 days or 2 hours for the same training to complete... If you are just using the AI with the provided weights (and not doing your own training), then you can easily do without the CUDA card. With a CUDA card, segmenting a 512x512 CT image in the AI mode with pre-defined weights take about 20ms, without a CUDA card you need about 250ms.

CUDA is a programming language used to access the GPU of Nvidia graphic cards.

For the compatible graphic card look at this page: Windows, Cuda or VR problems. You will need a powerful card with a lot of GPU memory. I would suggest something like the GeForce RTX3090.


Installing CUDA (card, toolkit and libraries)
After installing the card and its drivers, you also need to install both the "CUDA Toolkit for Windows" and the "CUDA Deep Neural Network" (cuDNN) library.

All of these can be found on the Nvidia web site (you will need to fill in the "developer's" form first before you get the cuDNN library).

Since we will ask you to install a specific version of the Python "TensorFlow" library, you will also have to install specific versions of the CUDA toolkit and the cuDNN library.

The official compatible versions are:
CUDA Toolkit V11.2 (you can find it here: https://developer.nvidia.com/cuda-11-2-0-download-archive. )
cuDNN 8.1 (you can find it here: https://developer.nvidia.com/rdp/cudnn-archive. )

(Please note that any version 11 of the toolkit seem to work, but not version 12. Also, any version 8 of the cuDNN seem to work).

The step by step instruction for these installations can be found on the Nvidia web site. Follow this link: Windows install guide

Once installed, the "CUDA Toolkit" should be located in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA" (under "v11.2"), and the "cuDNN" should be located in "C:\Program Files\NVIDIA Corporation\CUDNN" (under "V8.x").


Installing Python
There are many ways to install Python on Windows. I will describe here how to install it from either the Official Python.org web site, or from the Anaconda's web site, your choice.

Please note that both installation are equivalent. However, Anaconda now charge a fee if you are part of an institution while the Python.org version is still free.

SliceOmatic was compiled with Python rev 3.9, so you need to install the same version on your system.

OrgInstalling Python from Python.org


AnacondaInstalling Python from Anaconda


Installing Python additional modules

O.K. now that Python is installed, we will also need to install 3 additional modules: "NumPy", "TensorFlow" and "Keras".

To install these we use the "pip" interface.

At the prompt type in "pip install numpy==1.22.4" and press "Enter" to install the NumPy library.

Note: If you do not have a CUDA card or the CUDA libraries on your system, the Python will install the CPU version of the NumPy libraries. So, if you have a CUDA compatible GPU, it is important to install CUDA before you install NumPy.

Pip install Numpy

Again, at the prompt type in "pip install tensorflow==2.9.1" to install the tensorflow library.

Note: Later versions may also work, but I wrote the program using 2.9.1, so why take any chances?.

Pip install Tensorflow

Finally, we will also need "Keras" however, the "TensorFlow" we already installed seem to contain Keras, so we can skip this step


Scroll
to Top