Trouble Deploying Existing Model to Syntiant

Question/Issue: I’m working with a Nicla Voice and am trying to convert an existing TensorFlow model into a format that can run with the NDP on the board. In both the Python SDK and the Edge Impulse Web UI, after loading the existing model I am unable to deploy as a Syntiant library as is done in this Nicla Voice tutorial. Following this other tutorial on converting TensorFlow models with the Python SDK also does not allow for deploying as a Syntiant library.

What is the process for converting an existing TensorFlow model into a form that can be deployed to the NDP120? Please let me know if there’s anything else I can supply that may help!

Hi @chaire,

This is not something possible at the moment. Syntiant deployment option is enabled only when a Syntiant processing block is part of the Impulse (additionally, this same deployment block also requires a training/test set to convert from Keras to NDP format).

Just out of curiosity, do you have access to the Syntiant TDK tooling to generate DSP features in order to use an existing TF model?

Aurelien

Hello @aurel,

Thank you for the fast response! I do not have access to the Syntiant TDK and have not been able to find much information about it online. How can I gain access to those tools?

You can reach out to them on their website if you’re an enterprise. I’d also suggest using our Expert Mode when creating/importing your model, below is the example 2D Conv model provided with the Nicla Voice project (there are a few tricks to get the model running on the NDP120 chip):

# model architecture
model = Sequential()
channels = 1
columns = 40
rows = int(input_length / (columns * channels))
model.add(Reshape((rows, columns, channels), input_shape=(input_length, )))
model.add(Permute((2,1,3))) # H and W are reversed for NDP120 Conv 2D input
# Syntiant TDK supports only valid padding
model.add(Conv2D(8, kernel_size=3, kernel_constraint=tf.keras.constraints.MaxNorm(1), padding='valid', activation='relu'))
model.add(MaxPooling2D(pool_size=2, strides=2, padding='valid'))
# Syntiant TDK supports only valid padding
model.add(Conv2D(8, kernel_size=3, kernel_constraint=tf.keras.constraints.MaxNorm(1), padding='valid', activation='relu'))
model.add(MaxPooling2D(pool_size=2, strides=2, padding='valid'))
model.add(Dropout(0.25))
# Flatten 1 dimension - Syntiant TDK only supports 2 dimensions with data
model.add(AveragePooling2D(pool_size=(model.layers[-1].output_shape[1], 1), strides=1, padding="valid"))
model.add(Flatten())
model.add(Dense(classes, name='y_pred', activation='softmax'))