Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit 5b41f70

Browse files
authored
Adds ml5.js v0.3.0 to release (#144)
* set ml5 reference to localhost * Unet example webcam (#120) * added uNet example * rm video from model load * updated UNET example to current UNET implementation * set frameRate to 5 * Tinkering with segmentation example (#121) I am not sure this is better. I do prefer calling `segment()` from `gotResult()` itself, but maybe creating a blank image to eliminate the `draw()` if statement isn't a good idea. * Sentiment example (#118) * added sentiment example * move to p5js * fixed unet sketch at segmentationImage (#122) * add cvae example (#117) * added new cvae example (#123) * handle html elements in p5 and cleaned up functions (#124) * simplify CVAE example (#125) * simplfiying the sentiment example (#126) * simplify unet example (#127) * Update localhost reference and script (#129) * added http://localhost:8080/ml5.js * added all examples with correct http://localhost:8080/ml5.js * changing example to dropdown (#130) * changing example to dropdown * comments * Adds DCGAN example (#138) * initial commit * adds example of dcgan using small face model * use named function for callback * rm console.log * updated className to label (#141) * Feature extractor update to specify number of labels (#142) * added additional label - show how to specify label nums * adds object as input to .classificaiton() * changed version ml5 reference to 0.3.0 * added p5 version 0.8.0
1 parent be96efc commit 5b41f70

57 files changed

Lines changed: 432 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

javascript/FeatureExtractor_Image_Classification/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Image Classification using Feature Extraction with MobileNet</title>
66

77

8-
<script src="https://unpkg.com/ml5@0.2.3/dist/ml5.min.js" type="text/javascript"></script>
8+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
99

1010
<style></style>
1111
</head>

javascript/ImageClassification/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
<title>Image Classification Example</title>
66

77

8-
<script src="https://unpkg.com/ml5@0.2.3/dist/ml5.min.js" type="text/javascript"></script>
8+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
99
</head>
1010

1111
<body>
1212
<h1>Image classification using MobileNet</h1>
1313
<p>The MobileNet model labeled this as <span id="result">...</span> with a confidence of <span id="probability">...</span>.</p>
14-
<img src="images/bird.jpg" id="image" width="400" />
14+
<img src="images/bird.jpg" id="image" width="400" />
1515
<script src="sketch.js"></script>
1616
</body>
1717

javascript/ImageClassification_Video/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Webcam Image Classification using MobileNet</title>
66

77

8-
<script src="https://unpkg.com/ml5@0.2.3/dist/ml5.min.js" type="text/javascript"></script>
8+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
99
</head>
1010

1111
<body>

javascript/PoseNet/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<title>PoseNet Example</title>
66

7-
<script src="https://unpkg.com/ml5@0.2.3/dist/ml5.min.js" type="text/javascript"></script>
7+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
88

99
</head>
1010

javascript/Sentiment/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<html>
2+
3+
<head>
4+
<title>ml5 - Sentiment</title>
5+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
6+
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js"></script>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/addons/p5.dom.min.js"></script>
9+
10+
<style></style>
11+
12+
</head>
13+
14+
<body>
15+
<h1>Sentiment Analysis Demo
16+
</h1>
17+
<h2>Using a pre-trained model from TensorFlow.js Layers trained on short movie review. <br />
18+
This model is trained to predict the sentiment of a short movie review (as a score between 0 and 1)
19+
</h2>
20+
<h3>
21+
The model is trained using movie reviews that have been truncated to a maximum of 200 words, only the 20000 most used
22+
words in the reviews are used.
23+
</h3>
24+
25+
<p id='status'></p>
26+
27+
<div>
28+
<div class="row">
29+
<p>
30+
<input type="text" style="width: 100%" placeholder="input sentence to analize" id="inputText" />
31+
</p>
32+
<p>
33+
<button id="submit" class="btn btn-primary">predict sentiment</button>
34+
</p>
35+
<p id="sentiment-res">Sentiment score:</p>
36+
</div>
37+
</div>
38+
39+
40+
41+
<script src="sketch.js"></script>
42+
43+
</body>
44+
45+
</html>

javascript/StyleTransfer_Image/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Style Transfer Image Example with Promises</title>
6-
<script src="https://unpkg.com/ml5@0.2.3/dist/ml5.min.js" type="text/javascript"></script>
6+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
77

88
<style></style>
99
</head>
@@ -13,16 +13,16 @@
1313
<h1>Style Transfer Image Example</h1>
1414
<p id="statusMsg">Loading Models...</p>
1515
<p>Input Image:</p>
16-
<img src="img/patagonia.jpg" alt="input img" id="inputImg" />
16+
<img src="img/patagonia.jpg" alt="input img" id="inputImg" />
1717

1818
<div id="styleA">
1919
<p>Style A: <a href="https://en.wikipedia.org/wiki/The_Great_Wave_off_Kanagawa">The Great Wave off Kanagawa, 1829 - Katsushika Hokusai</a></p>
20-
<img src="img/wave.jpg" alt="style one" />
20+
<img src="img/wave.jpg" alt="style one" />
2121
</div>
2222

2323
<div id="styleB">
2424
<p>Style B: <a href="https://en.wikipedia.org/wiki/The_Great_Wave_off_Kanagawa">Udnie (Young American Girl, The Dance), 1913 - Francis Picabia</a></p>
25-
<img src="img/udnie.jpg" alt="style two" />
25+
<img src="img/udnie.jpg" alt="style two" />
2626
</div>
2727

2828
<script src="sketch.js"></script>

p5js/CVAE/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8" >
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
5+
<meta name="viewport" content="width=device-width, initial-scale=1" >
6+
7+
<title>CVAE with quick_draw</title>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js"></script>
9+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/addons/p5.dom.min.js"></script>
10+
<script src="https://unpkg.com/ml5@0.3.0/dist/ml5.min.js" type="text/javascript"></script>
11+
<script src="sketch.js"></script>
12+
</head>
13+
14+
<body>
15+
<h1>Conditional Variational Autoencoder (CVAE) - trained on Google Quick Draw</h1>
16+
</body>
17+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"model": "models/model.json", "labels": ["airplane", "alarm_clock", "ambulance", "angel", "ant", "anvil", "apple", "axe", "pickup_truck", "laptop", "leaf", "light_bulb", "lighter", "lightning", "lion", "lipstick", "lobster", "lollipop", "mailbox", "megaphone", "mermaid", "microphone", "microwave", "monkey", "moon", "mosquito", "motorbike", "mountain", "mouse", "mouth", "mug", "mushroom", "nail", "necklace", "ocean", "octopus", "onion", "oven", "owl", "panda", "pants", "paper_clip", "parachute", "ice_cream", "jacket", "jail", "kangaroo", "key", "keyboard", "knife"]}
245 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"modelTopology": {"keras_version": "2.2.2", "backend": "tensorflow", "model_config": {"class_name": "Model", "config": {"name": "decoder", "layers": [{"name": "latent_input", "class_name": "InputLayer", "config": {"batch_input_shape": [null, 16], "dtype": "float32", "sparse": false, "name": "latent_input"}, "inbound_nodes": []}, {"name": "label", "class_name": "InputLayer", "config": {"batch_input_shape": [null, 51], "dtype": "float32", "sparse": false, "name": "label"}, "inbound_nodes": []}, {"name": "concatenate_2", "class_name": "Concatenate", "config": {"name": "concatenate_2", "trainable": true, "axis": -1}, "inbound_nodes": [[["latent_input", 0, 0, {}], ["label", 0, 0, {}]]]}, {"name": "dense_5", "class_name": "Dense", "config": {"name": "dense_5", "trainable": true, "units": 784, "activation": "relu", "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": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "inbound_nodes": [[["concatenate_2", 0, 0, {}]]]}, {"name": "reshape_2", "class_name": "Reshape", "config": {"name": "reshape_2", "trainable": true, "target_shape": [7, 7, 16]}, "inbound_nodes": [[["dense_5", 0, 0, {}]]]}, {"name": "conv2d_transpose_1", "class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_1", "trainable": true, "filters": 32, "kernel_size": [3, 3], "strides": [1, 1], "padding": "same", "data_format": "channels_last", "activation": "relu", "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": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "inbound_nodes": [[["reshape_2", 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": [[["conv2d_transpose_1", 0, 0, {}]]]}, {"name": "conv2d_transpose_2", "class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_2", "trainable": true, "filters": 16, "kernel_size": [3, 3], "strides": [1, 1], "padding": "same", "data_format": "channels_last", "activation": "relu", "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": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "inbound_nodes": [[["up_sampling2d_1", 0, 0, {}]]]}, {"name": "up_sampling2d_2", "class_name": "UpSampling2D", "config": {"name": "up_sampling2d_2", "trainable": true, "size": [2, 2], "data_format": "channels_last"}, "inbound_nodes": [[["conv2d_transpose_2", 0, 0, {}]]]}, {"name": "conv2d_transpose_3", "class_name": "Conv2DTranspose", "config": {"name": "conv2d_transpose_3", "trainable": true, "filters": 1, "kernel_size": [3, 3], "strides": [1, 1], "padding": "same", "data_format": "channels_last", "activation": "sigmoid", "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": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null, "output_padding": null}, "inbound_nodes": [[["up_sampling2d_2", 0, 0, {}]]]}], "input_layers": [["latent_input", 0, 0], ["label", 0, 0]], "output_layers": [["conv2d_transpose_3", 0, 0]]}}}, "weightsManifest": [{"paths": ["group1-shard1of1"], "weights": [{"name": "conv2d_transpose_1/kernel", "shape": [3, 3, 32, 16], "dtype": "float32"}, {"name": "conv2d_transpose_1/bias", "shape": [32], "dtype": "float32"}, {"name": "conv2d_transpose_2/kernel", "shape": [3, 3, 16, 32], "dtype": "float32"}, {"name": "conv2d_transpose_2/bias", "shape": [16], "dtype": "float32"}, {"name": "conv2d_transpose_3/kernel", "shape": [3, 3, 1, 16], "dtype": "float32"}, {"name": "conv2d_transpose_3/bias", "shape": [1], "dtype": "float32"}, {"name": "dense_5/kernel", "shape": [67, 784], "dtype": "float32"}, {"name": "dense_5/bias", "shape": [784], "dtype": "float32"}]}]}

0 commit comments

Comments
 (0)