Xilinx / DPU-PYNQ

DPU on PYNQ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when converting the quantized model (.pb) to .h5 model

Afef00 opened this issue · comments

commented

Hello,

When trying the example of Training a CNN for DPU compilation, I wanted to save and load the trained model using:

from keras.models import load_model
model.save('float_model.h5') 
model = keras.models.load_model('float_model.h5')

However, I got the following error:
ValueError: You are trying to load a weight file containing 5 layers into a model with 0 layers
Also, after the quantization of this trained model I tried to convert the quantized model (.pb) to (.h5) model using:


from tensorflow.keras.models import save_model, Sequential
model_path = './quantized_modif/quantize_eval_model'
model = tf.keras.models.load_model(model_path)
save_model(model,model_path + r"\quantized_model.h5", save_format='h5')

I got the following error: OSError: SavedModel file does not exist at: ./quantized_modif/quantize_eval_model/{saved_model.pbtxt|saved_model.pb}

Any suggestions how to fix this please?

Hopefully this has been resolved by now, closing due to lack of activity.