Skip to content

Commit 3f24572

Browse files
authored
Merge pull request #34 from majianjia/dev update documentation
Dev
2 parents 305369d + d0bc6fd commit 3f24572

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+136
-386
lines changed

LICENSE

Lines changed: 5 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,5 @@
1-
======================================================================
2-
Nerual Netowrk on Microcontroller (NNoM) License
3-
======================================================================
4-
GNU LESSER GENERAL PUBLIC LICENSE
5-
Version 3, 29 June 2007
61

7-
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
8-
Everyone is permitted to copy and distribute verbatim copies
9-
of this license document, but changing it is not allowed.
10-
11-
12-
This version of the GNU Lesser General Public License incorporates
13-
the terms and conditions of version 3 of the GNU General Public
14-
License, supplemented by the additional permissions listed below.
15-
16-
0. Additional Definitions.
17-
18-
As used herein, "this License" refers to version 3 of the GNU Lesser
19-
General Public License, and the "GNU GPL" refers to version 3 of the GNU
20-
General Public License.
21-
22-
"The Library" refers to a covered work governed by this License,
23-
other than an Application or a Combined Work as defined below.
24-
25-
An "Application" is any work that makes use of an interface provided
26-
by the Library, but which is not otherwise based on the Library.
27-
Defining a subclass of a class defined by the Library is deemed a mode
28-
of using an interface provided by the Library.
29-
30-
A "Combined Work" is a work produced by combining or linking an
31-
Application with the Library. The particular version of the Library
32-
with which the Combined Work was made is also called the "Linked
33-
Version".
34-
35-
The "Minimal Corresponding Source" for a Combined Work means the
36-
Corresponding Source for the Combined Work, excluding any source code
37-
for portions of the Combined Work that, considered in isolation, are
38-
based on the Application, and not on the Linked Version.
39-
40-
The "Corresponding Application Code" for a Combined Work means the
41-
object code and/or source code for the Application, including any data
42-
and utility programs needed for reproducing the Combined Work from the
43-
Application, but excluding the System Libraries of the Combined Work.
44-
45-
1. Exception to Section 3 of the GNU GPL.
46-
47-
You may convey a covered work under sections 3 and 4 of this License
48-
without being bound by section 3 of the GNU GPL.
49-
50-
2. Conveying Modified Versions.
51-
52-
If you modify a copy of the Library, and, in your modifications, a
53-
facility refers to a function or data to be supplied by an Application
54-
that uses the facility (other than as an argument passed when the
55-
facility is invoked), then you may convey a copy of the modified
56-
version:
57-
58-
a) under this License, provided that you make a good faith effort to
59-
ensure that, in the event an Application does not supply the
60-
function or data, the facility still operates, and performs
61-
whatever part of its purpose remains meaningful, or
62-
63-
b) under the GNU GPL, with none of the additional permissions of
64-
this License applicable to that copy.
65-
66-
3. Object Code Incorporating Material from Library Header Files.
67-
68-
The object code form of an Application may incorporate material from
69-
a header file that is part of the Library. You may convey such object
70-
code under terms of your choice, provided that, if the incorporated
71-
material is not limited to numerical parameters, data structure
72-
layouts and accessors, or small macros, inline functions and templates
73-
(ten or fewer lines in length), you do both of the following:
74-
75-
a) Give prominent notice with each copy of the object code that the
76-
Library is used in it and that the Library and its use are
77-
covered by this License.
78-
79-
b) Accompany the object code with a copy of the GNU GPL and this license
80-
document.
81-
82-
4. Combined Works.
83-
84-
You may convey a Combined Work under terms of your choice that,
85-
taken together, effectively do not restrict modification of the
86-
portions of the Library contained in the Combined Work and reverse
87-
engineering for debugging such modifications, if you also do each of
88-
the following:
89-
90-
a) Give prominent notice with each copy of the Combined Work that
91-
the Library is used in it and that the Library and its use are
92-
covered by this License.
93-
94-
b) Accompany the Combined Work with a copy of the GNU GPL and this license
95-
document.
96-
97-
c) For a Combined Work that displays copyright notices during
98-
execution, include the copyright notice for the Library among
99-
these notices, as well as a reference directing the user to the
100-
copies of the GNU GPL and this license document.
101-
102-
d) Do one of the following:
103-
104-
0) Convey the Minimal Corresponding Source under the terms of this
105-
License, and the Corresponding Application Code in a form
106-
suitable for, and under terms that permit, the user to
107-
recombine or relink the Application with a modified version of
108-
the Linked Version to produce a modified Combined Work, in the
109-
manner specified by section 6 of the GNU GPL for conveying
110-
Corresponding Source.
111-
112-
1) Use a suitable shared library mechanism for linking with the
113-
Library. A suitable mechanism is one that (a) uses at run time
114-
a copy of the Library already present on the user's computer
115-
system, and (b) will operate properly with a modified version
116-
of the Library that is interface-compatible with the Linked
117-
Version.
118-
119-
e) Provide Installation Information, but only if you would otherwise
120-
be required to provide such information under section 6 of the
121-
GNU GPL, and only to the extent that such information is
122-
necessary to install and execute a modified version of the
123-
Combined Work produced by recombining or relinking the
124-
Application with a modified version of the Linked Version. (If
125-
you use option 4d0, the Installation Information must accompany
126-
the Minimal Corresponding Source and Corresponding Application
127-
Code. If you use option 4d1, you must provide the Installation
128-
Information in the manner specified by section 6 of the GNU GPL
129-
for conveying Corresponding Source.)
130-
131-
5. Combined Libraries.
132-
133-
You may place library facilities that are a work based on the
134-
Library side by side in a single library together with other library
135-
facilities that are not Applications and are not covered by this
136-
License, and convey such a combined library under terms of your
137-
choice, if you do both of the following:
138-
139-
a) Accompany the combined library with a copy of the same work based
140-
on the Library, uncombined with any other library facilities,
141-
conveyed under the terms of this License.
142-
143-
b) Give prominent notice with the combined library that part of it
144-
is a work based on the Library, and explaining where to find the
145-
accompanying uncombined form of the same work.
146-
147-
6. Revised Versions of the GNU Lesser General Public License.
148-
149-
The Free Software Foundation may publish revised and/or new versions
150-
of the GNU Lesser General Public License from time to time. Such new
151-
versions will be similar in spirit to the present version, but may
152-
differ in detail to address new problems or concerns.
153-
154-
Each version is given a distinguishing version number. If the
155-
Library as you received it specifies that a certain numbered version
156-
of the GNU Lesser General Public License "or any later version"
157-
applies to it, you have the option of following the terms and
158-
conditions either of that published version or of any later version
159-
published by the Free Software Foundation. If the Library as you
160-
received it does not specify a version number of the GNU Lesser
161-
General Public License, you may choose any version of the GNU Lesser
162-
General Public License ever published by the Free Software Foundation.
163-
164-
If the Library as you received it specifies that a proxy can decide
165-
whether future versions of the GNU Lesser General Public License shall
166-
apply, that proxy's public statement of acceptance of any version is
167-
permanent authorization for you to choose that version for the
168-
Library.
169-
170-
End of license for NNoM.
171-
==========================================================================
172-
173-
==========================================================================
174-
A part of codes in src/nnom_local.c & src/nnom_local.h was modified from
175-
CMSIS lib https://github.com/ARM-software/CMSIS_5 which is relased under
176-
the license below:
177-
178-
Apache License
2+
Apache License
1793
Version 2.0, January 2004
1804
http://www.apache.org/licenses/
1815

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

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

