3 NNtrainer is Software Framework for Training Neural Network Models on Devices.
7 NNtrainer is an Open Source Project. The aim of the NNtrainer is to develop Software Framework to train neural network model on embedded devices which has relatively limited resources. Rather than training the whole layers, NNtrainer trains only one or a few layers added after the feature extractor.
9 Even though it trains part of the neural network models, NNtrainer requires quite alot of functionalities to train from common neural network frameworks. By implementing them, it is good enough to run several examples which can help to understand how it works. There are KNN, Neural Network, Logistic Regression and Reinforcement Learning with CartPole in Applications directory and some of them use Mobilenet V2 with tensorflow-lite as a feature extractor. All of them tested on Galaxy S8 with Android and PC (Ubuntu 16.04).
12 * [Jijoong Moon](https://github.com/jijoongmoon)
13 * [MyungJoo Ham](https://github.com/myungjoo)
14 * [Geunsik Lim](https://github.com/leemgs)
17 * [Sangjung Woo](https://github.com/again4you)
18 * [Wook Song](https://github.com/wooksong)
19 * [Jaeyun Jung](https://github.com/jaeyun-jung)
20 * [Hyoungjoo Ahn](https://github.com/helloahn)
21 * [Parichay Kapoor](https://github.com/kparichay)
22 * [Dongju Chae](https://github.com/dongju-chae)
23 * [Gichan Jang](https://github.com/gichan-jang)
24 * [Yongjoo Ahn](https://github.com/anyj0527)
30 This is the component which control neural network layers. Read the configuration file ([Iniparser](https://github.com/ndevilla/iniparser) is used to parse the configuration file.) and constructs Layers including Input and Output Layer, according to configured information by the user.
31 Most Important role of this component is to activate forward / backward propagation. It activates Inferencing and training of each layer while handle the data properly among them. There are properties to describe network model as below:
33 - **_Type:_** Network Type - Regression, KNN, NeuralNetwork
34 - **_Layers:_** Name of Layers of Network Model
35 - **_Learning\_rate:_** Learning rate which is used for all Layers
36 - **_Decay\_rate:_** Rate for Exponentially Decayed Learning Rate
37 - **_Epoch:_** Max Number of Training Iteration.
38 - **_Optimizer:_** Optimizer for the Network Model - sgd, adam
39 - **_Activation:_** Activation Function - sigmoid , tanh
40 - **_Cost:_** Cost Function -
41 msr(mean square root error), categorical (for logistic regression), cross (cross entropy)
42 - **_Model:_** Name of Model. Weight Data is saved in the name of this.
43 - **_minibach:_** mini batch size
44 - **_beta1,beta2,epsilon:_** hyper parmeters for the adam optimizer
49 This component defines Layers which consist of Neural Network Model. Every neural network model must have one Input & Output Layer and other layers such as Fully Connected or Convolution can be added between them. (For now, supports Input & Output Layer, Fully Connected Layer.)
51 - **_Type:_** InputLayer, OutputLayer, FullyConnectedLayer
52 - **_Id:_** Index of Layer
53 - **_Height:_** Height of Weight Data (Input Dimension)
54 - **_Width:_** Width of Weight Data ( Hidden Layer Dimension)
55 - **_Bias\_zero:_** Boolean for Enable/Disable Bias
60 Tensor is responsible for the calculation of Layer. It executes the addition, division, multiplication, dot production, averaging of Data and so on. In order to accelerate the calculation speed, CBLAS (C-Basic Linear Algebra: CPU) and CUBLAS (CUDA: Basic Linear Algebra) for PC (Especially NVIDIA GPU) for some of the operation. Later, these calculations will be optimized.
66 The following dependencies are needed to compile / build / run.
70 * blas library ( CBLAS ) (for CPU Acceleration)
71 * cuda, cudart, cublas (should match the version) (GPU Acceleration on PC)
72 * tensorflow-lite (>=1.4.0)
73 * jsoncpp ( >=0.6.0) (openAI Environment on PC)
74 * libcurl3 (>= 7.47 ) (openAI Environment on PC)
78 Download the source file by clone the github repository.
81 $ git clone https://github.com/nnsuite/nntrainer
84 After completing download the sources, you can find the several directories as below.
88 Applications CMakeLists.txt external include jni LICENSE package.pc.in
91 There are four applications tested on the Android and Ubuntu (16.04). All of them include the code in NeuralNet directory and has their own CMake file to compile. This is the draft version of the code and need more tailoring.
92 Just for the example, let\'s compile Training application. Once it is compiled and install you will find the libnntrainer.so and related .h in /usr/local/lib and /usr/local/includes directory.
102 And you could test the nntrainer with Examples in Applications. There are several examples you could try and you can compile with cmake(Ubuntu) and ndk-build (Android). Tensorflow-lite is pre-requite for this example, so you have to intall it by your self. If you are trying to run on the Android, it will automatically download tensorflow (1.9.0) and compile as static library.
103 For the Training Examles, you can do like this:
106 $ cd Application/Training/jni
112 CMakeCache.txt CMakeFiles cmake_install.cmake Makefile TransferLearning
113 $ ./Transfer_learning ../../res/Training.ini ../../res/
114 ../../res/happy/happy1.bmp
115 ../../res/happy/happy2.bmp
116 ../../res/happy/happy3.bmp
117 ../../res/happy/happy4.bmp
118 ../../res/happy/happy5.bmp
119 ../../res/sad/sad1.bmp
120 ../../res/sad/sad2.bmp
126 ## Open Source License
128 The nntrainer is an open sourceOpen Source project released under the terms of the Apache License version 2.0.