To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.
1.2.3
Node 10.15
When loading in a converted layer model, I get the following error message:
Error: Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.
The model was a variation of Xception. It contains many SeparableConv2D layer and a few of them uses kernal_initializer. It appeared that the tfjs version think those fields are invalid.
const tf = require("@tensorflow/tfjs");
const tfn = require("@tensorflow/tfjs-node");
const handler = tfn.io.fileSystem("./layer_model/model.json");
const model = await tf.loadLayersModel(handler);Until this is resolved, I found a temporary work around.
print(model.outputs)
tf.saved_model.simple_save(
sess,
export_path,
inputs={'input_image': model.input},
outputs={t.name: t for t inmodel.outputs})`tensorflowjs_converter \
--input_format=tf_saved_model \
--output_format=tensorflowjs \
--output_node_names="predictions/BiasAdd:0" \
--saved_model_tags=serve \
src \
destIt appears that the fields are technically invalid for python Keras as well:
https://github.com/keras-team/keras/blob/master/keras/layers/convolutional.py#L1546
Probably what's happening here is that those fields are invalid, but the Python implementation is more permissive.
Proposed solution:
@pyu10055 should we add an option to the converter warn and strip invalid configurations rather than fail on load after conversion?
The underlying implementation of Xception is directly from tf.keras.applications with no change to any ContNet. If the use of the attributes are invalid, then the Xception implementation in tf.keras should be fixed as well.
+1
On Mon, Jul 22, 2019 at 11:02 AM Jerry Deng notifications@github.com
wrote:
The underlying implementation of Xception is directly from
tf.keras.applications with no change to any ContNet. If the use of the
attributes are invalid, then the Xception implementation in tf.keras should
be fixed as well.—
You are receiving this because you commented.Reply to this email directly, view it on GitHub
https://github.com/tensorflow/tfjs/issues/1739?email_source=notifications&email_token=AAEFSTSSJU6NHAWE6GNJKT3QAXD2FA5CNFSM4ICSFLF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2QGZSI#issuecomment-513830089,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEFSTSWANUTJNKA4RC5KALQAXD2FANCNFSM4ICSFLFQ
.
Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!
Should this be closed? This is still an issue now. Is there an update on the progress of this bug?
maybe this answer about the use of the layers model and graph model clarifies the priority for this issue: https://stackoverflow.com/a/63621486/3866264
Most helpful comment
The underlying implementation of Xception is directly from tf.keras.applications with no change to any ContNet. If the use of the attributes are invalid, then the Xception implementation in tf.keras should be fixed as well.