bacteria-networks

This program employs a neural network to identify nanowire network structure in images of Shewanella oneidensis.

Installation instructions:

Mac

Open Terminal (it's in Utilities) and run the following command:

/bin/bash -c "$(curl -L https://raw.githubusercontent.com/ahthomps/bacteria-networks/master/mac-install.sh)"

This will install the program to your home directory and leave a shortcut on your desktop called GNNAT. Double click it to run the program.

Linux

Use your package manager to install the following packages:

  • python3
  • pip3
  • make
  • gcc
  • git
  • cuda (optional; improves performance if you have a modern Nvidia GPU)
  • cudnn (optional; improves performance if you have a modern Nvidia GPU; requires cuda)
  • openmp (optional; improves performance if you're not using cuda)

(Note: Some of these packages will have different names in different package repositories. For example, openmp is called libomp in Ubuntu's package repositories. The names given match the names in the default Arch Linux package repositories. )

Clone this repository by running git clone --recurse-submodules --depth 1 https://github.com/ahthomps/bacteria-networks.git.

You can greatly improve the performance of this application by tweaking Darknet's makefile. If you installed cuda, set GPU=1. If you installed cudnn, set CUDNN=1. If you aren't using a GPU, and your CPU was manufactured after 2011, you should set AVX=1. If you installed openmp, set OPENMP=1. On Arch Linux, cuda gets installed to /opt/cuda/ instead of the usual place. If you're running Arch, you'll have to change the makefile to reflect that difference.

cd into the darknet directory, then run make.

pip3 install these packages:

  • matplotlib
  • pyqt5
  • scikit-image
  • networkx
  • scipy
  • Pillow

cd into the scripts directory and run ./download_model.sh.

Windows

(This is copied almost verbatim from here.)

  1. Install git, python3, and pip3.

  2. Install Visual Studio 2017 or 2019. You can download it here. Be sure to install all of the optional C++ extensions.

  3. If you have a modern Nvidia GPU, install CUDA (at least v10.0) enabling VS Integration during installation. You can download it here.

  4. Open Powershell (Start -> All programs -> Windows Powershell) and run these commands:

git clone https://github.com/microsoft/vcpkg
cd vcpkg
$env:VCPKG_ROOT=$PWD
.\bootstrap-vcpkg.bat
.\vcpkg install darknet[full]:x64-windows
cd ..

Once that's done, run these commands:

git clone --recurse-submodules --depth 1 https://github.com/ahthomps/bacteria-networks
cd bacteria-networks\darknet
.\build.ps1

pip3 install these packages:

  • matplotlib
  • pyqt5
  • scikit-image
  • networkx
  • numpy
  • scipy
  • Pillow

Then, you'll need to download the model. For now, there's no automated way of doing that on Windows. You'll have to download the files in this repository and concatenate them into a file named model_6.weights, then stick that in models/model_6. This will hopefully be easier when (if) we have a Windows installer up and running.

Using this application:

Run the program with python3 run.py (or double click on the shortcut if you're on a Mac).

Running on a single image:

File -> Open Image, then choose an image.

Run -> Run All

Once it's done running, you'll be able to manually edit the graph.

File -> Export to Gephi, then choose where to save the graph file.

Running on a batch of images:

File -> Open Image Directory, then choose the folder with your images.

Run -> Run All

Once it's done running, all the graphs are saved in the same directory as the images. Then, you'll be able to cycle through images with the arrows in the top left corner of the window and manually edit the graphs.