This is a tutorial on how to download and set up the software required for CellSeg. This tutorial will cover:
This tutorial assumes no programming experience with Python or terminal. It will provide a step-by-step guide on how to get CellSeg up and running using conda. One of the advantages of CellSeg is it leverages the power of the Python programming language for deep learning while minimizing user programming. Advanced Python users can skip part 2 of this tutorial.
To use CellSeg, first install the CellSeg for Windows here (clicking will download from CellSeg GitHub). Then extract the CellSeg folder to any location. Next, download the weights used for the CellSeg Mask R-CNN network here. These weights require about 250 MB of disk space. Within the CellSeg folder you just extracted, move these weights into the folder CellSeg-master/src/modelFiles.
CellSeg requires a one-time package installation using conda, a Python package manager program contained in miniconda. If you don’t already have miniconda, install miniconda here (clicking will download from conda repo). Miniconda requires approximately 60 MB of space.
The pictures for this tutorial are done in Windows on an Anaconda Prompt. Write down the absolute path to the CellSeg folder you previously downloaded. For example, the path to the CellSeg folder on my computer is: “E:\JACOB\CellSegSegmenter”.
First, we open the Anaconda Prompt:
Notice that we are currently in the C:
drive of the computer, but the path to the CellSeg folder is in the E:
drive. To change drives on Windows, we type the letter preceding the directory path followed by a colon and hit enter. In our case, we type E:
. Note if you're already in the drive containing your CellSeg folder, you can skip this step.
Now, we’re going to use that path to the CellSeg folder you wrote down earlier. We’ll navigate to the folder in one command by typing cd “filepath” where you replace filepath with the path to your CellSeg folder in double quotes. For example, I’m going to type
cd "E:\JACOB\CellSegSegmenter"
and press Enter.
Now we are ready to set up CellSeg.
The CellSeg program requires several Python packages to run. A naïve approach would be to download all these packages one by one from the internet, but this requires downloading about 40 packages separately, and it leads to extra computer clutter, computer slowdowns, and unnecessary work to organize the packages. A solution that Python programmers have developed is the conda environment. Conda environments allow you to download and install all the necessary packages for a Python program like CellSeg with a single command in terminal, and the Conda environment automatically stores and organizes all packages efficiently.
We will walk through how to create a conda environment for CellSeg. First, we need to check that conda is installed properly on our machine. We do this by typing conda info
and hitting Enter. If your output doesn’t look like this, or you get an error, then reinstall conda before continuing.
Now we’ll create the conda environment that CellSeg will run in. The name of our new environment will be cellsegsegmenter and we’ll create this by typing
conda create --name cellsegsegmenter python==3.6
Eventually, you will reach a prompt that says Proceed ([y]/n)?
. Hit enter to continue.
Once you see an output similar to the image below, the environment has been created.
To use a conda environment, you need to activate it by typing conda activate env_name
where you replace env_name
with your environment name. In my case, I type conda activate cellsegsegmenter
.
Notice now that the name of our environment appears in parentheses to the left of the directory path. That means we are now in the active conda environment. Next, we need to install the packages that CellSeg depends on. First, type the following and hit enter
conda config --add channels conda-forge
Next, type the following and hit enter. This will install the cytoolz
package for CellSeg.
conda install cytoolz==0.10.0
When prompted by Proceed ([y]/n)?
, hit enter to continue.
Finally, type the following to install the rest of the packages for CellSeg on Windows.
pip install -r requirements.txt
When prompted by Proceed ([y]/n)?
, hit enter to continue. You should be able to watch as all the packages required for CellSeg are installed. This completes the CellSeg installation tutorial.
GPU acceleration with CellSeg requires CUDA 10.0, CUDNN 7.6.5, and a CUDA compatible GPU. From the base CellSeg environment, first uninstall tensorflow. Next, install tensorflow-gpu==1.13.1 using pip. Confirm your keras version is 2.1.3. Finally, downgrade h5py to 2.10.0 using pip.