After running the demo programs for object and face recognition, I want to implement a simple example starting from the very beginning on the Maixduino. For this I took the pima-indians-diabetes case for diabetes classification, because it only has 768 simple training records.
Each record has 8 input data plus label, e.g.
For this, I use the simple keras-model, which runs successfully on my Ubuntu-PC:
model = Sequential()
model.add(Dense(12, input_dim=8, activation=‘relu’))
Then the generated h5-file is converted to tflite by the following program:
#Convert Keras to tflite
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_keras_model_file( ‘Keras1.h5’ )
tflite_model = converter.convert()
In order to get it on the kpu, I use nncase with the following command:
./ncc/ncc compile Keras1.tflite Keras1.kmodel -i tflite -o kmodel -t k210 --dataset-format raw --inference-type float
And indeed a kmodel has been generated:
0 dense_1_input 1x8
0 dense_3/Sigmoid 1x1
Now I have some questions:
- Is it possible to transfer sequential models to kpu or is the device restricted to CNNs?
- Is the nncase command OK?
- Must the kmodel format before flashing converted to kfpkg or can it be placed directly on 0x300000?
- Which micropy instruction I have to perform after task = kpu.load(0x300000) in order to test the model?
Because I am writing now an article for a well known electronic magazine in Germany (and Europe), it would be very helpful to find a solution.
So any help is very welcome!
Many thanks and best regards