Skip to content

Commit

Permalink
Merge pull request #34 from majianjia/dev update documentation
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
majianjia authored Apr 28, 2019
2 parents 305369d + d0bc6fd commit 3f24572
Show file tree
Hide file tree
Showing 42 changed files with 136 additions and 386 deletions.
185 changes: 5 additions & 180 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,181 +1,5 @@
======================================================================
Nerual Netowrk on Microcontroller (NNoM) License
======================================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.

"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.

An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.

A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".

The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:

a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or

b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the object code with a copy of the GNU GPL and this license
document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:

a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.

c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.

1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.

e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:

a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.

b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

End of license for NNoM.
==========================================================================

==========================================================================
A part of codes in src/nnom_local.c & src/nnom_local.h was modified from
CMSIS lib https://github.com/ARM-software/CMSIS_5 which is relased under
the license below:

Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Expand Down Expand Up @@ -355,15 +179,15 @@ the license below:
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -375,4 +199,5 @@ the license below:
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.

18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ NNoM is a higher-level layer-based Neural Network library specifically for micro
- High-performance backend selections.
- Onboard (MCU) evaluation tools; Runtime analysis, Top-k, Confusion matrix...

**Licenses**

NNoM is released under Apache License 2.0 since nnom-V0.2.0.
License and copyright information can be found within the code.

## Why NNoM?
The aims of NNoM is to provide a light-weight, user-friendly and flexible interface for fast deploying.

Expand All @@ -27,14 +32,12 @@ After 2014, the development of Neural Networks are more focus on structure optim
However, the available NN libs for MCU are too low-level which make it sooooo difficult to use with these complex strucures.

Therefore, we build NNoM to help embedded developers to faster and simpler deploying NN model directly to MCU.
> NNoM will manage the strucutre, memory and everything else for developer. All you need is feeding your measurements then get the results.
> NNoM will manage the strucutre, memory and everything else for the developer. All you need to do is feeding your new measurements and getting the results.
**NNoM is now working closely with Keras (You can easily learn [**Keras**](https://keras.io/) in 30 seconds!).**
There is no need to learn TensorFlow/Lite or other libs.


---

## Documentations
API manuals are available in **[API Manual](https://majianjia.github.io/nnom/)**

Expand All @@ -50,8 +53,6 @@ API manuals are available in **[API Manual](https://majianjia.github.io/nnom/)**

[RT-Thread-MNIST example (中文例子)](docs/example_mnist_simple_cn.md)

---

## Examples

**Documented examples**
Expand All @@ -64,7 +65,6 @@ API manuals are available in **[API Manual](https://majianjia.github.io/nnom/)**

Please check [examples](https://github.com/majianjia/nnom/tree/master/examples) for more applications.

---


## Available Operations
Expand Down Expand Up @@ -116,21 +116,16 @@ Activation can be used by itself as layer, or can be attached to the previous la
| Substraction | Beta|Sub()||
| Dot | Under Dev. |||



## Dependencies

NNoM now use the local pure C backend implementation by default. Thus, there is no special dependency needed.



## Optimization
You can select [CMSIS-NN/DSP](https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/NN) as the backend for about 5x performance with ARM-Cortex-M4/7/33/35P.

Check [Porting and optimising Guide](docs/Porting_and_Optimisation_Guide.md) for detail.



## Contacts
Jianjia Ma

Expand All @@ -139,4 +134,3 @@ [email protected] or [email protected]
## Citation Required
Please contact us using above details.


5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ NNoM is a higher-level layer-based Neural Network library specifically for micro
- High-performance backend selections.
- Onboard (MCU) evaluation tools; Runtime analysis, Top-k, Confusion matrix...

**Licenses**

NNoM is released under Apache License 2.0 since nnom-V0.2.0.
License and copyright information can be found within the code.

---

## Why NNoM?
Expand Down
5 changes: 5 additions & 0 deletions examples/keyword_spotting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Keyword Spotting example

> This example is under development, the codes are supposed to be changed during the period.
Documentation under writing.
4 changes: 2 additions & 2 deletions examples/keyword_spotting/mcu/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
* Copyright (c) 2018-2019, Jianjia Ma
*
* SPDX-License-Identifier: LGPL-3.0
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
Expand Down
3 changes: 3 additions & 0 deletions examples/keyword_spotting/mcu/mfcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modified by Jianjia Ma for C implementation.
*
*/

/*
Expand Down
3 changes: 3 additions & 0 deletions examples/keyword_spotting/mcu/mfcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modified by Jianjia Ma for C implementation
*
*/

#ifndef __KWS_MFCC_H__
Expand Down
9 changes: 6 additions & 3 deletions examples/keyword_spotting/model/kws.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

import matplotlib.pyplot as plt
from matplotlib import cm
import os

import keras
from keras.models import Sequential, load_model
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Model
from keras.layers import *
from keras.callbacks import ModelCheckpoint
from nnom_utils import *

import os
import sys
nnscript = os.path.abspath('../../scripts')
sys.path.append(nnscript)

from nnom_utils import *
from mfcc import *

model_path = 'model.h5'
Expand Down
3 changes: 3 additions & 0 deletions examples/mnist-cnn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a very simple convolution example following the Keras tutorial:

https://adventuresinmachinelearning.com/keras-tutorial-cnn-11-lines/
40 changes: 40 additions & 0 deletions examples/mnist-cnn/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

import os

if(not os.path.exists('CMSIS_5')):
os.system('git clone https://github.com/ARM-software/CMSIS_5.git')

ROOT=os.path.abspath('../..')

env = Environment()
env.Replace(
ARCOMSTR = 'AR $SOURCE',
ASCOMSTR = 'AS $SOURCE',
ASPPCOMSTR = 'AS $SOURCE',
CCCOMSTR = 'CC $SOURCE',
CXXCOMSTR = 'CXX $SOURCE',
LINKCOMSTR = 'LINK $TARGET'
)

objs = []

objs += Glob('CMSIS_5/CMSIS/NN/Source/*/*.c')
objs += Glob('CMSIS_5/CMSIS/DSP/Source/BasicMathFunctions/arm_*.c')
objs += Glob('mcu/main_cnn.c')


env.Append(CPPPATH=['CMSIS_5/CMSIS/NN/Include',
'CMSIS_5/CMSIS/DSP/Include',
'CMSIS_5/CMSIS/Core/Include'])
env.Append(CPPDEFINES=['__ARM_ARCH_8M_BASE__'])
env.Append(CCFLAGS=['-g','-O0','-std=gnu99'])

objs +=Glob('%s/src/*.c'%(ROOT))
env.Append(CPPPATH=['%s/inc'%(ROOT),'%s/port'%(ROOT)])
env.Append(CPPDEFINES=['USE_NNOM_OUTPUT_SAVE'])

if(os.getenv('USE_CMSIS_NN') == 'YES'):
env.Append(CPPDEFINES=['NNOM_USING_CMSIS_NN'])

env.Program('mnist',objs)

File renamed without changes.
Empty file.
Loading

0 comments on commit 3f24572

Please sign in to comment.