Skip to content

Commit

Permalink
Merge pull request #221 from jonnor/install-instructions
Browse files Browse the repository at this point in the history
Explain install as Python packages
  • Loading branch information
majianjia authored Apr 8, 2024
2 parents efce43a + a9ec6ee commit 4d1d8fc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,34 @@ However, the available NN libs for MCU are too low-level which make it sooooo di
Therefore, we build NNoM to help embedded developers for faster and simpler deploying NN model directly to MCU.
> 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.
## Installing

NNoM can be installed as a Python package

```
pip install git+https://github.com/majianjia/nnom@master
```

NNoM requires [Tensorflow](https://www.tensorflow.org/) version `<= 2.14`.
There are multiple options for how to install this, see the TensorFlow documentation.

For example:
```
pip install 'tensorflow-cpu<=2.14.1'
```

NOTE: Tensorflow 2.14 supports up until Python 3.11.
However, *Python 3.12 is not supported*.

## Accessing C files

The C headers and source code in NNoM are distributed in the `nnom_core` Python package.
You can find its location by running the following command.
```
python -c "import nnom_core; print(nnom_core.__path__[0])"
```
In your build system, add the `inc/` and `port/` directories as include directories,
and compile the the `src/*.c` files.

## Documentations

Expand Down
4 changes: 4 additions & 0 deletions examples/auto_test/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os
#if(not os.path.exists('CMSIS_5')):
# os.system('git clone https://github.com/ARM-software/CMSIS_5.git')

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

env = Environment()
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ version = "0.5.0a1"

dependencies = [
"keras<3.0.0",
"scikit-learn<2.0.0",
]

classifiers = [
Expand Down
8 changes: 7 additions & 1 deletion scripts/nnom.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'''

import sklearn.metrics as skmetrics
import matplotlib.pyplot as plt

import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras import *
Expand Down Expand Up @@ -1137,6 +1137,9 @@ def q2f(d, Q):
return d*2**-Q

def show_weights(w, name):

import matplotlib.pyplot as plt

sz = 1
for s in w.shape:
sz = sz*s
Expand Down Expand Up @@ -1167,6 +1170,9 @@ def show_weights(w, name):
plt.show()

def compare(a,b,name):

import matplotlib.pyplot as plt

sz = 1
for s in a.shape:
sz = sz*s
Expand Down

0 comments on commit 4d1d8fc

Please sign in to comment.