diff --git a/src/modules/Animal_class/LICENSE b/src/modules/Animal_class/LICENSE new file mode 100644 index 0000000..a5ca878 --- /dev/null +++ b/src/modules/Animal_class/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Aryan Misra + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/modules/Animal_class/animal_classes.js b/src/modules/Animal_class/animal_classes.js new file mode 100644 index 0000000..ffa2ae4 --- /dev/null +++ b/src/modules/Animal_class/animal_classes.js @@ -0,0 +1,10 @@ +const ANIMAL_CLASSES ={ + 0: 'Dogs, Dogs make for the best friends, and it’s only right that we celebrate them for all the joy and love they’ve given us.', + 1: 'Cats, If you have a cat, there’s a good chance your camera roll is already full of photos of your furry feline.', + 2: 'Pandas, I thought the secret of life was obvious: be here now, love as if your whole life depended on it, find your lifes work and try to get hold of a giant', + 3: 'Rabbit, I have got that resilient thing inside me. But I was not a happy bunny.', + 4: 'Wild_Rabbit, How is rabbit wild', + 5: 'Bear, Pooh is a bear', + 6: 'pig, Pigssss' + +} \ No newline at end of file diff --git a/src/modules/Animal_class/animal_classifier.html b/src/modules/Animal_class/animal_classifier.html new file mode 100644 index 0000000..8810dc9 --- /dev/null +++ b/src/modules/Animal_class/animal_classifier.html @@ -0,0 +1,86 @@ + + + + + Only some animal classifier App + + + + + + + + +
+
+

Few and Not all Animal Classfier App

+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+

Predictions

