diff --git a/javascript/yolo-example/assets/concrete-texture.png b/javascript/yolo-example/assets/concrete-texture.png new file mode 100644 index 00000000..592634d1 Binary files /dev/null and b/javascript/yolo-example/assets/concrete-texture.png differ diff --git a/javascript/yolo-example/assets/concrete-texture.txt b/javascript/yolo-example/assets/concrete-texture.txt new file mode 100644 index 00000000..0fc2a1f3 --- /dev/null +++ b/javascript/yolo-example/assets/concrete-texture.txt @@ -0,0 +1,8 @@ + + +======================================================== + This pattern is downloaded from www.subtlepatterns.com + If you need more, that's where to get'em. + ======================================================== + + \ No newline at end of file diff --git a/javascript/yolo-example/fullscreen.js b/javascript/yolo-example/fullscreen.js new file mode 100644 index 00000000..e8108785 --- /dev/null +++ b/javascript/yolo-example/fullscreen.js @@ -0,0 +1,54 @@ +//exit full screen +let IS_APP_ON_FULL_SCREEN =false +const app = document.getElementById("app-wrap") +const videowrapper = document.getElementById("demo-wrap") +const controlswrapper = document.getElementById("controls-wrap") + +if (app.addEventListener) { + app.addEventListener('webkitfullscreenchange', fullScreenHandler, false); + app.addEventListener('mozfullscreenchange', fullScreenHandler, false); + app.addEventListener('fullscreenchange', fullScreenHandler, false); + app.addEventListener('MSFullscreenChange', fullScreenHandler, false); +} + +document.addEventListener("keydown", e => { + if (e.key == "F11") { + e.preventDefault() + app.requestFullscreen(); + } +}); + +toogleFullscreen = () => { + app.requestFullscreen(); +} + + + +function fullScreenHandler() { + // If there's an element in fullscreen, exit + // Otherwise, enter it + if (!IS_APP_ON_FULL_SCREEN) { + // let app = document.getElementById("app") + // app.requestFullscreen(); + appEnterFullscreen(); + IS_APP_ON_FULL_SCREEN = true + } else { + appExitFullscreen(); + IS_APP_ON_FULL_SCREEN = false; + } +} + +function appExitFullscreen() { + app.classList.remove('app-wrap-fullscreen') + videowrapper.classList.remove('demo-wrap-fullscreen') + controlswrapper.classList.remove('controls-wrap-fullscreen') + +} + +function appEnterFullscreen() { + window.scrollTo(0, 0); + app.classList.add('app-wrap-fullscreen') + videowrapper.classList.add('demo-wrap-fullscreen') + controlswrapper.classList.add('controls-wrap-fullscreen') + +} \ No newline at end of file diff --git a/javascript/yolo-example/helpers.js b/javascript/yolo-example/helpers.js new file mode 100644 index 00000000..be6579ec --- /dev/null +++ b/javascript/yolo-example/helpers.js @@ -0,0 +1,25 @@ + + +/** + * Element.requestFullScreen() polyfill + * @author Chris Ferdinandi + * @license MIT + */ +if (!Element.prototype.requestFullscreen) { + Element.prototype.requestFullscreen = Element.prototype.mozRequestFullscreen || Element.prototype.webkitRequestFullscreen || Element.prototype.msRequestFullscreen; +} +///////////// + +setCameraToVideoElement = async (VElement) => { + if (navigator.mediaDevices.getUserMedia) { + return navigator.mediaDevices.getUserMedia(cameraconfig) + .then(function (stream) { + VElement.srcObject = stream; + }) + .catch(function (error) { + console.log("Something went wrong!"); + console.error(error); + }); + } +} + diff --git a/javascript/yolo-example/index.css b/javascript/yolo-example/index.css new file mode 100644 index 00000000..e9581079 --- /dev/null +++ b/javascript/yolo-example/index.css @@ -0,0 +1,94 @@ +html { + scroll-behavior: smooth; + } +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-weight: lighter; + font-size: 13px; +} +label { + margin-bottom: 0 +} + +::-webkit-scrollbar { + width: 0px; + /* remove scrollbar space */ + background: transparent; + /* optional: just make scrollbar invisible */ +} + + +.app-wrap { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: grid; + grid-template-columns: 1fr 853px 1fr; + grid-template-rows: 1fr 480px 100px 1fr; + + background-image: url("assets/concrete-texture.png"); + background-repeat: repeat; +} +.demo-wrap { + grid-column: 2/3; + grid-row: 2/3; + position: relative; + display: flex; + justify-content: center; + align-items: center; +} + +.app-wrap-fullscreen { + grid-template-columns: 1fr!important; + grid-template-rows: 1fr!important; +} +.demo-wrap-fullscreen { + grid-column: 1/2!important; + grid-row: 1/2!important; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.controls-wrap-fullscreen{ + display: none!important;; +} +.controls-wrap{ + margin: 25px 0px; + grid-column: 2/3; + grid-row: 3/4; + position: relative; + display: flex; + justify-content: space-between; + align-items: center; +} + +.layer { + top: 0; + left: 0; +} +.layer-videoElem{ + z-index: 10; + width: 100%; + height: 100%; + +} +.layer-canvas{ + position: absolute; + z-index: 11; + pointer-events: none; +} +.fps-meter-layer{ + position: absolute; + top: 0; + left: 0; + z-index:999; + width: 100%; + height: 100%; +} +.btn-spaceout{ + margin: 0 10px; +} \ No newline at end of file diff --git a/javascript/yolo-example/index.html b/javascript/yolo-example/index.html new file mode 100644 index 00000000..1e32d5f8 --- /dev/null +++ b/javascript/yolo-example/index.html @@ -0,0 +1,44 @@ + + + + + + + YOLO ml5.js demo + + + + +
+ + +
+ +
+
+
+ +
+ + +
+ + + +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/javascript/yolo-example/models/yolov2-lite/group1-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group1-shard1of1 new file mode 100644 index 00000000..1f159e40 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group1-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/group2-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group2-shard1of1 new file mode 100644 index 00000000..b1e323d4 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group2-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/group3-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group3-shard1of1 new file mode 100644 index 00000000..3b308496 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group3-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/group4-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group4-shard1of1 new file mode 100644 index 00000000..3d4dc216 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group4-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/group5-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group5-shard1of1 new file mode 100644 index 00000000..242b4225 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group5-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/group6-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group6-shard1of1 new file mode 100644 index 00000000..c8b513ef Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group6-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/group7-shard1of1 b/javascript/yolo-example/models/yolov2-lite/group7-shard1of1 new file mode 100644 index 00000000..db082188 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-lite/group7-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov2-lite/model.json b/javascript/yolo-example/models/yolov2-lite/model.json new file mode 100644 index 00000000..b6ebeb45 --- /dev/null +++ b/javascript/yolo-example/models/yolov2-lite/model.json @@ -0,0 +1,573 @@ +{ + "modelTopology": { + "keras_version": "2.1.4", + "backend": "tensorflow", + "model_config": { + "class_name": "Model", + "config": { + "name": "model_1", + "layers": [{ + "name": "input_1", + "class_name": "InputLayer", + "config": { + "batch_input_shape": [null, null, null, 3], + "dtype": "float32", + "sparse": false, + "name": "input_1" + }, + "inbound_nodes": [] + }, { + "name": "conv2d_1", + "class_name": "Conv2D", + "config": { + "name": "conv2d_1", + "trainable": true, + "filters": 16, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["input_1", 0, 0, {}] + ] + ] + }, { + "name": "leaky_re_lu_1", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_1", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [ + [ + ["conv2d_1", 0, 0, {}] + ] + ] + }, { + "name": "max_pooling2d_1", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_1", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [ + [ + ["leaky_re_lu_1", 0, 0, {}] + ] + ] + }, { + "name": "conv2d_2", + "class_name": "Conv2D", + "config": { + "name": "conv2d_2", + "trainable": true, + "filters": 32, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["max_pooling2d_1", 0, 0, {}] + ] + ] + }, { + "name": "leaky_re_lu_2", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_2", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [ + [ + ["conv2d_2", 0, 0, {}] + ] + ] + }, { + "name": "max_pooling2d_2", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_2", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [ + [ + ["leaky_re_lu_2", 0, 0, {}] + ] + ] + }, { + "name": "conv2d_3", + "class_name": "Conv2D", + "config": { + "name": "conv2d_3", + "trainable": true, + "filters": 64, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["max_pooling2d_2", 0, 0, {}] + ] + ] + }, { + "name": "leaky_re_lu_3", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_3", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [ + [ + ["conv2d_3", 0, 0, {}] + ] + ] + }, { + "name": "max_pooling2d_3", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_3", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [ + [ + ["leaky_re_lu_3", 0, 0, {}] + ] + ] + }, { + "name": "conv2d_4", + "class_name": "Conv2D", + "config": { + "name": "conv2d_4", + "trainable": true, + "filters": 128, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["max_pooling2d_3", 0, 0, {}] + ] + ] + }, { + "name": "leaky_re_lu_4", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_4", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [ + [ + ["conv2d_4", 0, 0, {}] + ] + ] + }, { + "name": "max_pooling2d_4", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_4", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [ + [ + ["leaky_re_lu_4", 0, 0, {}] + ] + ] + }, { + "name": "conv2d_5", + "class_name": "Conv2D", + "config": { + "name": "conv2d_5", + "trainable": true, + "filters": 128, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["max_pooling2d_4", 0, 0, {}] + ] + ] + }, { + "name": "leaky_re_lu_5", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_5", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [ + [ + ["conv2d_5", 0, 0, {}] + ] + ] + }, { + "name": "max_pooling2d_5", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_5", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [ + [ + ["leaky_re_lu_5", 0, 0, {}] + ] + ] + }, { + "name": "conv2d_6", + "class_name": "Conv2D", + "config": { + "name": "conv2d_6", + "trainable": true, + "filters": 256, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["max_pooling2d_5", 0, 0, {}] + ] + ] + }, { + "name": "leaky_re_lu_6", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_6", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [ + [ + ["conv2d_6", 0, 0, {}] + ] + ] + }, { + "name": "conv2d_7", + "class_name": "Conv2D", + "config": { + "name": "conv2d_7", + "trainable": true, + "filters": 425, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { + "l1": 0.0, + "l2": 0.0005000000237487257 + } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [ + [ + ["leaky_re_lu_6", 0, 0, {}] + ] + ] + }], + "input_layers": [ + ["input_1", 0, 0] + ], + "output_layers": [ + ["conv2d_7", 0, 0] + ] + } + } + }, + "weightsManifest": [{ + "paths": ["group1-shard1of1"], + "weights": [{ + "name": "conv2d_1/kernel", + "shape": [3, 3, 3, 16], + "dtype": "float32" + }, { + "name": "conv2d_1/bias", + "shape": [16], + "dtype": "float32" + }] + }, { + "paths": ["group2-shard1of1"], + "weights": [{ + "name": "conv2d_2/kernel", + "shape": [3, 3, 16, 32], + "dtype": "float32" + }, { + "name": "conv2d_2/bias", + "shape": [32], + "dtype": "float32" + }] + }, { + "paths": ["group3-shard1of1"], + "weights": [{ + "name": "conv2d_3/kernel", + "shape": [3, 3, 32, 64], + "dtype": "float32" + }, { + "name": "conv2d_3/bias", + "shape": [64], + "dtype": "float32" + }] + }, { + "paths": ["group4-shard1of1"], + "weights": [{ + "name": "conv2d_4/kernel", + "shape": [3, 3, 64, 128], + "dtype": "float32" + }, { + "name": "conv2d_4/bias", + "shape": [128], + "dtype": "float32" + }] + }, { + "paths": ["group5-shard1of1"], + "weights": [{ + "name": "conv2d_5/kernel", + "shape": [3, 3, 128, 128], + "dtype": "float32" + }, { + "name": "conv2d_5/bias", + "shape": [128], + "dtype": "float32" + }] + }, { + "paths": ["group6-shard1of1"], + "weights": [{ + "name": "conv2d_6/kernel", + "shape": [3, 3, 128, 256], + "dtype": "float32" + }, { + "name": "conv2d_6/bias", + "shape": [256], + "dtype": "float32" + }] + }, { + "paths": ["group7-shard1of1"], + "weights": [{ + "name": "conv2d_7/kernel", + "shape": [1, 1, 256, 425], + "dtype": "float32" + }, { + "name": "conv2d_7/bias", + "shape": [425], + "dtype": "float32" + }] + }] +} \ No newline at end of file diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard10of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard10of11 new file mode 100644 index 00000000..54b68bcb Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard10of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard11of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard11of11 new file mode 100644 index 00000000..a9714f48 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard11of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard1of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard1of11 new file mode 100644 index 00000000..0dfc4ba2 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard1of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard2of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard2of11 new file mode 100644 index 00000000..cd8d7ce4 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard2of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard3of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard3of11 new file mode 100644 index 00000000..8b8d487c Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard3of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard4of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard4of11 new file mode 100644 index 00000000..ba007811 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard4of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard5of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard5of11 new file mode 100644 index 00000000..4e051321 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard5of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard6of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard6of11 new file mode 100644 index 00000000..1edd83ed Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard6of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard7of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard7of11 new file mode 100644 index 00000000..1c21361c Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard7of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard8of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard8of11 new file mode 100644 index 00000000..7d71a22b Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard8of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/group1-shard9of11 b/javascript/yolo-example/models/yolov2-tiny/group1-shard9of11 new file mode 100644 index 00000000..addb5283 Binary files /dev/null and b/javascript/yolo-example/models/yolov2-tiny/group1-shard9of11 differ diff --git a/javascript/yolo-example/models/yolov2-tiny/model.json b/javascript/yolo-example/models/yolov2-tiny/model.json new file mode 100644 index 00000000..2ceb3500 --- /dev/null +++ b/javascript/yolo-example/models/yolov2-tiny/model.json @@ -0,0 +1,582 @@ +{ + "modelTopology": { + "keras_version": "2.2.2", + "backend": "tensorflow", + "model_config": { + "class_name": "Model", + "config": { + "name": "model_1", + "layers": [ + { + "name": "input_1", + "class_name": "InputLayer", + "config": { + "batch_input_shape": [null,null, null, 3], + "dtype": "float32", + "sparse": false, + "name": "input_1" + }, + "inbound_nodes": [] + }, + { + "name": "conv2d_1", + "class_name": "Conv2D", + "config": { + "name": "conv2d_1", + "trainable": true, + "filters": 16, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["input_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_1", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_1", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_1", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_1", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_1", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_1", 0, 0, {}]]] + }, + + + { + "name": "conv2d_2", + "class_name": "Conv2D", + "config": { + "name": "conv2d_2", + "trainable": true, + "filters": 32, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_2", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_2", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_2", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_2", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_2", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_2", 0, 0, {}]]] + }, + + + { + "name": "conv2d_3", + "class_name": "Conv2D", + "config": { + "name": "conv2d_3", + "trainable": true, + "filters": 64, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_2", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_3", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_3", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_3", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_3", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_3", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_3", 0, 0, {}]]] + }, + + { + "name": "conv2d_4", + "class_name": "Conv2D", + "config": { + "name": "conv2d_4", + "trainable": true, + "filters": 128, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_3", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_4", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_4", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_4", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_4", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_4", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_4", 0, 0, {}]]] + }, + + + { + "name": "conv2d_5", + "class_name": "Conv2D", + "config": { + "name": "conv2d_5", + "trainable": true, + "filters": 256, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_4", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_5", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_5", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_5", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_5", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_5", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_5", 0, 0, {}]]] + }, + + + { + "name": "conv2d_6", + "class_name": "Conv2D", + "config": { + "name": "conv2d_6", + "trainable": true, + "filters": 512, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_5", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_6", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_6", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_6", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_6", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_6", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [1, 1], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_6", 0, 0, {}]]] + }, + { + "name": "conv2d_7", + "class_name": "Conv2D", + "config": { + "name": "conv2d_7", + "trainable": true, + "filters": 1024, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_6", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_7", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_7", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_7", 0, 0, {}]]] + }, + { + "name": "conv2d_8", + "class_name": "Conv2D", + "config": { + "name": "conv2d_8", + "trainable": true, + "filters": 512, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_7", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_8", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_8", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_8", 0, 0, {}]]] + }, + { + "name": "conv2d_9", + "class_name": "Conv2D", + "config": { + "name": "conv2d_9", + "trainable": true, + "filters": 425, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_8", 0, 0, {}]]] + } + ], + "input_layers": [["input_1", 0, 0]], + "output_layers": [["conv2d_9", 0, 0]] + } + } + }, + "weightsManifest": [ + { + "paths": [ + "group1-shard1of11", + "group1-shard2of11", + "group1-shard3of11", + "group1-shard4of11", + "group1-shard5of11", + "group1-shard6of11", + "group1-shard7of11", + "group1-shard8of11", + "group1-shard9of11", + "group1-shard10of11", + "group1-shard11of11" + ], + "weights": [ + { + "name": "conv2d_1/kernel", + "shape": [3, 3, 3, 16], + "dtype": "float32" + }, + { "name": "conv2d_1/bias", "shape": [16], "dtype": "float32" }, + { + "name": "conv2d_2/kernel", + "shape": [3, 3, 16, 32], + "dtype": "float32" + }, + { "name": "conv2d_2/bias", "shape": [32], "dtype": "float32" }, + { + "name": "conv2d_3/kernel", + "shape": [3, 3, 32, 64], + "dtype": "float32" + }, + { "name": "conv2d_3/bias", "shape": [64], "dtype": "float32" }, + { + "name": "conv2d_4/kernel", + "shape": [3, 3, 64, 128], + "dtype": "float32" + }, + { "name": "conv2d_4/bias", "shape": [128], "dtype": "float32" }, + { + "name": "conv2d_5/kernel", + "shape": [3, 3, 128, 256], + "dtype": "float32" + }, + { "name": "conv2d_5/bias", "shape": [256], "dtype": "float32" }, + { + "name": "conv2d_6/kernel", + "shape": [3, 3, 256, 512], + "dtype": "float32" + }, + { "name": "conv2d_6/bias", "shape": [512], "dtype": "float32" }, + { + "name": "conv2d_7/kernel", + "shape": [3, 3, 512, 1024], + "dtype": "float32" + }, + { "name": "conv2d_7/bias", "shape": [1024], "dtype": "float32" }, + { + "name": "conv2d_8/kernel", + "shape": [3, 3, 1024, 512], + "dtype": "float32" + }, + { "name": "conv2d_8/bias", "shape": [512], "dtype": "float32" }, + { + "name": "conv2d_9/kernel", + "shape": [1, 1, 512, 425], + "dtype": "float32" + }, + { "name": "conv2d_9/bias", "shape": [425], "dtype": "float32" } + ] + } + ] +} diff --git a/javascript/yolo-example/models/yolov2-tiny/model2.json b/javascript/yolo-example/models/yolov2-tiny/model2.json new file mode 100644 index 00000000..30cafd07 --- /dev/null +++ b/javascript/yolo-example/models/yolov2-tiny/model2.json @@ -0,0 +1,583 @@ +{ + "modelTopology": { + "keras_version": "2.2.2", + "backend": "tensorflow", + "model_config": { + "class_name": "Model", + "config": { + "name": "model_1", + "layers": [ + { + "name": "input_1", + "class_name": "InputLayer", + "config": { + "batch_input_shape": [null,null, null, 3], + "dtype": "float32", + "sparse": false, + "name": "input_1" + }, + "inbound_nodes": [] + }, + + { + "name": "conv2d_1", + "class_name": "Conv2D", + "config": { + "name": "conv2d_1", + "trainable": true, + "filters": 16, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["input_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_1", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_1", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_1", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_1", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_1", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_1", 0, 0, {}]]] + }, + + + { + "name": "conv2d_2", + "class_name": "Conv2D", + "config": { + "name": "conv2d_2", + "trainable": true, + "filters": 32, + "kernel_size": [3, 3], + "strides": [2, 2], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_2", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_2", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_2", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_2", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_2", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_2", 0, 0, {}]]] + }, + + + { + "name": "conv2d_3", + "class_name": "Conv2D", + "config": { + "name": "conv2d_3", + "trainable": true, + "filters": 64, + "kernel_size": [3, 3], + "strides": [2, 2], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_2", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_3", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_3", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_3", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_3", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_3", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_3", 0, 0, {}]]] + }, + + { + "name": "conv2d_4", + "class_name": "Conv2D", + "config": { + "name": "conv2d_4", + "trainable": true, + "filters": 128, + "kernel_size": [3, 3], + "strides": [2, 2], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_3", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_4", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_4", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_4", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_4", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_4", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_4", 0, 0, {}]]] + }, + + + { + "name": "conv2d_5", + "class_name": "Conv2D", + "config": { + "name": "conv2d_5", + "trainable": true, + "filters": 256, + "kernel_size": [3, 3], + "strides": [2, 2], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_4", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_5", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_5", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_5", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_5", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_5", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_5", 0, 0, {}]]] + }, + + + { + "name": "conv2d_6", + "class_name": "Conv2D", + "config": { + "name": "conv2d_6", + "trainable": true, + "filters": 512, + "kernel_size": [3, 3], + "strides": [2, 2], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_5", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_6", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_6", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_6", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_6", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_6", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [1, 1], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_6", 0, 0, {}]]] + }, + { + "name": "conv2d_7", + "class_name": "Conv2D", + "config": { + "name": "conv2d_7", + "trainable": true, + "filters": 1024, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_6", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_7", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_7", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_7", 0, 0, {}]]] + }, + { + "name": "conv2d_8", + "class_name": "Conv2D", + "config": { + "name": "conv2d_8", + "trainable": true, + "filters": 512, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_7", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_8", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_8", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_8", 0, 0, {}]]] + }, + { + "name": "conv2d_9", + "class_name": "Conv2D", + "config": { + "name": "conv2d_9", + "trainable": true, + "filters": 425, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1.0, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": { "class_name": "Zeros", "config": {} }, + "kernel_regularizer": { + "class_name": "L1L2", + "config": { "l1": 0.0, "l2": 0.0005000000237487257 } + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_8", 0, 0, {}]]] + } + ], + "input_layers": [["input_1", 0, 0]], + "output_layers": [["conv2d_9", 0, 0]] + } + } + }, + "weightsManifest": [ + { + "paths": [ + "group1-shard1of11", + "group1-shard2of11", + "group1-shard3of11", + "group1-shard4of11", + "group1-shard5of11", + "group1-shard6of11", + "group1-shard7of11", + "group1-shard8of11", + "group1-shard9of11", + "group1-shard10of11", + "group1-shard11of11" + ], + "weights": [ + { + "name": "conv2d_1/kernel", + "shape": [3, 3, 3, 16], + "dtype": "float32" + }, + { "name": "conv2d_1/bias", "shape": [16], "dtype": "float32" }, + { + "name": "conv2d_2/kernel", + "shape": [3, 3, 16, 32], + "dtype": "float32" + }, + { "name": "conv2d_2/bias", "shape": [32], "dtype": "float32" }, + { + "name": "conv2d_3/kernel", + "shape": [3, 3, 32, 64], + "dtype": "float32" + }, + { "name": "conv2d_3/bias", "shape": [64], "dtype": "float32" }, + { + "name": "conv2d_4/kernel", + "shape": [3, 3, 64, 128], + "dtype": "float32" + }, + { "name": "conv2d_4/bias", "shape": [128], "dtype": "float32" }, + { + "name": "conv2d_5/kernel", + "shape": [3, 3, 128, 256], + "dtype": "float32" + }, + { "name": "conv2d_5/bias", "shape": [256], "dtype": "float32" }, + { + "name": "conv2d_6/kernel", + "shape": [3, 3, 256, 512], + "dtype": "float32" + }, + { "name": "conv2d_6/bias", "shape": [512], "dtype": "float32" }, + { + "name": "conv2d_7/kernel", + "shape": [3, 3, 512, 1024], + "dtype": "float32" + }, + { "name": "conv2d_7/bias", "shape": [1024], "dtype": "float32" }, + { + "name": "conv2d_8/kernel", + "shape": [3, 3, 1024, 512], + "dtype": "float32" + }, + { "name": "conv2d_8/bias", "shape": [512], "dtype": "float32" }, + { + "name": "conv2d_9/kernel", + "shape": [1, 1, 512, 425], + "dtype": "float32" + }, + { "name": "conv2d_9/bias", "shape": [425], "dtype": "float32" } + ] + } + ] +} diff --git a/javascript/yolo-example/models/yolov3-tiny/group1-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group1-shard1of1 new file mode 100644 index 00000000..a5c449b6 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group1-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group10-shard1of2 b/javascript/yolo-example/models/yolov3-tiny/group10-shard1of2 new file mode 100644 index 00000000..d866ff75 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group10-shard1of2 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group10-shard2of2 b/javascript/yolo-example/models/yolov3-tiny/group10-shard2of2 new file mode 100644 index 00000000..9f0383b1 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group10-shard2of2 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group11-shard1of5 b/javascript/yolo-example/models/yolov3-tiny/group11-shard1of5 new file mode 100644 index 00000000..852cbcb0 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group11-shard1of5 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group11-shard2of5 b/javascript/yolo-example/models/yolov3-tiny/group11-shard2of5 new file mode 100644 index 00000000..b9acb79a Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group11-shard2of5 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group11-shard3of5 b/javascript/yolo-example/models/yolov3-tiny/group11-shard3of5 new file mode 100644 index 00000000..5476a22a Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group11-shard3of5 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group11-shard4of5 b/javascript/yolo-example/models/yolov3-tiny/group11-shard4of5 new file mode 100644 index 00000000..010603da Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group11-shard4of5 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group11-shard5of5 b/javascript/yolo-example/models/yolov3-tiny/group11-shard5of5 new file mode 100644 index 00000000..5bfe9c76 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group11-shard5of5 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group12-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group12-shard1of1 new file mode 100644 index 00000000..6b9c73de Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group12-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group13-shard1of2 b/javascript/yolo-example/models/yolov3-tiny/group13-shard1of2 new file mode 100644 index 00000000..b49af3bc Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group13-shard1of2 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group13-shard2of2 b/javascript/yolo-example/models/yolov3-tiny/group13-shard2of2 new file mode 100644 index 00000000..d5d70e6b Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group13-shard2of2 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group2-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group2-shard1of1 new file mode 100644 index 00000000..be3f09bb Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group2-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group3-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group3-shard1of1 new file mode 100644 index 00000000..65fcb74f Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group3-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group4-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group4-shard1of1 new file mode 100644 index 00000000..1554ee59 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group4-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group5-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group5-shard1of1 new file mode 100644 index 00000000..fd5bd312 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group5-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group6-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group6-shard1of1 new file mode 100644 index 00000000..2ad6d504 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group6-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group7-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group7-shard1of1 new file mode 100644 index 00000000..4d7b539e Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group7-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group8-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group8-shard1of1 new file mode 100644 index 00000000..b2054f47 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group8-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/group9-shard1of1 b/javascript/yolo-example/models/yolov3-tiny/group9-shard1of1 new file mode 100644 index 00000000..e9399380 Binary files /dev/null and b/javascript/yolo-example/models/yolov3-tiny/group9-shard1of1 differ diff --git a/javascript/yolo-example/models/yolov3-tiny/model.json b/javascript/yolo-example/models/yolov3-tiny/model.json new file mode 100644 index 00000000..90ad26f4 --- /dev/null +++ b/javascript/yolo-example/models/yolov3-tiny/model.json @@ -0,0 +1,836 @@ +{ + "modelTopology": { + "keras_version": "2.1.6", + "backend": "tensorflow", + "model_config": { + "class_name": "Model", + "config": { + "name": "model_1", + "layers": [ + { + "name": "input_1", + "class_name": "InputLayer", + "config": { + "batch_input_shape": [null, null, null, 3], + "dtype": "float32", + "sparse": false, + "name": "input_1" + }, + "inbound_nodes": [] + }, + { + "name": "conv2d_1", + "class_name": "Conv2D", + "config": { + "name": "conv2d_1", + "trainable": true, + "filters": 16, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["input_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_1", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_1", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_1", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_1", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_1", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_1", 0, 0, {}]]] + }, + { + "name": "conv2d_2", + "class_name": "Conv2D", + "config": { + "name": "conv2d_2", + "trainable": true, + "filters": 32, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_2", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_2", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_2", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_2", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_2", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_2", 0, 0, {}]]] + }, + { + "name": "conv2d_3", + "class_name": "Conv2D", + "config": { + "name": "conv2d_3", + "trainable": true, + "filters": 64, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_2", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_3", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_3", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_3", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_3", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_3", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_3", 0, 0, {}]]] + }, + { + "name": "conv2d_4", + "class_name": "Conv2D", + "config": { + "name": "conv2d_4", + "trainable": true, + "filters": 128, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_3", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_4", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_4", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_4", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_4", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_4", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_4", 0, 0, {}]]] + }, + { + "name": "conv2d_5", + "class_name": "Conv2D", + "config": { + "name": "conv2d_5", + "trainable": true, + "filters": 256, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_4", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_5", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_5", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_5", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_5", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_5", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_5", 0, 0, {}]]] + }, + { + "name": "conv2d_6", + "class_name": "Conv2D", + "config": { + "name": "conv2d_6", + "trainable": true, + "filters": 512, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_5", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_6", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_6", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_6", 0, 0, {}]]] + }, + { + "name": "max_pooling2d_6", + "class_name": "MaxPooling2D", + "config": { + "name": "max_pooling2d_6", + "trainable": true, + "pool_size": [2, 2], + "padding": "same", + "strides": [1, 1], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_6", 0, 0, {}]]] + }, + { + "name": "conv2d_7", + "class_name": "Conv2D", + "config": { + "name": "conv2d_7", + "trainable": true, + "filters": 1024, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["max_pooling2d_6", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_7", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_7", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_7", 0, 0, {}]]] + }, + { + "name": "conv2d_8", + "class_name": "Conv2D", + "config": { + "name": "conv2d_8", + "trainable": true, + "filters": 256, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_7", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_8", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_8", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_8", 0, 0, {}]]] + }, + { + "name": "conv2d_11", + "class_name": "Conv2D", + "config": { + "name": "conv2d_11", + "trainable": true, + "filters": 128, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_8", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_10", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_10", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_11", 0, 0, {}]]] + }, + { + "name": "up_sampling2d_1", + "class_name": "UpSampling2D", + "config": { + "name": "up_sampling2d_1", + "trainable": true, + "size": [2, 2], + "data_format": "channels_last" + }, + "inbound_nodes": [[["leaky_re_lu_10", 0, 0, {}]]] + }, + { + "name": "concatenate_1", + "class_name": "Concatenate", + "config": {"name": "concatenate_1", "trainable": true, "axis": -1}, + "inbound_nodes": [ + [["up_sampling2d_1", 0, 0, {}], ["leaky_re_lu_5", 0, 0, {}]] + ] + }, + { + "name": "conv2d_9", + "class_name": "Conv2D", + "config": { + "name": "conv2d_9", + "trainable": true, + "filters": 512, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_8", 0, 0, {}]]] + }, + { + "name": "conv2d_12", + "class_name": "Conv2D", + "config": { + "name": "conv2d_12", + "trainable": true, + "filters": 256, + "kernel_size": [3, 3], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["concatenate_1", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_9", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_9", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_9", 0, 0, {}]]] + }, + { + "name": "leaky_re_lu_11", + "class_name": "LeakyReLU", + "config": { + "name": "leaky_re_lu_11", + "trainable": true, + "alpha": 0.10000000149011612 + }, + "inbound_nodes": [[["conv2d_12", 0, 0, {}]]] + }, + { + "name": "conv2d_10", + "class_name": "Conv2D", + "config": { + "name": "conv2d_10", + "trainable": true, + "filters": 255, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_9", 0, 0, {}]]] + }, + { + "name": "conv2d_13", + "class_name": "Conv2D", + "config": { + "name": "conv2d_13", + "trainable": true, + "filters": 255, + "kernel_size": [1, 1], + "strides": [1, 1], + "padding": "same", + "data_format": "channels_last", + "dilation_rate": [1, 1], + "activation": "linear", + "use_bias": true, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "scale": 1, + "mode": "fan_avg", + "distribution": "uniform", + "seed": null + } + }, + "bias_initializer": {"class_name": "Zeros", "config": {}}, + "kernel_regularizer": { + "class_name": "L1L2", + "config": {"l1": 0, "l2": 0.0005000000237487257} + }, + "bias_regularizer": null, + "activity_regularizer": null, + "kernel_constraint": null, + "bias_constraint": null + }, + "inbound_nodes": [[["leaky_re_lu_11", 0, 0, {}]]] + } + ], + "input_layers": [["input_1", 0, 0]], + "output_layers": [["conv2d_10", 0, 0], ["conv2d_13", 0, 0]] + } + } + }, + "weightsManifest": [ + { + "paths": ["group1-shard1of1"], + "weights": [ + {"name": "conv2d_1/kernel", "shape": [3, 3, 3, 16], "dtype": "float32"}, + {"name": "conv2d_1/bias", "shape": [16], "dtype": "float32"} + ] + }, + { + "paths": ["group2-shard1of1"], + "weights": [ + { + "name": "conv2d_10/kernel", + "shape": [1, 1, 512, 255], + "dtype": "float32" + }, + {"name": "conv2d_10/bias", "shape": [255], "dtype": "float32"} + ] + }, + { + "paths": ["group3-shard1of1"], + "weights": [ + { + "name": "conv2d_11/kernel", + "shape": [1, 1, 256, 128], + "dtype": "float32" + }, + {"name": "conv2d_11/bias", "shape": [128], "dtype": "float32"} + ] + }, + { + "paths": ["group4-shard1of1"], + "weights": [ + { + "name": "conv2d_12/kernel", + "shape": [3, 3, 384, 256], + "dtype": "float32" + }, + {"name": "conv2d_12/bias", "shape": [256], "dtype": "float32"} + ] + }, + { + "paths": ["group5-shard1of1"], + "weights": [ + { + "name": "conv2d_13/kernel", + "shape": [1, 1, 256, 255], + "dtype": "float32" + }, + {"name": "conv2d_13/bias", "shape": [255], "dtype": "float32"} + ] + }, + { + "paths": ["group6-shard1of1"], + "weights": [ + { + "name": "conv2d_2/kernel", + "shape": [3, 3, 16, 32], + "dtype": "float32" + }, + {"name": "conv2d_2/bias", "shape": [32], "dtype": "float32"} + ] + }, + { + "paths": ["group7-shard1of1"], + "weights": [ + { + "name": "conv2d_3/kernel", + "shape": [3, 3, 32, 64], + "dtype": "float32" + }, + {"name": "conv2d_3/bias", "shape": [64], "dtype": "float32"} + ] + }, + { + "paths": ["group8-shard1of1"], + "weights": [ + { + "name": "conv2d_4/kernel", + "shape": [3, 3, 64, 128], + "dtype": "float32" + }, + {"name": "conv2d_4/bias", "shape": [128], "dtype": "float32"} + ] + }, + { + "paths": ["group9-shard1of1"], + "weights": [ + { + "name": "conv2d_5/kernel", + "shape": [3, 3, 128, 256], + "dtype": "float32" + }, + {"name": "conv2d_5/bias", "shape": [256], "dtype": "float32"} + ] + }, + { + "paths": ["group10-shard1of2", "group10-shard2of2"], + "weights": [ + { + "name": "conv2d_6/kernel", + "shape": [3, 3, 256, 512], + "dtype": "float32" + }, + {"name": "conv2d_6/bias", "shape": [512], "dtype": "float32"} + ] + }, + { + "paths": [ + "group11-shard1of5", + "group11-shard2of5", + "group11-shard3of5", + "group11-shard4of5", + "group11-shard5of5" + ], + "weights": [ + { + "name": "conv2d_7/kernel", + "shape": [3, 3, 512, 1024], + "dtype": "float32" + }, + {"name": "conv2d_7/bias", "shape": [1024], "dtype": "float32"} + ] + }, + { + "paths": ["group12-shard1of1"], + "weights": [ + { + "name": "conv2d_8/kernel", + "shape": [1, 1, 1024, 256], + "dtype": "float32" + }, + {"name": "conv2d_8/bias", "shape": [256], "dtype": "float32"} + ] + }, + { + "paths": ["group13-shard1of2", "group13-shard2of2"], + "weights": [ + { + "name": "conv2d_9/kernel", + "shape": [3, 3, 256, 512], + "dtype": "float32" + }, + {"name": "conv2d_9/bias", "shape": [512], "dtype": "float32"} + ] + } + ] +} \ No newline at end of file diff --git a/javascript/yolo-example/sketch.js b/javascript/yolo-example/sketch.js new file mode 100644 index 00000000..a415ee5f --- /dev/null +++ b/javascript/yolo-example/sketch.js @@ -0,0 +1,153 @@ +let MEDIA_READY_TO_DETECT = false; +let IS_DETECTING = false; +let IS_PAGE_VISIBLE = true; +let IS_TRACK_STOPED = false; +// configs +const cameraconfig = { + audio: false, + video: { + facingMode: 'environment', + width: { + ideal: 1280 + }, + height: { + ideal: 720 + } + } +} +const tinyyolov2Config = { + modelURL: 'models/yolov2-tiny/model.json', + modelSize: 224, + iouThreshold: 0.5, + classProbThreshold: 0.5, +} +const yoloLiteConfig = { + modelURL: 'models/yolov2-lite/model.json', + modelSize: 224, + iouThreshold: 0.7, + classProbThreshold: 0.3, + anchors:[[1.08,1.19],[3.42,4.41],[6.63,11.38],[9.42,5.11],[16.62,10.52]], +} +const tinyyolov3Config = { + modelURL: 'models/yolov3-tiny/model.json', + version: 'v3', + modelSize: 224, + iouThreshold: 0.5, + classProbThreshold: 0.5, + anchors: [[10, 14],[23, 27],[37, 58],[81, 82],[135, 169],[344, 319]], + masks: [[3, 4, 5],[0, 1, 2]], +} + +visibilityChanged = () => { + console.log(document.visibilityState) + if (document.visibilityState === 'visible') { + IS_PAGE_VISIBLE = true; + if (IS_TRACK_STOPED) { + resumeVideoTrack(); + IS_TRACK_STOPED = false; + } + } else { + IS_PAGE_VISIBLE = false; + stopVideoTrack(); + IS_TRACK_STOPED = true; + MEDIA_READY_TO_DETECT = false; + } +} +videoSizeChanged = () => { + // tf.from fixels needs this with the video element + videoSource.setAttribute("width", `${videoSource.offsetWidth}px`) + videoSource.setAttribute("height", `${videoSource.offsetHeight}px`) + outputCanvas.width = videoSource.offsetWidth + outputCanvas.height = videoSource.offsetHeight +} +stopVideoTrack = () => { + let stream = videoSource.srcObject; + let tracks = stream.getTracks(); + tracks.forEach(function (track) { + track.stop(); + }); + videoSource.srcObject = null; + MEDIA_READY_TO_DETECT = false; +} +resumeVideoTrack = () => { + if (!videoSource.srcObject) { + setCameraToVideoElement(videoSource).then(() => { + MEDIA_READY_TO_DETECT = true; + }); + } + +} +clearCanvas = () =>{ + ctx.clearRect(0, 0, outputCanvas.width,outputCanvas.height); +} +toogleDetection = () => { + if (IS_DETECTING) { + IS_DETECTING = false; + clearCanvas() + toogleDetectionBtn.innerHTML = 'Start Detection' + toogleDetectionBtn.classList.remove('btn-outline-danger') + toogleDetectionBtn.classList.add('btn-outline-success') + } + else{ + IS_DETECTING = true + if (MEDIA_READY_TO_DETECT) { + detect(); + toogleDetectionBtn.innerHTML = 'Stop Detection' + toogleDetectionBtn.classList.remove('btn-outline-success') + toogleDetectionBtn.classList.add('btn-outline-danger') + } + + } +} + +loadModel = () =>{ + if (yolo == null ) { + loadBtn.innerHTML = "Loading...." + yolo = ml5.YOLO(videoSource, tinyyolov3Config, yoloLoaded); + }else{ + alert('YOLO is Already Loaded') + } +} +yoloLoaded = () =>{ + loadBtn.setAttribute('class','btn btn-success') + loadBtn.innerHTML = "Loaded" + loadBtn.disabled = true + toogleDetectionBtn.disabled = false +} +detect = () => { + stats.begin(); + yolo.detect(function(err, results) { + clearCanvas() + yolo.draw(results,outputCanvas) + stats.end() + console.log(results) + if (IS_DETECTING && MEDIA_READY_TO_DETECT) { + detect(); + } + else { + clearCanvas() + } + }); + } +//////////////////////////////////ENTRY CODE////////////////////////////////////////// +const loadBtn = document.getElementById('loadBtn') +const toogleDetectionBtn = document.getElementById('detectBtn') + + +const videoSource = document.getElementById('videoElem') +const outputCanvas = document.getElementById('detection') +const ctx = outputCanvas.getContext('2d'); +const controlslayer = document.getElementById("fps-meter-layer") + +let yolo = null; +// stats +const stats = new Stats(); +stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom +controlslayer.appendChild(stats.dom); +setCameraToVideoElement(videoSource).then(()=>{ + MEDIA_READY_TO_DETECT = true; +}) +// handle size changes & visibility; +const resizeObserver = new ResizeObserver(videoSizeChanged).observe(videoSource) +document.addEventListener("visibilitychange",visibilityChanged); +///////////////////////////////////////////////////////////////////////////////////// diff --git a/javascript/yolo-example/stats.min.js b/javascript/yolo-example/stats.min.js new file mode 100644 index 00000000..bb1a672c --- /dev/null +++ b/javascript/yolo-example/stats.min.js @@ -0,0 +1,102 @@ +// stats.js - http://github.com/mrdoob/stats.js +(function (f, e) { + "object" === typeof exports && "undefined" !== typeof module ? module.exports = e() : "function" === typeof define && define.amd ? define(e) : f.Stats = e() +})(this, function () { + var f = function () { + function e(a) { + c.appendChild(a.dom); + return a + } + + function u(a) { + for (var d = 0; d < c.children.length; d++) c.children[d].style.display = d === a ? "block" : "none"; + l = a + } + var l = 0, + c = document.createElement("div"); + c.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.7;"; + c.addEventListener("click", function (a) { + a.preventDefault(); + u(++l % c.children.length) + }, !1); + var k = (performance || Date).now(), + g = k, + a = 0, + r = e(new f.Panel("FPS", "#0ff", "#002")), + h = e(new f.Panel("MS", "#0f0", "#020")); + if (self.performance && self.performance.memory) var t = e(new f.Panel("MB", "#f08", "#201")); + u(0); + return { + REVISION: 16, + dom: c, + addPanel: e, + showPanel: u, + begin: function () { + k = (performance || Date).now() + }, + end: function () { + a++; + var c = (performance || Date).now(); + h.update(c - k, 200); + if (c > g + 1E3 && (r.update(1E3 * a / (c - g), 100), g = c, a = 0, t)) { + var d = performance.memory; + t.update(d.usedJSHeapSize / + 1048576, d.jsHeapSizeLimit / 1048576) + } + return c + }, + update: function () { + k = this.end() + }, + domElement: c, + setMode: u + } + }; + f.Panel = function (e, f, l) { + var c = Infinity, + k = 0, + g = Math.round, + a = g(window.devicePixelRatio || 1), + r = 80 * a, + h = 48 * a, + t = 3 * a, + v = 2 * a, + d = 3 * a, + m = 15 * a, + n = 74 * a, + p = 30 * a, + q = document.createElement("canvas"); + q.width = r; + q.height = h; + q.style.cssText = "width:80px;height:48px"; + var b = q.getContext("2d"); + b.font = "bold " + 9 * a + "px Helvetica,Arial,sans-serif"; + b.textBaseline = "top"; + b.fillStyle = l; + b.fillRect(0, 0, r, h); + b.fillStyle = f; + b.fillText(e, t, v); + b.fillRect(d, m, n, p); + b.fillStyle = l; + b.globalAlpha = .9; + b.fillRect(d, m, n, p); + return { + dom: q, + update: function (h, w) { + c = Math.min(c, h); + k = Math.max(k, h); + b.fillStyle = l; + b.globalAlpha = 1; + b.fillRect(0, 0, r, m); + b.fillStyle = f; + b.fillText(g(h) + " " + e + " (" + g(c) + "-" + g(k) + ")", t, v); + b.drawImage(q, d + a, m, n - a, p, d, m, n - a, p); + b.fillRect(d + n - a, m, a, p); + b.fillStyle = l; + b.globalAlpha = .9; + b.fillRect(d + n - a, m, a, g((1 - h / w) * p)) + } + } + }; + return f +}); \ No newline at end of file