From 2787716808ad13368622a2f4d204273dfc1b3bb6 Mon Sep 17 00:00:00 2001 From: Shekhovtsov Alexander Date: Mon, 29 Oct 2018 10:11:00 +0300 Subject: [PATCH 1/4] Add SearchBar for layers selection (#400) * Add SearchBar for layers selection * Remove commented code * Add new line to the end of css file * Fix searchbar error with only one letter pattern * Prettifying * Fix bug with no search results --- .eslintrc | 3 +- ide/static/css/searchbar_style.css | 36 +++++++++++++++++++ ide/static/css/style.css | 2 +- ide/static/js/content.js | 6 +++- ide/static/js/layer.js | 1 + ide/static/js/pane.js | 56 +++++++++++++++++++++++++++++- ide/static/js/tabs.js | 2 +- ide/templates/index.html | 3 ++ 8 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 ide/static/css/searchbar_style.css diff --git a/.eslintrc b/.eslintrc index 818be27c2..2058cb5ca 100644 --- a/.eslintrc +++ b/.eslintrc @@ -16,7 +16,8 @@ "jsPlumbUtil": false, }, "rules": { - "max-len": [1, 150, 2, {ignoreComments: true}] + "max-len": [1, 150, 2, {ignoreComments: true}], + "no-console": "off" }, "extends": ["eslint:recommended", "plugin:react/recommended"] } diff --git a/ide/static/css/searchbar_style.css b/ide/static/css/searchbar_style.css new file mode 100644 index 000000000..3a304a166 --- /dev/null +++ b/ide/static/css/searchbar_style.css @@ -0,0 +1,36 @@ +.insert-layer-title { + position: relative; + margin-top: 10px !important; + margin-bottom: 21px !important; +} + +#layer-search-icon { + position: absolute; + left: -5px; + top: 31px; +} + +#layer-search-icon:hover { + cursor: pointer; +} + +#layer-search-input { + position: absolute; + top: 36px; + left: 20px; + font-size: 15px; + background: none; + border: none; + color: rgb(69, 80, 97); + outline: none; + opacity: 1; + transition: 0.3s; +} + +.layer-search-input-selected { + opacity: 1 !important; +} + +.matched-search-char { + color: rgb(69, 80, 97); +} diff --git a/ide/static/css/style.css b/ide/static/css/style.css index ba99bd919..edbcda391 100644 --- a/ide/static/css/style.css +++ b/ide/static/css/style.css @@ -1206,4 +1206,4 @@ input[type="file"] { background: white; transform: rotate(-45deg) } -} +} \ No newline at end of file diff --git a/ide/static/js/content.js b/ide/static/js/content.js index 5de25865d..1653e6f65 100644 --- a/ide/static/js/content.js +++ b/ide/static/js/content.js @@ -1275,7 +1275,11 @@ class Content extends React.Component { />
LOGIN
-
INSERT LAYER
+
+ +
INSERT LAYER
+ search +
0) { highlightClass = 'highlighted'; diff --git a/ide/static/js/pane.js b/ide/static/js/pane.js index 635a420bb..2f1f96217 100644 --- a/ide/static/js/pane.js +++ b/ide/static/js/pane.js @@ -26,7 +26,61 @@ class Pane extends React.Component { } this.setState(obj); } - render(){ + componentDidMount() { + let filter = (pattern) => { + let layerCompability = (searchQuery, layerName) => { + let j = 0; + let seq = []; + let full_match = true; + for (let i = 0; i < searchQuery.length; i++) { + while (j < layerName.length && layerName[j].toLowerCase() != searchQuery[i].toLowerCase()) { + seq[j] = false; + j++; + } + if (j < layerName.length && layerName[j].toLowerCase() == searchQuery[i].toLowerCase()) { + seq[j] = true; + j++; + } else { + full_match = false; + } + } + return { + match: seq, + full_match: full_match + }; + } + for (let elem of $('.drowpdown-button')) { + let sub = elem.innerText; + if (!sub) continue; + let resp = layerCompability(pattern, sub); + if (resp.full_match) { + elem.style.display = 'block'; + let final = ''; + for (let i = 0; i < sub.length; i++) { + if (resp.match[i]) { + final += '' + sub[i] + '' + } else { + final += sub[i]; + } + } + elem.innerHTML = final; + } else { + elem.style.display = 'none'; + } + } + for (let elem of $('.panel-heading')) { + let _p = pattern ? 'false' : 'true'; + if (elem.getAttribute('aria-expanded') == _p) { + elem.click(); + } + } + } + $('#layer-search-input').keyup((e) => { + filter(e.target.value); + }); + } + + render() { return (
From 0fe057a28d5630e676981c2c835e27010ab11ab1 Mon Sep 17 00:00:00 2001 From: Bharath Raj Date: Mon, 29 Oct 2018 22:26:24 +0530 Subject: [PATCH 3/4] Webpack style fixes (#408) --- ide/static/js/content.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ide/static/js/content.js b/ide/static/js/content.js index b61371d80..4d363f308 100644 --- a/ide/static/js/content.js +++ b/ide/static/js/content.js @@ -1103,19 +1103,32 @@ class Content extends React.Component { faqModal() { this.modalHeader = "Help/FAQ" this.modalContent = (

Q: What is Fabrik?
- A: Fabrik is an online platform, created by CloudCV, allowing AI researchers and enthusiasts to build and visualize deep learning models.
+ A: Fabrik is an online platform, created by CloudCV, allowing AI researchers and enthusiasts to + build and visualize deep learning models.
Q: What is the model zoo?
- A: It is a collection of pre-built models that you can use. To access it, simply click the folder icon in the left corner of the toolbox and pick a model. You can find the available models here.
+ A: It is a collection of pre-built models that you can use. + To access it, simply click the folder icon in the left corner of the toolbox and pick a model. + You can find the available models + here. +
Q: What do the Train/Test buttons mean?
- A: They are two different modes of your model: Train and Test - respectively for training your model with data and testing how and if it works.
+ A: They are two different modes of your model: + Train and Test - respectively for training your model with data and testing how and if it works.
Q: What does the import fuction do?
- A: It allows you to import your previously created models in Caffe (.protoxt files), Keras (.json files) and TensorFlow (.pbtxt files)
+ A: It allows you to import your previously created models in Caffe (.protoxt files), + Keras (.json files) and TensorFlow (.pbtxt files)
Q: What does the export function do?
- A: You can use it to download models from Fabrik. You can train and test them directly on your computer, using Caffe, Keras and TensorFlow.
+ A: You can use it to download models from Fabrik. You can train and test them directly on your computer, + using Caffe, + Keras + and TensorFlow.
Q: How can I contribute to Fabrik?
- A: Please see the instructions listed here

+ A: Please see the instructions listed + here +

- If you have anymore questions, please visit Fabrik's Github page available here for more information. + If you have anymore questions, please visit Fabrik's Github page available + here for more information.

); this.openModal(); } From 9cbb00c3efa0e25e18e886db9829ae489fff2d47 Mon Sep 17 00:00:00 2001 From: Abhigyan Bhusal Date: Wed, 31 Oct 2018 22:40:28 +0545 Subject: [PATCH 4/4] Add denoising autoencoder in the model zoo (#413) * Add denoising autoencoder in the model zoo * edit model name * Add model to tested_models.md * Added model under tested models in readme * Fixed markdown formatting in readme --- README.md | 1 + docs/source/tested_models.md | 1 + example/keras/DAE_MNIST.json | 583 +++++++++++++++++++++++++++++++++++ ide/static/js/modelZoo.js | 2 + 4 files changed, 587 insertions(+) create mode 100644 example/keras/DAE_MNIST.json diff --git a/README.md b/README.md index 60aff18ed..50db680a2 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,7 @@ Models | Ca [YoloNet](https://arxiv.org/abs/1506.02640) | √ | √ | √ | [Pix2Pix](https://github.com/phillipi/pix2pix) | √ | × | × | [VQA](https://github.com/iamaaditya/VQA_Demo) | √ | √ | √ | +[Denoising Auto-Encoder](https://blog.keras.io/building-autoencoders-in-keras.html) | × | √ | √ | Note: For models that use a custom LRN layer (Alexnet), Keras expects the custom layer to be passed when it is loaded from json. LRN.py is located in keras_app/custom_layers. [Alexnet import for Keras](https://github.com/Cloud-CV/Fabrik/blob/master/tutorials/keras_custom_layer_usage.md) diff --git a/docs/source/tested_models.md b/docs/source/tested_models.md index a8948c609..c028803d0 100644 --- a/docs/source/tested_models.md +++ b/docs/source/tested_models.md @@ -35,6 +35,7 @@ * Seq2Seq Translation [\[Source\]](https://github.com/fchollet/keras/blob/master/examples/lstm_seq2seq.py)[\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20171208115116hsfax) * Text Generation [\[Source\]](https://machinelearningmastery.com/text-generation-lstm-recurrent-neural-networks-python-keras/)[\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20171208113517iphlh) * Pix2Pix [\[Source\]](https://github.com/phillipi/pix2pix) [\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20180105143836eahgb) +* Denoising Auto-Encoder [\[Source\]](https://blog.keras.io/building-autoencoders-in-keras.html) ### Captioning diff --git a/example/keras/DAE_MNIST.json b/example/keras/DAE_MNIST.json new file mode 100644 index 000000000..468312bce --- /dev/null +++ b/example/keras/DAE_MNIST.json @@ -0,0 +1,583 @@ +{ + "backend": "tensorflow", + "class_name": "Model", + "config": { + "input_layers": [ + [ + "input_1", + 0, + 0 + ] + ], + "layers": [ + { + "class_name": "InputLayer", + "config": { + "batch_input_shape": [ + null, + 28, + 28, + 1 + ], + "dtype": "float32", + "name": "input_1", + "sparse": false + }, + "inbound_nodes": [], + "name": "input_1" + }, + { + "class_name": "GaussianNoise", + "config": { + "name": "gaussian_noise_1", + "stddev": 0.2, + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "input_1", + 0, + 0, + {} + ] + ] + ], + "name": "gaussian_noise_1" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "relu", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 16, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_1", + "padding": "same", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "gaussian_noise_1", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_1" + }, + { + "class_name": "MaxPooling2D", + "config": { + "data_format": "channels_last", + "name": "max_pooling2d_1", + "padding": "same", + "pool_size": [ + 2, + 2 + ], + "strides": [ + 2, + 2 + ], + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "conv2d_1", + 0, + 0, + {} + ] + ] + ], + "name": "max_pooling2d_1" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "relu", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 8, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_2", + "padding": "same", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "max_pooling2d_1", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_2" + }, + { + "class_name": "MaxPooling2D", + "config": { + "data_format": "channels_last", + "name": "max_pooling2d_2", + "padding": "same", + "pool_size": [ + 2, + 2 + ], + "strides": [ + 2, + 2 + ], + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "conv2d_2", + 0, + 0, + {} + ] + ] + ], + "name": "max_pooling2d_2" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "relu", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 8, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_3", + "padding": "same", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "max_pooling2d_2", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_3" + }, + { + "class_name": "MaxPooling2D", + "config": { + "data_format": "channels_last", + "name": "max_pooling2d_3", + "padding": "same", + "pool_size": [ + 2, + 2 + ], + "strides": [ + 2, + 2 + ], + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "conv2d_3", + 0, + 0, + {} + ] + ] + ], + "name": "max_pooling2d_3" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "relu", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 8, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_4", + "padding": "same", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "max_pooling2d_3", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_4" + }, + { + "class_name": "UpSampling2D", + "config": { + "data_format": "channels_last", + "name": "up_sampling2d_1", + "size": [ + 2, + 2 + ], + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "conv2d_4", + 0, + 0, + {} + ] + ] + ], + "name": "up_sampling2d_1" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "relu", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 8, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_5", + "padding": "same", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "up_sampling2d_1", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_5" + }, + { + "class_name": "UpSampling2D", + "config": { + "data_format": "channels_last", + "name": "up_sampling2d_2", + "size": [ + 2, + 2 + ], + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "conv2d_5", + 0, + 0, + {} + ] + ] + ], + "name": "up_sampling2d_2" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "relu", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 16, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_6", + "padding": "valid", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "up_sampling2d_2", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_6" + }, + { + "class_name": "UpSampling2D", + "config": { + "data_format": "channels_last", + "name": "up_sampling2d_3", + "size": [ + 2, + 2 + ], + "trainable": true + }, + "inbound_nodes": [ + [ + [ + "conv2d_6", + 0, + 0, + {} + ] + ] + ], + "name": "up_sampling2d_3" + }, + { + "class_name": "Conv2D", + "config": { + "activation": "sigmoid", + "activity_regularizer": null, + "bias_constraint": null, + "bias_initializer": { + "class_name": "Zeros", + "config": {} + }, + "bias_regularizer": null, + "data_format": "channels_last", + "dilation_rate": [ + 1, + 1 + ], + "filters": 1, + "kernel_constraint": null, + "kernel_initializer": { + "class_name": "VarianceScaling", + "config": { + "distribution": "uniform", + "mode": "fan_avg", + "scale": 1.0, + "seed": null + } + }, + "kernel_regularizer": null, + "kernel_size": [ + 3, + 3 + ], + "name": "conv2d_7", + "padding": "same", + "strides": [ + 1, + 1 + ], + "trainable": true, + "use_bias": true + }, + "inbound_nodes": [ + [ + [ + "up_sampling2d_3", + 0, + 0, + {} + ] + ] + ], + "name": "conv2d_7" + } + ], + "name": "Denoising Auto-Encoder", + "output_layers": [ + [ + "conv2d_7", + 0, + 0 + ] + ] + }, + "keras_version": "2.1.6" +} \ No newline at end of file diff --git a/ide/static/js/modelZoo.js b/ide/static/js/modelZoo.js index 186846286..320360427 100644 --- a/ide/static/js/modelZoo.js +++ b/ide/static/js/modelZoo.js @@ -55,6 +55,8 @@ class ModelZoo extends React.Component { Seq2Seq Translation
Pix2Pix +
+ Denoising Auto-Encoder

Caption