Forums - is any APIs create a network instead of loading from a model bin ?

3 posts / 0 new
Last post
is any APIs create a network instead of loading from a model bin ?
371327487
Join Date: 10 Oct 17
Posts: 4
Posted: Thu, 2018-01-25 01:41

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 ? 

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Thu, 2018-01-25 15:30

Hi,

No, SNPE does not provide such API. SNPE API is designed for on-device inference using pre-trained models.. 

Thanks

  • Up0
  • Down0
tingfan.wu
Join Date: 1 Aug 16
Posts: 3
Posted: Sat, 2018-01-27 16:08

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.

     |          

 

*/
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.