Skip to content

Commit

Permalink
nnom-models: Trying to test NNoM for MobileNets model
Browse files Browse the repository at this point in the history
Not working with Keras 3.1.1 at least
Issue filed here majianjia/nnom#214
  • Loading branch information
jonnor committed Mar 24, 2024
1 parent 962159a commit df7381b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions handson/nnom-models/train_mobilenet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

import numpy
import nnom
import keras.applications

print('Keras version', keras.__version__)

model = keras.applications.MobileNet(
input_shape=(96, 96, 1),
alpha=0.25,
depth_multiplier=1,
dropout=0.001,
include_top=True,
weights=None,
pooling=None,
classes=521,
classifier_activation="softmax",
)

#model.summary()

#print(nnom.__path__)
print(dir(nnom))

out_path = "kws_weights.h"
data = numpy.random.rand(100, 96, 96, 1)
nnom.generate_model(model, data, name=out_path)


print('Wrote C code to', out_path)

0 comments on commit df7381b

Please sign in to comment.