+
    +
    +
    +

    Image

    + +
    +
    +
    +
    +

    +
    +
    +
    + +

    Sample Images

    +

    + Image 1
    + Image 2
    + Image 3
    + Image 4
    + Image 5
    + Image 6
    + Image 7
    +

    +

    + +
    +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/src/modules/Animal_class/predict.js b/src/modules/Animal_class/predict.js new file mode 100644 index 0000000..a515ecc --- /dev/null +++ b/src/modules/Animal_class/predict.js @@ -0,0 +1,59 @@ +$("#image-selector").change(function() { + let reader = new FileReader(); + reader.onload = function() { + let dataURL = reader.result; + $("#selected-image").attr("src", dataURL); + $("#prediction-list").empty(); + }; + let file = $("#image-selector").prop("files")[0]; + reader.readAsDataURL(file); +}); + +$("#model-selector").change(function() { + loadModel($("#model-selector").val()); +}); + +let model; +async function loadModel(name) { + $(".progress-bar").show(); + model = undefined; + model = await tf.loadModel(`tfjs-models/Classification_Models/model.json`); + $(".progress-bar").hide(); +} + +$("#predict-button").click(async function() { + let image = $("#selected-image").get(0); + let modelName = $("#model-selector").val(); + let tensor = tf + .fromPixels(image) + .resizeNearestNeighbor([224, 224]) + .toFloat(); + + let offset = tf.scalar(127.5); + + tensor = tensor + .sub(offset) + .div(offset) + .expandDims(); + + let predictions = await model.predict(tensor).data(); + let top5 = Array.from(predictions) + .map(function(p, i) { + return { + probability: p, + className: ANIMAL_CLASSES[i] + }; + }) + .sort(function(a, b) { + return b.probability - a.probability; + }) + .slice(0, 3); + + $("#prediction-list").empty(); + top5.forEach(function(p) { + $("#prediction-list").append( + `
  1. ${p.className}: ${p.probability.toFixed(6)}
  2. ` + ); + }); +}); + diff --git a/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard1of4 b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard1of4 new file mode 100644 index 0000000..fef5954 Binary files /dev/null and b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard1of4 differ diff --git a/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard2of4 b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard2of4 new file mode 100644 index 0000000..fd57f84 Binary files /dev/null and b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard2of4 differ diff --git a/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard3of4 b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard3of4 new file mode 100644 index 0000000..13cc4f3 Binary files /dev/null and b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard3of4 differ diff --git a/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard4of4 b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard4of4 new file mode 100644 index 0000000..02d5e31 Binary files /dev/null and b/src/modules/Animal_class/tfjs-models/Classification_Models/group1-shard4of4 differ diff --git a/src/modules/Animal_class/tfjs-models/Classification_Models/model.json b/src/modules/Animal_class/tfjs-models/Classification_Models/model.json new file mode 100644 index 0000000..843b036 --- /dev/null +++ b/src/modules/Animal_class/tfjs-models/Classification_Models/model.json @@ -0,0 +1 @@ +{"modelTopology": {"keras_version": "2.2.2", "backend": "tensorflow", "model_config": {"class_name": "Model", "config": {"name": "model_1", "layers": [{"name": "input_1", "class_name": "InputLayer", "inbound_nodes": [], "config": {"name": "input_1", "dtype": "float32", "batch_input_shape": [null, 224, 224, 3], "sparse": false}}, {"name": "conv1_pad", "class_name": "ZeroPadding2D", "inbound_nodes": [[["input_1", 0, 0, {}]]], "config": {"name": "conv1_pad", "padding": [[0, 1], [0, 1]], "trainable": false, "data_format": "channels_last"}}, {"name": "conv1", "class_name": "Conv2D", "inbound_nodes": [[["conv1_pad", 0, 0, {}]]], "config": {"strides": [2, 2], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "valid", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 32, "name": "conv1", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv1_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv1", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv1_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv1_relu", "class_name": "ReLU", "inbound_nodes": [[["conv1_bn", 0, 0, {}]]], "config": {"name": "conv1_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_1", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv1_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_1", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_1_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_1", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_1_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_1_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_1_bn", 0, 0, {}]]], "config": {"name": "conv_dw_1_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_1", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_1_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 64, "name": "conv_pw_1", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_1_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_1", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_1_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_1_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_1_bn", 0, 0, {}]]], "config": {"name": "conv_pw_1_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pad_2", "class_name": "ZeroPadding2D", "inbound_nodes": [[["conv_pw_1_relu", 0, 0, {}]]], "config": {"name": "conv_pad_2", "padding": [[0, 1], [0, 1]], "trainable": false, "data_format": "channels_last"}}, {"name": "conv_dw_2", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pad_2", 0, 0, {}]]], "config": {"strides": [2, 2], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "valid", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_2", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_2_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_2", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_2_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_2_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_2_bn", 0, 0, {}]]], "config": {"name": "conv_dw_2_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_2", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_2_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 128, "name": "conv_pw_2", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_2_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_2", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_2_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_2_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_2_bn", 0, 0, {}]]], "config": {"name": "conv_pw_2_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_3", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_2_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_3", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_3_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_3", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_3_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_3_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_3_bn", 0, 0, {}]]], "config": {"name": "conv_dw_3_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_3", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_3_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 128, "name": "conv_pw_3", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_3_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_3", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_3_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_3_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_3_bn", 0, 0, {}]]], "config": {"name": "conv_pw_3_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pad_4", "class_name": "ZeroPadding2D", "inbound_nodes": [[["conv_pw_3_relu", 0, 0, {}]]], "config": {"name": "conv_pad_4", "padding": [[0, 1], [0, 1]], "trainable": false, "data_format": "channels_last"}}, {"name": "conv_dw_4", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pad_4", 0, 0, {}]]], "config": {"strides": [2, 2], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "valid", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_4", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_4_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_4", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_4_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_4_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_4_bn", 0, 0, {}]]], "config": {"name": "conv_dw_4_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_4", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_4_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 256, "name": "conv_pw_4", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_4_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_4", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_4_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_4_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_4_bn", 0, 0, {}]]], "config": {"name": "conv_pw_4_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_5", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_4_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_5", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_5_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_5", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_5_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_5_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_5_bn", 0, 0, {}]]], "config": {"name": "conv_dw_5_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_5", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_5_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 256, "name": "conv_pw_5", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_5_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_5", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_5_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_5_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_5_bn", 0, 0, {}]]], "config": {"name": "conv_pw_5_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pad_6", "class_name": "ZeroPadding2D", "inbound_nodes": [[["conv_pw_5_relu", 0, 0, {}]]], "config": {"name": "conv_pad_6", "padding": [[0, 1], [0, 1]], "trainable": false, "data_format": "channels_last"}}, {"name": "conv_dw_6", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pad_6", 0, 0, {}]]], "config": {"strides": [2, 2], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "valid", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_6", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_6_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_6", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_6_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_6_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_6_bn", 0, 0, {}]]], "config": {"name": "conv_dw_6_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_6", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_6_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 512, "name": "conv_pw_6", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_6_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_6", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_6_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_6_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_6_bn", 0, 0, {}]]], "config": {"name": "conv_pw_6_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_7", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_6_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_7", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_7_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_7", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_7_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_7_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_7_bn", 0, 0, {}]]], "config": {"name": "conv_dw_7_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_7", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_7_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 512, "name": "conv_pw_7", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_7_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_7", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_7_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_7_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_7_bn", 0, 0, {}]]], "config": {"name": "conv_pw_7_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_8", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_7_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_8", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_8_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_8", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_8_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_8_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_8_bn", 0, 0, {}]]], "config": {"name": "conv_dw_8_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_8", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_8_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 512, "name": "conv_pw_8", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_8_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_8", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_8_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_8_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_8_bn", 0, 0, {}]]], "config": {"name": "conv_pw_8_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_9", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_8_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_9", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_9_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_9", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_9_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_9_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_9_bn", 0, 0, {}]]], "config": {"name": "conv_dw_9_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_9", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_9_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 512, "name": "conv_pw_9", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_9_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_9", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_9_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_9_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_9_bn", 0, 0, {}]]], "config": {"name": "conv_pw_9_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_dw_10", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_9_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_10", "activation": "linear", "bias_constraint": null, "trainable": false}}, {"name": "conv_dw_10_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_10", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_10_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_dw_10_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_10_bn", 0, 0, {}]]], "config": {"name": "conv_dw_10_relu", "trainable": false, "max_value": 6.0}}, {"name": "conv_pw_10", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_10_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": false, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 512, "name": "conv_pw_10", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_10_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_10", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_10_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": false, "beta_regularizer": null}}, {"name": "conv_pw_10_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_10_bn", 0, 0, {}]]], "config": {"name": "conv_pw_10_relu", "trainable": true, "max_value": 6.0}}, {"name": "conv_dw_11", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_10_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_11", "activation": "linear", "bias_constraint": null, "trainable": true}}, {"name": "conv_dw_11_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_11", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_11_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": true, "beta_regularizer": null}}, {"name": "conv_dw_11_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_11_bn", 0, 0, {}]]], "config": {"name": "conv_dw_11_relu", "trainable": true, "max_value": 6.0}}, {"name": "conv_pw_11", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_11_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": true, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 512, "name": "conv_pw_11", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_11_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_11", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_11_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": true, "beta_regularizer": null}}, {"name": "conv_pw_11_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_11_bn", 0, 0, {}]]], "config": {"name": "conv_pw_11_relu", "trainable": true, "max_value": 6.0}}, {"name": "conv_pad_12", "class_name": "ZeroPadding2D", "inbound_nodes": [[["conv_pw_11_relu", 0, 0, {}]]], "config": {"name": "conv_pad_12", "padding": [[0, 1], [0, 1]], "trainable": true, "data_format": "channels_last"}}, {"name": "conv_dw_12", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pad_12", 0, 0, {}]]], "config": {"strides": [2, 2], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "valid", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_12", "activation": "linear", "bias_constraint": null, "trainable": true}}, {"name": "conv_dw_12_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_12", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_12_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": true, "beta_regularizer": null}}, {"name": "conv_dw_12_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_12_bn", 0, 0, {}]]], "config": {"name": "conv_dw_12_relu", "trainable": true, "max_value": 6.0}}, {"name": "conv_pw_12", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_12_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": true, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 1024, "name": "conv_pw_12", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_12_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_12", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_12_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": true, "beta_regularizer": null}}, {"name": "conv_pw_12_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_12_bn", 0, 0, {}]]], "config": {"name": "conv_pw_12_relu", "trainable": true, "max_value": 6.0}}, {"name": "conv_dw_13", "class_name": "DepthwiseConv2D", "inbound_nodes": [[["conv_pw_12_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "depthwise_constraint": null, "padding": "same", "bias_regularizer": null, "data_format": "channels_last", "depthwise_regularizer": null, "activity_regularizer": null, "depthwise_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "depth_multiplier": 1, "name": "conv_dw_13", "activation": "linear", "bias_constraint": null, "trainable": true}}, {"name": "conv_dw_13_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_dw_13", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_dw_13_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": true, "beta_regularizer": null}}, {"name": "conv_dw_13_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_dw_13_bn", 0, 0, {}]]], "config": {"name": "conv_dw_13_relu", "trainable": true, "max_value": 6.0}}, {"name": "conv_pw_13", "class_name": "Conv2D", "inbound_nodes": [[["conv_dw_13_relu", 0, 0, {}]]], "config": {"strides": [1, 1], "use_bias": false, "kernel_size": [1, 1], "bias_initializer": {"class_name": "Zeros", "config": {}}, "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": true, "padding": "same", "kernel_constraint": null, "bias_regularizer": null, "data_format": "channels_last", "activity_regularizer": null, "filters": 1024, "name": "conv_pw_13", "kernel_regularizer": null, "bias_constraint": null, "activation": "linear"}}, {"name": "conv_pw_13_bn", "class_name": "BatchNormalization", "inbound_nodes": [[["conv_pw_13", 0, 0, {}]]], "config": {"center": true, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "gamma_regularizer": null, "scale": true, "momentum": 0.99, "gamma_constraint": null, "axis": -1, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "epsilon": 0.001, "gamma_initializer": {"class_name": "Ones", "config": {}}, "beta_constraint": null, "name": "conv_pw_13_bn", "beta_initializer": {"class_name": "Zeros", "config": {}}, "trainable": true, "beta_regularizer": null}}, {"name": "conv_pw_13_relu", "class_name": "ReLU", "inbound_nodes": [[["conv_pw_13_bn", 0, 0, {}]]], "config": {"name": "conv_pw_13_relu", "trainable": true, "max_value": 6.0}}, {"name": "global_average_pooling2d_1", "class_name": "GlobalAveragePooling2D", "inbound_nodes": [[["conv_pw_13_relu", 0, 0, {}]]], "config": {"name": "global_average_pooling2d_1", "trainable": true, "data_format": "channels_last"}}, {"name": "dropout_1", "class_name": "Dropout", "inbound_nodes": [[["global_average_pooling2d_1", 0, 0, {}]]], "config": {"name": "dropout_1", "trainable": true, "noise_shape": null, "rate": 0.25, "seed": null}}, {"name": "dense_1", "class_name": "Dense", "inbound_nodes": [[["dropout_1", 0, 0, {}]]], "config": {"use_bias": true, "bias_regularizer": null, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "scale": 1.0, "mode": "fan_avg", "seed": null}}, "trainable": true, "kernel_constraint": null, "bias_constraint": null, "activity_regularizer": null, "units": 7, "name": "dense_1", "kernel_regularizer": null, "activation": "softmax"}}], "output_layers": [["dense_1", 0, 0]], "input_layers": [["input_1", 0, 0]]}}, "training_config": {"optimizer_config": {"class_name": "Adam", "config": {"epsilon": 1e-07, "beta_1": 0.8999999761581421, "amsgrad": false, "lr": 0.0012499999720603228, "decay": 0.0, "beta_2": 0.9990000128746033}}, "loss_weights": null, "metrics": ["categorical_accuracy", "top_2_accuracy", "top_3_accuracy"], "loss": "categorical_crossentropy", "sample_weight_mode": null}}, "weightsManifest": [{"paths": ["group1-shard1of4", "group1-shard2of4", "group1-shard3of4", "group1-shard4of4"], "weights": [{"name": "conv1/kernel", "shape": [3, 3, 3, 32], "dtype": "float32"}, {"name": "conv1_bn/gamma", "shape": [32], "dtype": "float32"}, {"name": "conv1_bn/beta", "shape": [32], "dtype": "float32"}, {"name": "conv1_bn/moving_mean", "shape": [32], "dtype": "float32"}, {"name": "conv1_bn/moving_variance", "shape": [32], "dtype": "float32"}, {"name": "conv_dw_1/depthwise_kernel", "shape": [3, 3, 32, 1], "dtype": "float32"}, {"name": "conv_dw_10/depthwise_kernel", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "conv_dw_10_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_10_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_10_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_10_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_11/depthwise_kernel", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "conv_dw_11_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_11_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_11_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_11_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_12/depthwise_kernel", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "conv_dw_12_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_12_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_12_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_12_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_13/depthwise_kernel", "shape": [3, 3, 1024, 1], "dtype": "float32"}, {"name": "conv_dw_13_bn/gamma", "shape": [1024], "dtype": "float32"}, {"name": "conv_dw_13_bn/beta", "shape": [1024], "dtype": "float32"}, {"name": "conv_dw_13_bn/moving_mean", "shape": [1024], "dtype": "float32"}, {"name": "conv_dw_13_bn/moving_variance", "shape": [1024], "dtype": "float32"}, {"name": "conv_dw_1_bn/gamma", "shape": [32], "dtype": "float32"}, {"name": "conv_dw_1_bn/beta", "shape": [32], "dtype": "float32"}, {"name": "conv_dw_1_bn/moving_mean", "shape": [32], "dtype": "float32"}, {"name": "conv_dw_1_bn/moving_variance", "shape": [32], "dtype": "float32"}, {"name": "conv_dw_2/depthwise_kernel", "shape": [3, 3, 64, 1], "dtype": "float32"}, {"name": "conv_dw_2_bn/gamma", "shape": [64], "dtype": "float32"}, {"name": "conv_dw_2_bn/beta", "shape": [64], "dtype": "float32"}, {"name": "conv_dw_2_bn/moving_mean", "shape": [64], "dtype": "float32"}, {"name": "conv_dw_2_bn/moving_variance", "shape": [64], "dtype": "float32"}, {"name": "conv_dw_3/depthwise_kernel", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "conv_dw_3_bn/gamma", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_3_bn/beta", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_3_bn/moving_mean", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_3_bn/moving_variance", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_4/depthwise_kernel", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "conv_dw_4_bn/gamma", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_4_bn/beta", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_4_bn/moving_mean", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_4_bn/moving_variance", "shape": [128], "dtype": "float32"}, {"name": "conv_dw_5/depthwise_kernel", "shape": [3, 3, 256, 1], "dtype": "float32"}, {"name": "conv_dw_5_bn/gamma", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_5_bn/beta", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_5_bn/moving_mean", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_5_bn/moving_variance", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_6/depthwise_kernel", "shape": [3, 3, 256, 1], "dtype": "float32"}, {"name": "conv_dw_6_bn/gamma", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_6_bn/beta", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_6_bn/moving_mean", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_6_bn/moving_variance", "shape": [256], "dtype": "float32"}, {"name": "conv_dw_7/depthwise_kernel", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "conv_dw_7_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_7_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_7_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_7_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_8/depthwise_kernel", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "conv_dw_8_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_8_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_8_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_8_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_9/depthwise_kernel", "shape": [3, 3, 512, 1], "dtype": "float32"}, {"name": "conv_dw_9_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_9_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_9_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_dw_9_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_1/kernel", "shape": [1, 1, 32, 64], "dtype": "float32"}, {"name": "conv_pw_10/kernel", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "conv_pw_10_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_10_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_10_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_10_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_11/kernel", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "conv_pw_11_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_11_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_11_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_11_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_12/kernel", "shape": [1, 1, 512, 1024], "dtype": "float32"}, {"name": "conv_pw_12_bn/gamma", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_12_bn/beta", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_12_bn/moving_mean", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_12_bn/moving_variance", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_13/kernel", "shape": [1, 1, 1024, 1024], "dtype": "float32"}, {"name": "conv_pw_13_bn/gamma", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_13_bn/beta", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_13_bn/moving_mean", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_13_bn/moving_variance", "shape": [1024], "dtype": "float32"}, {"name": "conv_pw_1_bn/gamma", "shape": [64], "dtype": "float32"}, {"name": "conv_pw_1_bn/beta", "shape": [64], "dtype": "float32"}, {"name": "conv_pw_1_bn/moving_mean", "shape": [64], "dtype": "float32"}, {"name": "conv_pw_1_bn/moving_variance", "shape": [64], "dtype": "float32"}, {"name": "conv_pw_2/kernel", "shape": [1, 1, 64, 128], "dtype": "float32"}, {"name": "conv_pw_2_bn/gamma", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_2_bn/beta", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_2_bn/moving_mean", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_2_bn/moving_variance", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_3/kernel", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "conv_pw_3_bn/gamma", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_3_bn/beta", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_3_bn/moving_mean", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_3_bn/moving_variance", "shape": [128], "dtype": "float32"}, {"name": "conv_pw_4/kernel", "shape": [1, 1, 128, 256], "dtype": "float32"}, {"name": "conv_pw_4_bn/gamma", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_4_bn/beta", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_4_bn/moving_mean", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_4_bn/moving_variance", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_5/kernel", "shape": [1, 1, 256, 256], "dtype": "float32"}, {"name": "conv_pw_5_bn/gamma", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_5_bn/beta", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_5_bn/moving_mean", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_5_bn/moving_variance", "shape": [256], "dtype": "float32"}, {"name": "conv_pw_6/kernel", "shape": [1, 1, 256, 512], "dtype": "float32"}, {"name": "conv_pw_6_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_6_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_6_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_6_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_7/kernel", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "conv_pw_7_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_7_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_7_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_7_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_8/kernel", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "conv_pw_8_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_8_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_8_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_8_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_9/kernel", "shape": [1, 1, 512, 512], "dtype": "float32"}, {"name": "conv_pw_9_bn/gamma", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_9_bn/beta", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_9_bn/moving_mean", "shape": [512], "dtype": "float32"}, {"name": "conv_pw_9_bn/moving_variance", "shape": [512], "dtype": "float32"}, {"name": "dense_1/kernel", "shape": [1024, 7], "dtype": "float32"}, {"name": "dense_1/bias", "shape": [7], "dtype": "float32"}]}]} \ No newline at end of file diff --git a/src/modules/layer_conversion/group1-shard1of1.bin b/src/modules/layer_conversion/group1-shard1of1.bin new file mode 100644 index 0000000..094d20b Binary files /dev/null and b/src/modules/layer_conversion/group1-shard1of1.bin differ diff --git a/src/modules/layer_conversion/index.css b/src/modules/layer_conversion/index.css new file mode 100644 index 0000000..677ab84 --- /dev/null +++ b/src/modules/layer_conversion/index.css @@ -0,0 +1,3 @@ +#my-file { + visibility: hidden; +} diff --git a/src/modules/layer_conversion/index.html b/src/modules/layer_conversion/index.html new file mode 100644 index 0000000..7baf676 --- /dev/null +++ b/src/modules/layer_conversion/index.html @@ -0,0 +1,21 @@ + + + + + + + + + +
    + + +
    + + diff --git a/src/modules/layer_conversion/model.json b/src/modules/layer_conversion/model.json new file mode 100644 index 0000000..8151049 --- /dev/null +++ b/src/modules/layer_conversion/model.json @@ -0,0 +1 @@ +{"format": "layers-model", "generatedBy": "keras v2.2.4-tf", "convertedBy": "TensorFlow.js Converter v1.5.2", "modelTopology": {"keras_version": "2.2.4-tf", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential_2", "layers": [{"class_name": "Conv2D", "config": {"name": "conv2d_2", "trainable": true, "batch_input_shape": [null, 28, 28, 1], "dtype": "float32", "filters": 32, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": {"class_name": "L1L2", "config": {"l1": 0.0, "l2": 0.019999999552965164}}, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_2", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [2, 2], "data_format": "channels_last"}}, {"class_name": "Flatten", "config": {"name": "flatten_2", "trainable": true, "dtype": "float32", "data_format": "channels_last"}}, {"class_name": "Dropout", "config": {"name": "dropout_1", "trainable": true, "dtype": "float32", "rate": 0.1, "noise_shape": null, "seed": null}}, {"class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 64, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "BatchNormalization", "config": {"name": "batch_normalization_1", "trainable": true, "dtype": "float32", "axis": [1], "momentum": 0.99, "epsilon": 0.001, "center": true, "scale": true, "beta_initializer": {"class_name": "Zeros", "config": {}}, "gamma_initializer": {"class_name": "Ones", "config": {}}, "moving_mean_initializer": {"class_name": "Zeros", "config": {}}, "moving_variance_initializer": {"class_name": "Ones", "config": {}}, "beta_regularizer": null, "gamma_regularizer": null, "beta_constraint": null, "gamma_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_3", "trainable": true, "dtype": "float32", "units": 10, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}}, "training_config": {"loss": {"class_name": "SparseCategoricalCrossentropy", "config": {"reduction": "auto", "name": "sparse_categorical_crossentropy", "from_logits": true}}, "metrics": ["accuracy"], "weighted_metrics": null, "sample_weight_mode": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.0010000000474974513, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}, "weightsManifest": [{"paths": ["group1-shard1of1.bin"], "weights": [{"name": "batch_normalization_1/gamma", "shape": [64], "dtype": "float32"}, {"name": "batch_normalization_1/beta", "shape": [64], "dtype": "float32"}, {"name": "batch_normalization_1/moving_mean", "shape": [64], "dtype": "float32"}, {"name": "batch_normalization_1/moving_variance", "shape": [64], "dtype": "float32"}, {"name": "conv2d_2/kernel", "shape": [3, 3, 1, 32], "dtype": "float32"}, {"name": "conv2d_2/bias", "shape": [32], "dtype": "float32"}, {"name": "dense_2/kernel", "shape": [5408, 64], "dtype": "float32"}, {"name": "dense_2/bias", "shape": [64], "dtype": "float32"}, {"name": "dense_3/kernel", "shape": [64, 10], "dtype": "float32"}, {"name": "dense_3/bias", "shape": [10], "dtype": "float32"}]}]} \ No newline at end of file diff --git a/src/modules/layer_conversion/script.js b/src/modules/layer_conversion/script.js new file mode 100644 index 0000000..f117c7d --- /dev/null +++ b/src/modules/layer_conversion/script.js @@ -0,0 +1,94 @@ +// "./" must be required to load json from sub path +//const modelP = tf.loadModel("./model.json"); +const modelP = tf.loadModel("./model.json"); + +const canvas = document.createElement("canvas"); +canvas.width = canvas.height = 28 * 8; +canvas.style.display = "block"; +canvas.style.borderStyle = "solid"; +//canvas.style.backgroundColor = "white"; +document.body.appendChild(canvas); + +// simple scribble +const c2d = canvas.getContext("2d"); +c2d.lineWidth = 8; +c2d.strokeStyle = "black"; +c2d.fillStyle = "white"; +let prev = null; +canvas.addEventListener( + "mousedown", + ev => { + prev = ev; + }, + false +); +canvas.addEventListener( + "mouseup", + ev => { + prev = null; + }, + false +); +canvas.addEventListener( + "mousemove", + ev => { + if (prev === null) return; + const bounds = canvas.getBoundingClientRect(); + c2d.beginPath(); + c2d.moveTo(prev.clientX - bounds.left, prev.clientY - bounds.top); + c2d.lineTo(ev.clientX - bounds.left, ev.clientY - bounds.top); + c2d.stroke(); + prev = ev; + predict().catch(console.error); + }, + false +); + +// NOTE: white filling is required: tf.fromPixel() ignores alpha channel +function clear() { + c2d.fillRect(0, 0, canvas.width, canvas.height); +} +clear(); +const clearButton = document.createElement("button"); +clearButton.style.display = "block"; +clearButton.textContent = "clear"; +clearButton.addEventListener("click", clear, false); +document.body.appendChild(clearButton); + +// for result +const pre = document.createElement("pre"); +document.body.appendChild(pre); + +// apply trained keras model +async function predict() { + const model = await modelP; + const img = c2d.getImageData(0, 0, canvas.width, canvas.height); + // tf.tidy(): auto-release block ([NOTE] tf.keep(t): avoid auto-release) + tf.tidy(() => { + // data.shape == [28, 28, 3], value: 0(black)-255(color) + const data = tf.image.resizeBilinear(tf.fromPixels(img), [28, 28]); + const r = data.slice([0, 0, 0], [data.shape[0], data.shape[1], 1]); + const g = data.slice([0, 0, 1], [data.shape[0], data.shape[1], 1]); + const b = data.slice([0, 0, 2], [data.shape[0], data.shape[1], 1]); + // input.shape == [n, 28, 28, 1], value: 0(white)-1(black) + const input = r + .add(g) + .add(b) + .cast("float32") + .div(tf.scalar(-1 * 3 * 255)) + .add(tf.scalar(1)) + .reshape([1, 28, 28, 1]); + const result = model.predict(input); + // result.shape == [n, 10], value: 0-1 (as categorical probability) + + // display result + const probs = [...result.buffer().values]; + const num = result.argMax(1).buffer().values[0]; + pre.textContent = [`predict number: ${num}`] + .concat(probs.map((p, n) => `${n} = ${p}`)) + .join("\n"); + }); +} +$("#my-button").click(function() { + $("#my-file").click(); +});