Skip to content

XDynames/SAI-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StomaAI application

Installation (~10 minutes)

Windows Only Pre-Download Steps

Open command prompt as administrator and run wsl --install to enable Windows subsytem for linux. After this completes windows will need to restart. Visit the Microsoft Store and install Ubuntu 20.04 LTS. Once the store has downloaded the application launch Ubuntu 20.04 LTS from the start menu. The first time you run the Ubuntu app it will need sometime to setup and ask you to create a username and password to use in the application. Install the required pre-requisite packages by running the following commands:

sudo apt update
sudo apt install python3-pip

To ensure the python packages installed are accessible from the command line run:

echo -e "\nexport PATH=/home/$USER/.local/bin:\$PATH" >> ~/.bashrc
exec bash

Download SAI

To checkout the application to run locally on your machine run the commands:

git clone https://github.com/XDynames/SAI-app.git
cd SAI-app

Install

SAI can either use a computer's CPU to process samples or its GPU. The GPU will be significantly faster but requires some extra installation steps:

CPU mode
MacOS

Ensure you have Homebrew setup and install the following packages

brew install geos gdal libjpeg

If you have a Macbook that uses an Apple Silicone based CPU run

pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
Windows and Linux

Ensure you have libgeos installed:

sudo apt install libgeos-dev

Once the operation system specific steps are completed run:

bash setup.sh
GPU accelerated mode

Install the appropriate versions of Pytorch and Detectron2 to suit your GPU. Run bash setup_gpu.sh to install the remaining dependencies.

Docker

If you have docker and nvidia container runtime configured you can start SAI by running:

cd docker 
docker compose up

To make your data available to SAI inside the docker container modify the volume mount ../../stomata_data/:/code/data to suit your needs

Running SAI

Run ./SAI while inside the checked out folder. This will automatically open a webpage in your browser where you can view and use the application.

When using CPU only measurement time has been measured at 60-6 seconds per image, this is also dependant on image resolution. In GPU accelerated mode this time drops to 0.8-0.2 seconds per image.

Sample Images

If you want to test some samples the images we used for validation can be downloaded from here for Barley and Arabidopsis

Tested On

Windows: 10 & 11
Ubuntu: 20.04 & 18.04
MacOS: BigSur & Monterey

Referencing

If you use SAI as part of your work please cite us:

@article{https://doi.org/10.1111/nph.18765,
author = {Sai, Na and Bockman, James Paul and Chen, Hao and Watson-Haigh, Nathan and Xu, Bo and Feng, Xueying and Piechatzek, Adriane and Shen, Chunhua and Gilliham, Matthew},
title = {StomaAI: an efficient and user-friendly tool for measurement of stomatal pores and density using deep computer vision},
journal = {New Phytologist},
volume = {238},
number = {2},
pages = {904-915},
keywords = {applied deep learning, computer vision, convolutional neural network, phenotyping, stomata},
doi = {https://doi.org/10.1111/nph.18765},
url = {https://nph.onlinelibrary.wiley.com/doi/abs/10.1111/nph.18765},
eprint = {https://nph.onlinelibrary.wiley.com/doi/pdf/10.1111/nph.18765},
}