Forums - Swish activation not supported by snpe

2 posts / 0 new
Last post
Swish activation not supported by snpe
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Mon, 2021-10-11 01:20

To whom it may concern:

I am trying to use EfficientNet, but it relies heavily on swish activation functions.

Swish activation functions do not seem to be supported by snpe.

How could I use swish activation functions with snpe? Would I need to define them as User Defined Operations? And if so, can you share some sample code achieving this purpose?

Thank you in advance.

Kind regards.

  • Up0
  • Down0
SahilBandar
Join Date: 23 May 18
Posts: 37
Posted: Tue, 2021-11-09 19:06

Hi 22imonreal,

You can try following approach in order to get the EfficientNet model compiled on SNPE,
 
1. Installing EfficientNet package of python in order to load EfficientNet Keras model.
    Reference : 
https://pypi.org/project/efficientnet/
2. 
Load Keras backend, set the learning phase of Keras backend to 0 before loading the model.
3. Load the Model of EfficientNet

import efficientnet.keras as efn 

model = efn.EfficientNetB0(weights='imagenet')


4. As given above, the model object will be a Keras Model, 
5. Get the tensorflow session from Keras backend and load the graph.
6. After loading the graph save the EfficientNet Model as FrozenGraph.
7. After that use the snpe-tensorflow-to-dlc tool to convert the model in DLC format.
NOTE: While following above steps, make sure that you are using Tensorflow >=1.13.2  & <=1.15.0

Hope this will resolve your issue.

Regards,
Sahil Bandar

  • 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.