Giter VIP home page Giter VIP logo

libdeep's Introduction

libdeep: C/C++ library for deep learning

This is a C library which can be used in deep learning applications. It allows multiple layers to be trained and also includes the dropouts technique to avoid overfitting the data. What differentiates libdeep from the numerous other deep learning systems out there is that it's relatively small and that trained networks can be exported as completely standalone C or Python programs which can either be used via the commandline or within and Arduino IDE for creating robotics or IoT applications.

A Python API for libdeep can be found at https://github.com/bashrc/libdeep-python

Installation

On Debian based systems:

sudo apt-get install build-essential doxygen xdot

If you want to be able to visualize call graphs for development or debugging purposes then you will need to install the egypt script.

On Arch based systems:

sudo pacman -S gcc doxygen egypt xdot

To build from source:

make
sudo make install

This creates the library and installs it into /usr/local

Unit Tests

You can run the unit tests to check that the system is working as expected:

cd unittests
make
./tests

Or to check for any memory leaks:

valgrind --leak-check=full ./tests

Source Documentation

To generate source code documentation make sure that you have doxygen installed and then run the generatedocs.sh script. A subdirectory called docs will be created within which html and latex formated documentation can be found. For general usage information you can also see the manpage.

man libdeep

Text or Numeric

Inputs within training data sets can include both text and/or numeric data. For example, within the XOR training data you can have something like:

0.0,0.0,0.0
0.0,1.0,1.0
1.0,0.0,1.0
1.0,1.0,0.0

or alternatively, using whatever text representations you prefer:

zero,zero,0.0
zero,one,1.0
one,zero,1.0
one,one,0.0

Showing the call graph

If you want to visualize the call graph for a particular source file for debugging or development purposes:

SOURCEFILE=deeplearn.c make graph

And you can change the SOURCEFILE value to whatever file you're interested in.

Examples

There are also some example programs within the examples directory. Reading the examples is the best way to learn how to use this library within your own code. Examples are:

  • Face recognition with a deep convolutional network
  • Automatic feature learning and image reconstruction from features
  • Determining whether a cancer is malignant or benign
  • Assessing wine quality from ingredients
  • Predicting concrete quality from ingredients

Using trained neural nets in your system

You can export trained neural nets either as a C program or a Python program. These programs are completely independent and can be used either as commands or integrated into a larger software application. This makes it easy to use the resulting neural net without needing to link to libdeep. See the source code in the examples directory for how to use the export function. If you include the word "sketch" or "arduino" within the filename to be exported to then it will appear as Arduino compatible C suitable for use within an Arduino IDE rather than as standard C.

In your training program:

deeplearn_export(&learner, "export.c");

Then when training is done:

gcc -o export_c export.c -lm
./export_c [first input] [second input]...

Portability

Although this software was primarily written to run on Linux-based systems it's pretty much just vanilla C99 standard code and so it should be easily portable to other platforms, such as Microsoft Windows and Mac systems. The independent random number generator should mean that results are consistent across different compilers and platforms.

Packaging

To build packages for Debian (deb) see https://github.com/bashrc/libdeep-debian

libdeep's People

Contributors

lunixoid avatar

Watchers

James Cloos avatar

Forkers

elix22

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.