Forums - Unable to load the frozen model (.pb) in GraphDef in tensorflow version 2.x

2 posts / 0 new
Last post
Unable to load the frozen model (.pb) in GraphDef in tensorflow version 2.x
alisaux.bpn53
Join Date: 27 Dec 22
Posts: 1
Posted: Tue, 2022-12-27 00:26

Now Here's the main issue: https://my-accountaccess.com/

I'm getting same error when converting .pb to .dlc (Qualcomm). Actually I want to run original model on Qualcomm's Hexagon DSP or GPU.

  1. Created a simple dummy sequential model in tf.keras as shown below:

    model = tf.keras.Sequential()
    model.add(layers.Dense(10, input_shape=(100, 100)))
    model.add(layers.Conv1D(3, 2))
    model.add(layers.Flatten())
    model.add(layers.Dense(10, activation='softmax', name='predict_10'))
    
  2. Trained the model and saved it using tf.keras.models.saved_model.

  3. To get the input input and output node names used saved_model_cli.

    saved_model_cli show --dir "path/to/SavedModel" --all
  4. Froze the saved model with freeze_graph.py utility.

    python freeze_graph.py --input_saved_model_dir=<path/to/SavedModel> --output_graph=<path/freeze.pb> --input_binary=True --output_node_names=StatefulPartitionedCall
    

    Model is frozen.

    1. To load the frozen graph I've used this guide Migrate tf1.x to tf2.x (wrap_frozen_graph)
    2. Used
      with tf.io.gfile.GFile("patf/to/freeze.pb", 'rb') as f:
         graph_def = tf.compat.v1.GraphDef()
         graph_def.ParseFromString(f.read())
      load_frozen = wrap_frozen_graph(graph_def, inputs='dense_3_input:0', outputs='predict_10:0')
      
    3. Output error ValueError: Input 1 of node StatefulPartitionedCall was passed float from dense_3/kernel:0 incompatible with expected resource.
  5.  
  • Up0
  • Down0
handzhu
Join Date: 6 Jun 22
Posts: 54
Posted: Tue, 2022-12-27 01:17
  • 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.