Hi
In SNPE, is any APIs create a network instead of loading from a model bin ?
for example, I do not have a trained model, I just want to use some APIs to set up the network (like input -> convolution -> relu -> output)
Then I could set the weights, params and inputs. And after this I could get the output.
Does SNPE support this ?
Hi,
No, SNPE does not provide such API. SNPE API is designed for on-device inference using pre-trained models..
Thanks
There is (undocumented) python API that can be used to create model and then save as a binary file (or binary buffer in memory) to be loaded and then executed via the c++ API. However, since the python API is not officially document, I am not sure how well they will be supported.
You can see the document by running the python tool
*/
python -c "import snpe; print(help(snpe.modeltools))"
FILE
/tmp/snpe-1.10.1/lib/python/snpe/libDlModelToolsPy.so
CLASSES
Boost.Python.instance(__builtin__.object)
Model
class Model(Boost.Python.instance)
| Class for building and interacting with SNPE models.
|
| Method resolution order:
| Model
| Boost.Python.instance
| __builtin__.object
|
| Methods defined here:
|
| __init__(...)
| __init__( (object)arg1) -> None
|
| __reduce__ = <unnamed Boost.Python function>(...)
|
| add_batchnorm_layer(...)
| add_batchnorm_layer( (Model)self, (str)name, (object)weights, (object)bias, (bool)compute_statistics, (bool)use_mu_sigma, (bool)across_spatial, (str)input_name, (str)output_name) -> object :
|
| Add a batch normalization layer to the network
|
| Args:
| name : str
| A name for the layer, should be unique in the network.
|
| weights : ndarray of float
| Batch normalization multiplication factors. Size should be equal to input depth.
|
| bias : ndarray of float
| Batch normalization bias terms. Size should be equal to input depth.
|
| compute_statistics : bool
| If true, compute per-image statistics and adjust weights and/or biases
|
| use_mu_sigma : bool
| If true, layer behaves like InstanceNormalization, computing mu and sigma and
| adjusting the weights and biases. If false, the layer behaves like SSD
| normalization, computing a scaled RMS value and adjusting just the weights.
|
| across_spatial : bool
| If True, all values in the spatial dimensions contribute to the values of
| the statistics by which each input activation is adjusted. For mu/sigma
| computation, this is assumed. For RMS computation, if this value is False,
| only the activation in the depth dimension at each spatial location contribute
| to the statistics.
|