Docker is almost a standard for publishing any new software or package. There is a platform called PlantIT that can help you deploy any service in the container image. Let’s learn how to put a deep learning based plant phenotyping package into container and deploy it to PlantIT.


Welcome to the video. In this tutorial, I am going to show you how to build a container for a deep learning model and run it on PlantIT in less than 10 minutes. In the first part we will prepare a container for a deep learning toolkit called Deep Plant Phenomics and push it to the docker hub. In the second part of the video, we will create a PlantIT flow simply by preparing a github repository with a yaml file called plantIT.yaml.

We also need to install docker, just go to Download and install docker desktop. Also sign up an account so that you will be able to upload or push your container to the docker hub.

Alright. let’s move on.

First we are going to download somebody’s source code, slightly modified them and write a recipe for it to build up a container so that we can run it on PlantIT.

We are going to use Deep Plant Phenomics. Deep Plant Phenomics is a deep learning toolkit for plant phenotyping in forms of python package. Here is a quote from their github readme: “Think of it as Keras for plant scientists.” It actually integrates Tensorflow for learning so it can not only run on both CPU and GPU but also scale easily across devices. To be more specific, it comes with two main things. One is pre-trained convolutional neural networks that can conduct simple tasks on rosette plants. The other is easy to use API for you to build new models.

They provided a good document. Here we can see several examples using the pre-trained networks, including vegetation segmentation network, rosette leaf counter, and canola flower counter

We are going to prepare a container for Deep Plant Phenomics and make the its application development not only cross platform but also reproducible.

First we have to download its source code. You can copy and paste the git clone command from the slide. Or clone the repository by GitKraken. Just open GitKraken. In the new tab, Click the “Clone a repo” and paste the URL. This repository is a little big so it will take some time.

Then, we are going to trim the repository a little bit. This step is optional. Let’s take a look at the files. In the GitKraken, press “Cmd or Ctrl + P” “Open in file manager”. I am going to remove the “docs” at the root directory and the “tests” inside the deepplantphenomics directory. You can use the rm command from the slide or just delete them manually.

Next, we are going to prepare a simple script file. This is the script that will actually be executed. Let’s copy the “” from the example directory to the root directory. Open it with your favorite editor. It is an example script that conduct segmentation on (International Plant Phenomics Network) IPPN dataset. It has a brief structure. First import some packages, then specify input and output directory, the “images” variable is a list that take all files in the input directory that ended with “_rbg.png”. In the for loop, all of the images will be processed by the network. As you can see the input and ouput directories are hardcoded. We are going to modify it so that this script and take file path as argument from command. You can simply download the finished version from the links provided in the slide.

Next, we are going to write a docker file which is the recipe for the container image. For this docker file, we use ubuntu:18.04 as base image. We installed python and necessary libraries. Upgrade pip3 and use pip3 to install python dependencies for deep plant phenomics. We put the deep plant phenomics inside dir “other_module” and ADD this dir. Finally install DPP and ADD the example script we prepared.

I assumed that you also use VSCODE. Because we are going to use the docker add-on of vscode to build it. Install the add-on and add the folder to the workspace. Press the right mouse button on the page and select build image. Input your docker hub user name slash image name colon and tag. It will take a while.

After building, we are going to run and test it. here is the image dataset from IPPN. These are some rosette plants. You can run it with the command from the slide. Here are the results. As you can see, all of the images background were removed. Next open the docker desktop, select the docker image and push it to the docker hub. And of course if you insist you can use docker push command to do this step in the terminal

In the second section, please use the right arrow on the slide to go to the corresponding slide. We are going to create a flow on PlantIT. PlantIT is a revolutionary platform. For plant scientist, you can run plant phenomics pipelines in the browser without coding. For research software developers, it is the best place for you to publish your application. Before we started, sign up a Github and CyVerse account to log in to PlantIT.

Let’s initiate a github repo under the tab of Init and Drag all of the files from the previous section in to the repo. Create a new file called plantit.yaml. Use it to specify the name, parameters and command to run. There is a well documented instruction on the website of PlantIT so give it a look. I also write a readme file and push them.

If you want to make sure your flow would work on plantIT, you can install the plantit-cli on your own machine. by pip3 install plantit-cli. But we are not going to cover this in the tutorial. If you are interested, leave a command below to let me know!

Let’s go to the Website of PlantIT and log in to your dashboard. Under the Flow tab, we have this new Flow published. Let me upload some files to CyVerse. And checking these parameters and Run.

Alright! That’s how we prepare a software in to container image and create a flow for it on PlantIT. How do you think? What kind of plant phenotyping software do you wish to use on PlantIT? If you are a software developer, PlantIT can really increase the possibility for other researchers to try out your program. Or maybe, you are concern about the restriction caused by the user interface of the browser? Leave a comment below to let me know! and I will see you next time, Bye!