The most straigtforward way install TensorFlow is to work in a virtual Python environment and simply to use either the TensorFlow official packages in pip or a wheel (.whl
) distribution.
Problems arise at some point when a lot of heavy image processing needs to be done.
Since prediction/inference primarly involves the CPU we might correctly ask ourselves:
Instead of precompiled binaries, that are not optimized for our set of CPU architecture extensions, what would be the speed gain if we would compile TensorFlow from source?
There are a lot of blog posts on the benefits of compiling Tensorflow from source however a lot of the benchmarks shown might not be really applicable to the day to day activities of biologist/microscopist.
In this post I will use StarDist's 3D prediction using a network trained to segment rolling circle amplification products for in situ sequencing.
Since a lot of microscope core facility computers tend to use softwares primarily running on Windows (Imaris etc.) I will compile on Microsoft Windows, which is a mess in itself if you come more from the *nix side of things.
This guide roughly follows the official tutorial, Ive only added some comments that will save time: https://www.tensorflow.org/install/source_windows
Install Python3: https://www.python.org/downloads/windows/
Windows doesnt come with a C/C++ compiler so we need to install that first.
Install Build Tools for Visual Studio: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
Install C++ Redistributable for Visual Studio 2019: https://visualstudio.microsoft.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2019
Install Git: https://git-scm.com/
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow