Skip to content

Latest commit

 

History

History
102 lines (66 loc) · 5.42 KB

README.md

File metadata and controls

102 lines (66 loc) · 5.42 KB

This project has been moved to https://gitlab.com/archiekennedy/cobalt, consider this repository outdated.

Cobalt Neural Network

Convolutional residual neural network for image-based object classification, used in this Android app.

About

Based on the WRN architecture, training and validation data taken from the CIFAR-100 data set.
Capable of reaching about 74% accuracy after 80000 training steps (just over 22 hours with a GTX 1070 8GB).

If you run out of memory try using a smaller batch size, for best results use powers of 2.

Usage

Linux (or anything that supports shebangs):
./cobalt.py --help

Windows:
python cobalt.py --help

Examples

./cobalt.py --train 40000
./cobalt.py --accuracy
./cobalt.py -t 80000 --export network

Visualizing

To represent training graphically:

  1. Navigate to the cobalt directory.
  2. Run tensorboard --logdir=data/log or python -m tensorboard.main --logdir=data/log on Windows (replace data with whatever you set using --save).
  3. Open localhost:6006 in your browser.

Requirements

Make sure you have a 64-bit operating system.

Linux

If you're running something Debian based:

sudo apt-get update
sudo apt-get install python3-pip python3-dev python3-tk
sudo python3 -m pip install -U setuptools
sudo python3 -m pip install -U tensorflow numpy

Linux with GPU support

Training is a lot faster with a graphics card, but getting it running is an involved process:

  1. sudo apt-get update && sudo apt-get install python3-pip python3-dev python3-tk
  2. Install CUDA Toolkit 9.0 from here by following this guide.
  3. Get the cuDNN SDK 7.0.5 for CUDA 9.0 from here, follow the cuDNN Install Guide PDF for that specific version.
  4. sudo apt-mark hold libcudnn7 libcudnn7-dev
  5. sudo pip3 install -U setuptools && sudo python3 -m pip install -U tensorflow-gpu

Windows

  1. Get Python from here (download the x86-64 version), make sure to tick Add Python 3.6 to PATH during installation.
  2. Download this file and run it with python get-pip.py to install pip.
  3. python -m pip install -U setuptools
  4. python -m pip install -U tensorflow numpy

Deploy

To use this with your own code, save the trained network as a .pb file with --export.

Android

If you use Java have a look at this class from my app for an example on using the TensorFlowInferenceInterface, or read this tutorial.

Python

TensorFlow offers the SavedModel loader, read about it here.

Something else

Protocol Buffers support a few other languages and people are working on adding more.

Acknowledgements

ImageNet Classification with Deep Convolutional Neural Networks (Alex Krizhevsky, Ilya Sutskever & Geoffrey Hinton, 2012).
Dropout: A Simple Way to Prevent Neural Networks from Overfitting (Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever & Ruslan Salakhutdinov, 2014).
Wide Residual Networks (Sergey Zagoruyko & Nikos Komodakis, 2016).
A Method for Solving a Convex Programming Problem with Convergence Rate O(1/K2) (Yurii Nesterov, 1983).
Deep Residual Learning for Image Recognition (Kaiming He, Xiangyu Zhang, Shaoqing Ren & Jian Sun, 2015).
Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift (Sergey Ioffe & Christian Szegedy, 2015).
Magnus Pedersen and his excellent repository.
A thanks to Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton for maintaining the CIFAR-100 data set.
Learning Multiple Layers of Features from Tiny Images (Alex Krizhevsky, 2009).

License

This repository uses the MIT License.
TensorFlow is released under the Apache License, Version 2.0.

Architecture

Neural network layers