I am porting the Tensorflow Pix2Pix example to run in the browser with TFJS. My training has no issues, and good sample images are exported from the model periodically throughout training.
To export to TFJS, I load the generator model from the latest checkpoint, and use model.save(model_name.h5, save_format='h5').
I then convert the model to a tensorflow js model using tensorflowjs_converter --input_format=keras model_name.h5 tfjs_model
When loading the model in the browser, I get the following error:
Error: The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.
This is puzzling because the first layer of the generator does have an input shape defined:
def Generator(filters):
inputs = tf.keras.layers.Input(shape=[256, 256, 3])
Also, when visualizing the model before export, it also appears to have an input shape defined.
I'm using tensorflow 2.1.0 and tensorflowjs 1.7.2.
Any suggestions on how to solve?
I've also tried to export in the TF saved_model format, but that model predicts only NaNs. I'm assuming something more problematic is involved?