Skip to content

Batch Normalization layer issues #3776

@elb3k

Description

@elb3k

TensorFlow.js 8.0.1

Problem

I am trying to convert senet50 model from keras to tensorflow.js
Conversion is successfull. But when I try to load model in JS, I get following error:

(node:3656) UnhandledPromiseRejectionWarning: Error: 212 of 329 weights are not set: conv1/7x7_s2/bn/gamma,conv1/7x7_s2/bn/beta,conv1/7x7_s2/bn/moving_mean,conv1/7x7_s2/bn/moving_variance,conv2_1_1x1_reduce/bn/gamma,conv2_1_1x1_reduce/bn/beta,conv2_1_1x1_reduce/bn/moving_mean,conv2_1_1x1_reduce/bn/moving_variance,conv2_1_3x3/bn/gamma,conv2_1_3x3/bn/beta,conv2_1_3x3/bn/moving_mean,conv2_1_3x3/bn/moving_variance,conv2_1_1x1_increase/bn/gamma,conv2_1_1x1_increase/bn/beta,conv2_1_1x1_increase/bn/moving_mean,conv2_1_1x1_increase/bn/moving_variance,conv2_1_1x1_proj/bn/gamma,conv2_1_1x1_proj/bn/beta,conv2_1_1x1_proj/bn/moving_mean,conv2_1_1x1_proj/bn/moving_variance,conv2_2_1x1_reduce/bn/gamma,conv2_2_1x1_reduce/bn/beta,conv2_2_1x1_reduce/bn/moving_mean,conv2_2_1x1_reduce/bn/moving_variance,conv2_2_3x3/bn/gamma,conv2_2_3x3/bn/beta,conv2_2_3x3/bn/moving_mean,conv2_2_3x3/bn/moving_variance,conv2_2_1x1_increase/bn/gamma,conv2_2_1x1_increase/bn/beta,conv2_2_1x1_increase/bn/moving_mean,conv2_2_1x1_increase/bn/moving_variance,conv2_3_1x1_reduce/bn/gamma,conv2_3_1x1_reduce/bn/beta,conv2_3_1x1_reduce/bn/moving_mean,conv2_3_1x1_reduce/bn/moving_variance,conv2_3_3x3/bn/gamma,conv2_3_3x3/bn/beta,conv2_3_3x3/bn/moving_mean,conv2_3_3x3/bn/moving_variance,conv2_3_1x1_increase/bn/gamma,conv2_3_1x1_increase/bn/beta,conv2_3_1x1_increase/bn/moving_mean,conv2_3_1x1_increase/bn/moving_variance,conv3_1_1x1_reduce/bn/gamma,conv3_1_1x1_reduce/bn/beta,conv3_1_1x1_reduce/bn/moving_mean,conv3_1_1x1_reduce/bn/moving_variance,conv3_1_3x3/bn/gamma,conv3_1_3x3/bn/beta,conv3_1_3x3/bn/moving_mean,conv3_1_3x3/bn/moving_variance,conv3_1_1x1_increase/bn/gamma,conv3_1_1x1_increase/bn/beta,conv3_1_1x1_increase/bn/moving_mean,conv3_1_1x1_increase/bn/moving_variance,conv3_1_1x1_proj/bn/gamma,conv3_1_1x1_proj/bn/beta,conv3_1_1x1_proj/bn/moving_mean,conv3_1_1x1_proj/bn/moving_variance,conv3_2_1x1_reduce/bn/gamma,conv3_2_1x1_reduce/bn/beta,conv3_2_1x1_reduce/bn/moving_mean,conv3_2_1x1_reduce/bn/moving_variance,conv3_2_3x3/bn/gamma,conv3_2_3x3/bn/beta,conv3_2_3x3/bn/moving_mean,conv3_2_3x3/bn/moving_variance,conv3_2_1x1_increase/bn/gamma,conv3_2_1x1_increase/bn/beta,conv3_2_1x1_increase/bn/moving_mean,conv3_2_1x1_increase/bn/moving_variance,conv3_3_1x1_reduce/bn/gamma,conv3_3_1x1_reduce/bn/beta,conv3_3_1x1_reduce/bn/moving_mean,conv3_3_1x1_reduce/bn/moving_variance,conv3_3_3x3/bn/gamma,conv3_3_3x3/bn/beta,conv3_3_3x3/bn/moving_mean,conv3_3_3x3/bn/moving_variance,conv3_3_1x1_increase/bn/gamma,conv3_3_1x1_increase/bn/beta,conv3_3_1x1_increase/bn/moving_mean,conv3_3_1x1_increase/bn/moving_variance,conv3_4_1x1_reduce/bn/gamma,conv3_4_1x1_reduce/bn/beta,conv3_4_1x1_reduce/bn/moving_mean,conv3_4_1x1_reduce/bn/moving_variance,conv3_4_3x3/bn/gamma,conv3_4_3x3/bn/beta,conv3_4_3x3/bn/moving_mean,conv3_4_3x3/bn/moving_variance,conv3_4_1x1_increase/bn/gamma,conv3_4_1x1_increase/bn/beta,conv3_4_1x1_increase/bn/moving_mean,conv3_4_1x1_increase/bn/moving_variance,conv4_1_1x1_reduce/bn/gamma,conv4_1_1x1_reduce/bn/beta,conv4_1_1x1_reduce/bn/moving_mean,conv4_1_1x1_reduce/bn/moving_variance,conv4_1_3x3/bn/gamma,conv4_1_3x3/bn/beta,conv4_1_3x3/bn/moving_mean,conv4_1_3x3/bn/moving_variance,conv4_1_1x1_increase/bn/gamma,conv4_1_1x1_increase/bn/beta,conv4_1_1x1_increase/bn/moving_mean,conv4_1_1x1_increase/bn/moving_variance,conv4_1_1x1_proj/bn/gamma,conv4_1_1x1_proj/bn/beta,conv4_1_1x1_proj/bn/moving_mean,conv4_1_1x1_proj/bn/moving_variance,conv4_2_1x1_reduce/bn/gamma,conv4_2_1x1_reduce/bn/beta,conv4_2_1x1_reduce/bn/moving_mean,conv4_2_1x1_reduce/bn/moving_variance,conv4_2_3x3/bn/gamma,conv4_2_3x3/bn/beta,conv4_2_3x3/bn/moving_mean,conv4_2_3x3/bn/moving_variance,conv4_2_1x1_increase/bn/gamma,conv4_2_1x1_increase/bn/beta,conv4_2_1x1_increase/bn/moving_mean,conv4_2_1x1_increase/bn/moving_variance,conv4_3_1x1_reduce/bn/gamma,conv4_3_1x1_reduce/bn/beta,conv4_3_1x1_reduce/bn/moving_mean,conv4_3_1x1_reduce/bn/moving_variance,conv4_3_3x3/bn/gamma,conv4_3_3x3/bn/beta,conv4_3_3x3/bn/moving_mean,conv4_3_3x3/bn/moving_variance,conv4_3_1x1_increase/bn/gamma,conv4_3_1x1_increase/bn/beta,conv4_3_1x1_increase/bn/moving_mean,conv4_3_1x1_increase/bn/moving_variance,conv4_4_1x1_reduce/bn/gamma,conv4_4_1x1_reduce/bn/beta,conv4_4_1x1_reduce/bn/moving_mean,conv4_4_1x1_reduce/bn/moving_variance,conv4_4_3x3/bn/gamma,conv4_4_3x3/bn/beta,conv4_4_3x3/bn/moving_mean,conv4_4_3x3/bn/moving_variance,conv4_4_1x1_increase/bn/gamma,conv4_4_1x1_increase/bn/beta,conv4_4_1x1_increase/bn/moving_mean,conv4_4_1x1_increase/bn/moving_variance,conv4_5_1x1_reduce/bn/gamma,conv4_5_1x1_reduce/bn/beta,conv4_5_1x1_reduce/bn/moving_mean,conv4_5_1x1_reduce/bn/moving_variance,conv4_5_3x3/bn/gamma,conv4_5_3x3/bn/beta,conv4_5_3x3/bn/moving_mean,conv4_5_3x3/bn/moving_variance,conv4_5_1x1_increase/bn/gamma,conv4_5_1x1_increase/bn/beta,conv4_5_1x1_increase/bn/moving_mean,conv4_5_1x1_increase/bn/moving_variance,conv4_6_1x1_reduce/bn/gamma,conv4_6_1x1_reduce/bn/beta,conv4_6_1x1_reduce/bn/moving_mean,conv4_6_1x1_reduce/bn/moving_variance,conv4_6_3x3/bn/gamma,conv4_6_3x3/bn/beta,conv4_6_3x3/bn/moving_mean,conv4_6_3x3/bn/moving_variance,conv4_6_1x1_increase/bn/gamma,conv4_6_1x1_increase/bn/beta,conv4_6_1x1_increase/bn/moving_mean,conv4_6_1x1_increase/bn/moving_variance,conv5_1_1x1_reduce/bn/gamma,conv5_1_1x1_reduce/bn/beta,conv5_1_1x1_reduce/bn/moving_mean,conv5_1_1x1_reduce/bn/moving_variance,conv5_1_3x3/bn/gamma,conv5_1_3x3/bn/beta,conv5_1_3x3/bn/moving_mean,conv5_1_3x3/bn/moving_variance,conv5_1_1x1_increase/bn/gamma,conv5_1_1x1_increase/bn/beta,conv5_1_1x1_increase/bn/moving_mean,conv5_1_1x1_increase/bn/moving_variance,conv5_1_1x1_proj/bn/gamma,conv5_1_1x1_proj/bn/beta,conv5_1_1x1_proj/bn/moving_mean,conv5_1_1x1_proj/bn/moving_variance,conv5_2_1x1_reduce/bn/gamma,conv5_2_1x1_reduce/bn/beta,conv5_2_1x1_reduce/bn/moving_mean,conv5_2_1x1_reduce/bn/moving_variance,conv5_2_3x3/bn/gamma,conv5_2_3x3/bn/beta,conv5_2_3x3/bn/moving_mean,conv5_2_3x3/bn/moving_variance,conv5_2_1x1_increase/bn/gamma,conv5_2_1x1_increase/bn/beta,conv5_2_1x1_increase/bn/moving_mean,conv5_2_1x1_increase/bn/moving_variance,conv5_3_1x1_reduce/bn/gamma,conv5_3_1x1_reduce/bn/beta,conv5_3_1x1_reduce/bn/moving_mean,conv5_3_1x1_reduce/bn/moving_variance,conv5_3_3x3/bn/gamma,conv5_3_3x3/bn/beta,conv5_3_3x3/bn/moving_mean,conv5_3_3x3/bn/moving_variance,conv5_3_1x1_increase/bn/gamma,conv5_3_1x1_increase/bn/beta,conv5_3_1x1_increase/bn/moving_mean,conv5_3_1x1_increase/bn/moving_variance
    at new ValueError (/home/ai/Projects/Face-app/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:176:28)
    at LayersModel.Container.loadWeights (/home/ai/Projects/Face-app/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:6758:23)
    at /home/ai/Projects/Face-app/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:10404:27
    at step (/home/ai/Projects/Face-app/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:94:23)
    at Object.next (/home/ai/Projects/Face-app/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:75:53)
    at fulfilled (/home/ai/Projects/Face-app/node_modules/@tensorflow/tfjs-layers/dist/tf-layers.node.js:65:58)
(node:3656) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3656) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

All the weights are belongs to BatchNormalization layer. And BatchNormalization layer is done in channel axis.
Here you can find code for keras model
I included original .h5 model file

I have seen related error regarding conversion of Resnet-50 too ( which also has bunch of BatchNormalization layers)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions