# Deploy on Syntiant Hardware
Note: This functionality is currently only available in the latest pre-release version of Imagimob Studio. Request access at email@example.com.
We have a model in a HDF5 format (.h5) trained in Imagimob Studio and it is now time to turn this model into a format that we can deploy on the Syntiant NDP 1XX platform. Read more about the Syntiant NDP platforms and access the documentation at Syntiant (opens new window)
# Open h5 file
Open the .h5 file that has already been trained using Imagimob Studio and go to the Edge tab.
In the Architecture field we can select to optimize the .h5 model for different target architectures. Choose Syntiant.
In the Target Device field, choose which Syntiant NDP core to build for. Currently NDP120 is supported. NDP10X and NDP115 support is experimental.
# Posterior handler
The NDP cores supports different levels of postprocessing of the predictions that are given by the model during runtime. This is referred to as posterior handling.
The most common and simple postprocessing is to define a confidence threshold for the model output. This means that only predictions that are above the confidence level will be outputted. This is good practice as low confidence values indicate that the prediction is a false positive. This value is expressed as a value between [0.0, 1.0]. The default value is 0.85, requiring a confidence level of > 85%.
To unlock the full posterior handling capabilities of the hardware you can provide your own custom posterior handler file. This allows you to define advanced post processing of the model predictions, for example defining a state machine requiring certain predictions to happen in order etc. Refer to the Syntiant documentation for your specific NDP core for more information.
# Representative data set
At build time, the model is optimized for the selected target platform in terms of both memory and execution speed. This process involves compressing the training parameters of the model. To ensure that the prediction accuracy of the model is retained during this process it is recommended to pass a representative data set for verify model performance.
# Use project file
The simplest way to pass a representative data set is to use the Project file field to point to the project (.improj) file that you used to generate and train the model.
# Recursive Directory Search
If you've trained your h5 model outside of Imagimob Studio you can specify a folder and let the software search for representative data set files to send.
# Build Edge
You are now ready to Build the Edge model.
Click on the "Build Edge" button.
Then click 'OK' in the next dialog to use all your data for quantization and verification of the compiled model.
Note: If your representative dataset is large, you will get a warning and will be recommended to limit the data amount inside this dialog.
The model is now automatically built and tested using the Syntiant compiler service. This might take up to several minutes depending on the size of the representative dataset. At completion all necessary files for deploying on the NDP target will be generated. You will also get a log file with detailed information about your model.
# Build Output
In this field you will get information about the model build process and any potential build errors.
Now we have finished converting our tensorflow model into a Edge model that consumes a fraction of the memory/processing power during runtime!
# Output files (for deployment)
- log.txt <- build and model information, containing verification results, target resource usage etc
- *.synpkg <- compiled model in binary format
- imagimob_spi.txt <- spi commands for configuring the NDP core
# Output files (for testing on hardware)
Note: The model verification has already been done during the build process. The results of the verification can be seen in log.txt. These files were used in this test. You can use these files if you for some reason want to perform more tests on your hardware device.
- melbins.zip <- the representative dataset in NDP compatible melbin format (can be used for verification on hardware)
- sampled.npy <- representative dataset in numpy format
- h5_predictions.npy <- h5 model predictions on the representative dataset in numpy format
If you have problems with building Syntiant models in Imagimob Studio, reach out to us: Imagimob slack community (opens new window) or through firstname.lastname@example.org
Note: Building for Syntiant hardware requires that you are connected to the Internet as the model conversion is happening in the Syntiant Compiler Service provided by Imagimob. No data or model files are ever saved in our Cloud during conversion.