366-
Copyright {yyyy} {name of copyright owner}
190+
Copyright [yyyy] [name of copyright owner]
367191

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

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ NNoM is a higher-level layer-based Neural Network library specifically for micro
1212
- High-performance backend selections.
1313
- Onboard (MCU) evaluation tools; Runtime analysis, Top-k, Confusion matrix...
1414

15+
**Licenses**
16+
17+
NNoM is released under Apache License 2.0 since nnom-V0.2.0.
18+
License and copyright information can be found within the code.
19+
1520
## Why NNoM?
1621
The aims of NNoM is to provide a light-weight, user-friendly and flexible interface for fast deploying.
1722

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

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

3540

36-
---
37-
3841
## Documentations
3942
API manuals are available in **[API Manual](https://majianjia.github.io/nnom/)**
4043

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

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

53-
---
54-
5556
## Examples
5657

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

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

67-
---
6868

6969

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

119-
120-
121119
## Dependencies
122120

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

125123

126-
127124
## Optimization
128125
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.
129126

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

132-
133-
134129
## Contacts
135130
Jianjia Ma
136131

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

142-

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ NNoM is a higher-level layer-based Neural Network library specifically for micro
1212
- High-performance backend selections.
1313
- Onboard (MCU) evaluation tools; Runtime analysis, Top-k, Confusion matrix...
1414

15+
**Licenses**
16+
17+
NNoM is released under Apache License 2.0 since nnom-V0.2.0.
18+
License and copyright information can be found within the code.
19+
1520
---
1621

1722
## Why NNoM?

examples/keyword_spotting/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Keyword Spotting example
2+
3+
> This example is under development, the codes are supposed to be changed during the period.
4+
5+
Documentation under writing.

examples/keyword_spotting/mcu/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2018-2019, Jianjia Ma
33
*
4-
* SPDX-License-Identifier: LGPL-3.0
4+
* SPDX-License-Identifier: Apache-2.0
55
*
66
* Change Logs:
77
* Date Author Notes

examples/keyword_spotting/mcu/mfcc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17+
*
18+
* Modified by Jianjia Ma for C implementation.
19+
*
1720
*/
1821

1922
/*

examples/keyword_spotting/mcu/mfcc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17+
*
18+
* Modified by Jianjia Ma for C implementation
19+
*
1720
*/
1821

1922
#ifndef __KWS_MFCC_H__

examples/keyword_spotting/model/kws.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
import matplotlib.pyplot as plt
44
from matplotlib import cm
5-
import os
6-
75
import keras
86
from keras.models import Sequential, load_model
97
from keras.preprocessing.image import ImageDataGenerator
108
from keras.models import Model
119
from keras.layers import *
1210
from keras.callbacks import ModelCheckpoint
13-
from nnom_utils import *
1411

12+
import os
13+
import sys
14+
nnscript = os.path.abspath('../../scripts')
15+
sys.path.append(nnscript)
16+
17+
from nnom_utils import *
1518
from mfcc import *
1619

1720
model_path = 'model.h5'

examples/mnist-cnn/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a very simple convolution example following the Keras tutorial:
2+
3+
https://adventuresinmachinelearning.com/keras-tutorial-cnn-11-lines/

examples/mnist-cnn/SConstruct

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
import os
3+
4+
if(not os.path.exists('CMSIS_5')):
5+
os.system('git clone https://github.com/ARM-software/CMSIS_5.git')
6+
7+
ROOT=os.path.abspath('../..')
8+
9+
env = Environment()
10+
env.Replace(
11+
ARCOMSTR = 'AR $SOURCE',
12+
ASCOMSTR = 'AS $SOURCE',
13+
ASPPCOMSTR = 'AS $SOURCE',
14+
CCCOMSTR = 'CC $SOURCE',
15+
CXXCOMSTR = 'CXX $SOURCE',
16+
LINKCOMSTR = 'LINK $TARGET'
17+
)
18+
19+
objs = []
20+
21+
objs += Glob('CMSIS_5/CMSIS/NN/Source/*/*.c')
22+
objs += Glob('CMSIS_5/CMSIS/DSP/Source/BasicMathFunctions/arm_*.c')
23+
objs += Glob('mcu/main_cnn.c')
24+
25+
26+
env.Append(CPPPATH=['CMSIS_5/CMSIS/NN/Include',
27+
'CMSIS_5/CMSIS/DSP/Include',
28+
'CMSIS_5/CMSIS/Core/Include'])
29+
env.Append(CPPDEFINES=['__ARM_ARCH_8M_BASE__'])
30+
env.Append(CCFLAGS=['-g','-O0','-std=gnu99'])
31+
32+
objs +=Glob('%s/src/*.c'%(ROOT))
33+
env.Append(CPPPATH=['%s/inc'%(ROOT),'%s/port'%(ROOT)])
34+
env.Append(CPPDEFINES=['USE_NNOM_OUTPUT_SAVE'])
35+
36+
if(os.getenv('USE_CMSIS_NN') == 'YES'):
37+
env.Append(CPPDEFINES=['NNOM_USING_CMSIS_NN'])
38+
39+
env.Program('mnist',objs)
40+

examples/mnist-cnn/mcu/weights_cnn.h

Whitespace-only changes.

0 commit comments

Comments
 (0)