feat: Add convert script, convert trained weight to DetectApp
Showing
4 changed files
with
12 additions
and
0 deletions
DetectApp/model/group1-shard1of2.bin
0 → 100644
No preview for this file type
DetectApp/model/group1-shard2of2.bin
0 → 100644
No preview for this file type
DetectApp/model/model.json
0 → 100644
1 | +{"format": "layers-model", "generatedBy": "keras v2.8.0", "convertedBy": "TensorFlow.js Converter v3.18.0", "modelTopology": {"keras_version": "2.8.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential_1", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": [null, 24, 24, 1], "dtype": "float32", "sparse": false, "ragged": false, "name": "conv2d_3_input"}}, {"class_name": "Conv2D", "config": {"name": "conv2d_3", "trainable": true, "batch_input_shape": [null, 24, 24, 1], "dtype": "float32", "filters": 32, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "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": "MaxPooling2D", "config": {"name": "max_pooling2d_3", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [1, 1], "data_format": "channels_last"}}, {"class_name": "Conv2D", "config": {"name": "conv2d_4", "trainable": true, "dtype": "float32", "filters": 32, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "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": "MaxPooling2D", "config": {"name": "max_pooling2d_4", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [1, 1], "data_format": "channels_last"}}, {"class_name": "Conv2D", "config": {"name": "conv2d_5", "trainable": true, "dtype": "float32", "filters": 64, "kernel_size": [3, 3], "strides": [1, 1], "padding": "valid", "data_format": "channels_last", "dilation_rate": [1, 1], "groups": 1, "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": "MaxPooling2D", "config": {"name": "max_pooling2d_5", "trainable": true, "dtype": "float32", "pool_size": [2, 2], "padding": "valid", "strides": [1, 1], "data_format": "channels_last"}}, {"class_name": "Dropout", "config": {"name": "dropout_2", "trainable": true, "dtype": "float32", "rate": 0.25, "noise_shape": null, "seed": null}}, {"class_name": "Flatten", "config": {"name": "flatten_1", "trainable": true, "dtype": "float32", "data_format": "channels_last"}}, {"class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 128, "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": "Dropout", "config": {"name": "dropout_3", "trainable": true, "dtype": "float32", "rate": 0.5, "noise_shape": null, "seed": null}}, {"class_name": "Dense", "config": {"name": "dense_3", "trainable": true, "dtype": "float32", "units": 2, "activation": "softmax", "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": "categorical_crossentropy", "metrics": [[{"class_name": "MeanMetricWrapper", "config": {"name": "accuracy", "dtype": "float32", "fn": "categorical_accuracy"}}]], "weighted_metrics": 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-shard1of2.bin", "group1-shard2of2.bin"], "weights": [{"name": "conv2d_3/kernel", "shape": [3, 3, 1, 32], "dtype": "float32"}, {"name": "conv2d_3/bias", "shape": [32], "dtype": "float32"}, {"name": "conv2d_4/kernel", "shape": [3, 3, 32, 32], "dtype": "float32"}, {"name": "conv2d_4/bias", "shape": [32], "dtype": "float32"}, {"name": "conv2d_5/kernel", "shape": [3, 3, 32, 64], "dtype": "float32"}, {"name": "conv2d_5/bias", "shape": [64], "dtype": "float32"}, {"name": "dense_2/kernel", "shape": [14400, 128], "dtype": "float32"}, {"name": "dense_2/bias", "shape": [128], "dtype": "float32"}, {"name": "dense_3/kernel", "shape": [128, 2], "dtype": "float32"}, {"name": "dense_3/bias", "shape": [2], "dtype": "float32"}]}]} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -400,6 +400,17 @@ | ... | @@ -400,6 +400,17 @@ |
400 | "source": [ | 400 | "source": [ |
401 | "model.save('../model/extended_weight.h5', overwrite=True)" | 401 | "model.save('../model/extended_weight.h5', overwrite=True)" |
402 | ] | 402 | ] |
403 | + }, | ||
404 | + { | ||
405 | + "cell_type": "code", | ||
406 | + "execution_count": null, | ||
407 | + "metadata": {}, | ||
408 | + "outputs": [], | ||
409 | + "source": [ | ||
410 | + "import tensorflowjs as tfjs\n", | ||
411 | + "\n", | ||
412 | + "tfjs.converters.save_keras_model(model, '../../DetectApp/model')" | ||
413 | + ] | ||
403 | } | 414 | } |
404 | ], | 415 | ], |
405 | "metadata": { | 416 | "metadata": { | ... | ... |
-
Please register or login to post a comment