Skip to content

Commit 4d1d8fc

Browse files
authored
Merge pull request #221 from jonnor/install-instructions
Explain install as Python packages
2 parents efce43a + a9ec6ee commit 4d1d8fc

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,34 @@ However, the available NN libs for MCU are too low-level which make it sooooo di
6565
Therefore, we build NNoM to help embedded developers for faster and simpler deploying NN model directly to MCU.
6666
> 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.
6767
68+
## Installing
6869

70+
NNoM can be installed as a Python package
6971

72+
```
73+
pip install git+https://github.com/majianjia/nnom@master
74+
```
75+
76+
NNoM requires [Tensorflow](https://www.tensorflow.org/) version `<= 2.14`.
77+
There are multiple options for how to install this, see the TensorFlow documentation.
78+
79+
For example:
80+
```
81+
pip install 'tensorflow-cpu<=2.14.1'
82+
```
83+
84+
NOTE: Tensorflow 2.14 supports up until Python 3.11.
85+
However, *Python 3.12 is not supported*.
86+
87+
## Accessing C files
88+
89+
The C headers and source code in NNoM are distributed in the `nnom_core` Python package.
90+
You can find its location by running the following command.
91+
```
92+
python -c "import nnom_core; print(nnom_core.__path__[0])"
93+
```
94+
In your build system, add the `inc/` and `port/` directories as include directories,
95+
and compile the the `src/*.c` files.
7096

7197
## Documentations
7298

examples/auto_test/SConstruct

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os
33
#if(not os.path.exists('CMSIS_5')):
44
# os.system('git clone https://github.com/ARM-software/CMSIS_5.git')
55

6+
# Specify the path to NNoM C files
7+
# When NNoM is installed as Python package, you can find this using
8+
# python -c "import nnom_core; print(nnom_core.__path__[0])"
9+
# Otherwise, use the path to the NNoM git repository root.
610
ROOT=os.path.abspath('../..')
711

812
env = Environment()

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ version = "0.5.0a1"
2121

2222
dependencies = [
2323
"keras<3.0.0",
24+
"scikit-learn<2.0.0",
2425
]
2526

2627
classifiers = [

scripts/nnom.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'''
1212

1313
import sklearn.metrics as skmetrics
14-
import matplotlib.pyplot as plt
14+
1515
import tensorflow as tf
1616
import tensorflow.keras.backend as K
1717
from tensorflow.keras import *
@@ -1137,6 +1137,9 @@ def q2f(d, Q):
11371137
return d*2**-Q
11381138

11391139
def show_weights(w, name):
1140+
1141+
import matplotlib.pyplot as plt
1142+
11401143
sz = 1
11411144
for s in w.shape:
11421145
sz = sz*s
@@ -1167,6 +1170,9 @@ def show_weights(w, name):
11671170
plt.show()
11681171

11691172
def compare(a,b,name):
1173+
1174+
import matplotlib.pyplot as plt
1175+
11701176
sz = 1
11711177
for s in a.shape:
11721178
sz = sz*s

0 commit comments

Comments
 (0)