diff --git a/d3/KMeans/KMeans_GaussianClusterDemo/index.html b/d3/KMeans/KMeans_GaussianClusterDemo/index.html index eb005e44..43db9fb3 100644 --- a/d3/KMeans/KMeans_GaussianClusterDemo/index.html +++ b/d3/KMeans/KMeans_GaussianClusterDemo/index.html @@ -2,7 +2,7 @@
Loading Model
diff --git a/javascript/CharRNN/CharRNN_Text/index.html b/javascript/CharRNN/CharRNN_Text/index.html index 533790a5..8dfed0f9 100644 --- a/javascript/CharRNN/CharRNN_Text/index.html +++ b/javascript/CharRNN/CharRNN_Text/index.html @@ -3,7 +3,7 @@
seed text: - +
length: - 100
+ 100temperature: - 0.5
+ 0.5Loading Model
diff --git a/javascript/CharRNN/CharRNN_Text_Stateful/index.html b/javascript/CharRNN/CharRNN_Text_Stateful/index.html index 91bd97bc..f001524d 100644 --- a/javascript/CharRNN/CharRNN_Text_Stateful/index.html +++ b/javascript/CharRNN/CharRNN_Text_Stateful/index.html @@ -3,7 +3,7 @@Instead of feeding every single character every frame to predict the next character, we feed only the last character, and instruct the CharRNN to remember its internal state.
This example uses a pre-trained model on a corpus of Virginia Woolf
seed text: - +
temperature: - 0.5 + 0.5
Loading Model
diff --git a/javascript/DCGAN/DCGAN_Random/index.html b/javascript/DCGAN/DCGAN_Random/index.html index 0c53d340..6dad69c7 100644 --- a/javascript/DCGAN/DCGAN_Random/index.html +++ b/javascript/DCGAN/DCGAN_Random/index.html @@ -5,7 +5,7 @@- +
diff --git a/javascript/ImageClassification/ImageClassification/index.html b/javascript/ImageClassification/ImageClassification/index.html index 00b20ba2..82f6c3a0 100755 --- a/javascript/ImageClassification/ImageClassification/index.html +++ b/javascript/ImageClassification/ImageClassification/index.html @@ -3,13 +3,13 @@
The MobileNet model labeled this as ... with a confidence of ....
- + diff --git a/javascript/ImageClassification/ImageClassification_DoodleNet_Canvas/index.html b/javascript/ImageClassification/ImageClassification_DoodleNet_Canvas/index.html index 14e24d59..946f5acb 100755 --- a/javascript/ImageClassification/ImageClassification_DoodleNet_Canvas/index.html +++ b/javascript/ImageClassification/ImageClassification_DoodleNet_Canvas/index.html @@ -3,7 +3,7 @@4. You could click the "Clear" button to clear the canvas and draw again.
Loading Model... Please wait...
- - + +4. You could click the "Clear" button to clear the canvas and draw again.
Loading Model... Please wait...
- - + +Loading model...
- +image via: Pexels
diff --git a/javascript/PoseNet/PoseNet_part_selection/index.html b/javascript/PoseNet/PoseNet_part_selection/index.html index a7649485..324e6708 100755 --- a/javascript/PoseNet/PoseNet_part_selection/index.html +++ b/javascript/PoseNet/PoseNet_part_selection/index.html @@ -4,7 +4,7 @@sentiment score:
diff --git a/javascript/Sentiment/index.html b/javascript/Sentiment/index.html index 3cd66d9e..9f8420c4 100644 --- a/javascript/Sentiment/index.html +++ b/javascript/Sentiment/index.html @@ -2,7 +2,7 @@- +
diff --git a/javascript/SketchRNN/SketchRNN_basic/index.html b/javascript/SketchRNN/SketchRNN_basic/index.html index 55271be4..2fc2714a 100644 --- a/javascript/SketchRNN/SketchRNN_basic/index.html +++ b/javascript/SketchRNN/SketchRNN_basic/index.html @@ -2,7 +2,7 @@
Loading Models...
Input Image:
- + diff --git a/javascript/StyleTransfer/StyleTransfer_Video/index.html b/javascript/StyleTransfer/StyleTransfer_Video/index.html index 7e20a8b2..616b21c7 100644 --- a/javascript/StyleTransfer/StyleTransfer_Video/index.html +++ b/javascript/StyleTransfer/StyleTransfer_Video/index.html @@ -2,7 +2,7 @@Sytle: Udnie (Young American Girl, The Dance), 1913 - Francis Picabia
Loading model...
- - + +- +
@@ -26,8 +26,8 @@Between - and - + and +
@@ -35,9 +35,9 @@- is to - as - + is to + as +
diff --git a/javascript/YOLO/YOLO_single_image/index.html b/javascript/YOLO/YOLO_single_image/index.html index 64a12a22..1718d040 100644 --- a/javascript/YOLO/YOLO_single_image/index.html +++ b/javascript/YOLO/YOLO_single_image/index.html @@ -5,7 +5,7 @@Loading Model
diff --git a/p5js/CharRNN/CharRNN_Text/index.html b/p5js/CharRNN/CharRNN_Text/index.html index 1502ec6c..9e089128 100644 --- a/p5js/CharRNN/CharRNN_Text/index.html +++ b/p5js/CharRNN/CharRNN_Text/index.html @@ -6,7 +6,7 @@ - + @@ -14,12 +14,12 @@
seed text: - +
length: - 100
+ 100temperature: - 0.5
+ 0.5Loading Model
diff --git a/p5js/CharRNN/CharRNN_Text_Stateful/index.html b/p5js/CharRNN/CharRNN_Text_Stateful/index.html index b611ffa4..0d87365a 100644 --- a/p5js/CharRNN/CharRNN_Text_Stateful/index.html +++ b/p5js/CharRNN/CharRNN_Text_Stateful/index.html @@ -6,7 +6,7 @@ - + @@ -18,10 +18,10 @@Instead of feeding every single character every frame to predict the next character, we feed only the last character, and instruct the CharRNN to remember its internal state.
This example uses a pre-trained model on a corpus of Virginia Woolf
seed text: - +
temperature: - 0.5 + 0.5
Loading Model
diff --git a/p5js/DCGAN/DCGAN_LatentVector_RandomWalk/index.html b/p5js/DCGAN/DCGAN_LatentVector_RandomWalk/index.html index 4d9ac76f..aaa3cf54 100644 --- a/p5js/DCGAN/DCGAN_LatentVector_RandomWalk/index.html +++ b/p5js/DCGAN/DCGAN_LatentVector_RandomWalk/index.html @@ -9,7 +9,7 @@ - + diff --git a/p5js/DCGAN/DCGAN_LatentVector_Slider/index.html b/p5js/DCGAN/DCGAN_LatentVector_Slider/index.html index 4d9ac76f..aaa3cf54 100644 --- a/p5js/DCGAN/DCGAN_LatentVector_Slider/index.html +++ b/p5js/DCGAN/DCGAN_LatentVector_Slider/index.html @@ -9,7 +9,7 @@ - + diff --git a/p5js/DCGAN/DCGAN_Random/index.html b/p5js/DCGAN/DCGAN_Random/index.html index a3ef5139..98a6b312 100644 --- a/p5js/DCGAN/DCGAN_Random/index.html +++ b/p5js/DCGAN/DCGAN_Random/index.html @@ -9,7 +9,7 @@ - + diff --git a/p5js/FaceApi/FaceApi_Image_Landmarks/index.html b/p5js/FaceApi/FaceApi_Image_Landmarks/index.html index b07e6b3e..38b3a701 100644 --- a/p5js/FaceApi/FaceApi_Image_Landmarks/index.html +++ b/p5js/FaceApi/FaceApi_Image_Landmarks/index.html @@ -5,7 +5,7 @@| - +
- Training frequency: + Training frequency:
diff --git a/p5js/NeuralNetwork/NeuralNetwork_multiple-layers/index.html b/p5js/NeuralNetwork/NeuralNetwork_multiple-layers/index.html index 5ef9bcb2..91429d87 100644 --- a/p5js/NeuralNetwork/NeuralNetwork_multiple-layers/index.html +++ b/p5js/NeuralNetwork/NeuralNetwork_multiple-layers/index.html @@ -7,7 +7,7 @@ - +
diff --git a/p5js/NeuralNetwork/NeuralNetwork_musical_face/index.html b/p5js/NeuralNetwork/NeuralNetwork_musical_face/index.html index a21135a9..4ebb72c2 100755 --- a/p5js/NeuralNetwork/NeuralNetwork_musical_face/index.html +++ b/p5js/NeuralNetwork/NeuralNetwork_musical_face/index.html @@ -7,7 +7,7 @@ - + @@ -16,7 +16,7 @@Training frequency: 440 - +
diff --git a/p5js/NeuralNetwork/NeuralNetwork_musical_mouse/index.html b/p5js/NeuralNetwork/NeuralNetwork_musical_mouse/index.html index 88618c38..8f13af41 100755 --- a/p5js/NeuralNetwork/NeuralNetwork_musical_mouse/index.html +++ b/p5js/NeuralNetwork/NeuralNetwork_musical_mouse/index.html @@ -7,7 +7,7 @@ - +
@@ -15,7 +15,7 @@- Training frequency: + Training frequency:
diff --git a/p5js/NeuralNetwork/NeuralNetwork_pose_classifier/index.html b/p5js/NeuralNetwork/NeuralNetwork_pose_classifier/index.html index 402faa1d..5e323e0b 100755 --- a/p5js/NeuralNetwork/NeuralNetwork_pose_classifier/index.html +++ b/p5js/NeuralNetwork/NeuralNetwork_pose_classifier/index.html @@ -6,7 +6,7 @@ - +
diff --git a/p5js/NeuralNetwork/NeuralNetwork_titanic/index.html b/p5js/NeuralNetwork/NeuralNetwork_titanic/index.html index 20f73d99..99143bc7 100644 --- a/p5js/NeuralNetwork/NeuralNetwork_titanic/index.html +++ b/p5js/NeuralNetwork/NeuralNetwork_titanic/index.html @@ -6,7 +6,7 @@ - + @@ -15,10 +15,10 @@
- age:
- fare:
- fare_class:
- sex:
+ age:
+ fare:
+ fare_class:
+ sex:
diff --git a/p5js/NeuralNetwork/NeuralNetwork_xy_classifier/index.html b/p5js/NeuralNetwork/NeuralNetwork_xy_classifier/index.html index 0860717e..e8822d22 100755 --- a/p5js/NeuralNetwork/NeuralNetwork_xy_classifier/index.html +++ b/p5js/NeuralNetwork/NeuralNetwork_xy_classifier/index.html @@ -7,7 +7,7 @@ - +
diff --git a/p5js/PitchDetection/PitchDetection/index.html b/p5js/PitchDetection/PitchDetection/index.html index 532c76ba..7bcdffee 100644 --- a/p5js/PitchDetection/PitchDetection/index.html +++ b/p5js/PitchDetection/PitchDetection/index.html @@ -7,7 +7,7 @@ - + diff --git a/p5js/PitchDetection/PitchDetection_Game/index.html b/p5js/PitchDetection/PitchDetection_Game/index.html index 1f34de95..ed2b6e79 100644 --- a/p5js/PitchDetection/PitchDetection_Game/index.html +++ b/p5js/PitchDetection/PitchDetection_Game/index.html @@ -7,7 +7,7 @@ - + diff --git a/p5js/PitchDetection/PitchDetection_Piano/index.html b/p5js/PitchDetection/PitchDetection_Piano/index.html index 62132525..d2f02b2a 100644 --- a/p5js/PitchDetection/PitchDetection_Piano/index.html +++ b/p5js/PitchDetection/PitchDetection_Piano/index.html @@ -7,7 +7,7 @@ - + diff --git a/p5js/Pix2Pix/Pix2Pix_callback/index.html b/p5js/Pix2Pix/Pix2Pix_callback/index.html index 60813091..4e85720a 100644 --- a/p5js/Pix2Pix/Pix2Pix_callback/index.html +++ b/p5js/Pix2Pix/Pix2Pix_callback/index.html @@ -6,7 +6,7 @@ - + diff --git a/p5js/Pix2Pix/Pix2Pix_promise/index.html b/p5js/Pix2Pix/Pix2Pix_promise/index.html index 35da6008..b4306dd0 100644 --- a/p5js/Pix2Pix/Pix2Pix_promise/index.html +++ b/p5js/Pix2Pix/Pix2Pix_promise/index.html @@ -6,7 +6,7 @@ - + diff --git a/p5js/PoseNet/PoseNet_image_single/index.html b/p5js/PoseNet/PoseNet_image_single/index.html index 952f9ecb..9c761391 100644 --- a/p5js/PoseNet/PoseNet_image_single/index.html +++ b/p5js/PoseNet/PoseNet_image_single/index.html @@ -6,7 +6,7 @@ - + diff --git a/p5js/PoseNet/PoseNet_part_selection/index.html b/p5js/PoseNet/PoseNet_part_selection/index.html index 65cd89ba..6b330e0b 100755 --- a/p5js/PoseNet/PoseNet_part_selection/index.html +++ b/p5js/PoseNet/PoseNet_part_selection/index.html @@ -7,7 +7,7 @@ - + diff --git a/p5js/PoseNet/PoseNet_webcam/index.html b/p5js/PoseNet/PoseNet_webcam/index.html index b4b3b2fa..341cab28 100755 --- a/p5js/PoseNet/PoseNet_webcam/index.html +++ b/p5js/PoseNet/PoseNet_webcam/index.html @@ -6,7 +6,7 @@ - + diff --git a/p5js/Sentiment/Sentiment_Interactive/index.html b/p5js/Sentiment/Sentiment_Interactive/index.html index 3ebab2a2..f2f1e261 100644 --- a/p5js/Sentiment/Sentiment_Interactive/index.html +++ b/p5js/Sentiment/Sentiment_Interactive/index.html @@ -3,7 +3,7 @@Loading Models...
Input Image:
- + diff --git a/p5js/StyleTransfer/StyleTransfer_Video/index.html b/p5js/StyleTransfer/StyleTransfer_Video/index.html index 4377290e..102c0340 100644 --- a/p5js/StyleTransfer/StyleTransfer_Video/index.html +++ b/p5js/StyleTransfer/StyleTransfer_Video/index.html @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@Sytle: Udnie (Young American Girl, The Dance), 1913 - Francis Picabia
Loading model...
- +This is a demonstration of image classification using a model trained with Google's Teachable + Machine project. If you cover the camera, this model will classify the image as "nighttime," otherwise will classify + anything else as "daytime."
+ + + + \ No newline at end of file diff --git a/p5js/TeachableMachine/ImageModel_TM/sketch.js b/p5js/TeachableMachine/ImageModel_TM/sketch.js new file mode 100644 index 00000000..c4f2cff1 --- /dev/null +++ b/p5js/TeachableMachine/ImageModel_TM/sketch.js @@ -0,0 +1,70 @@ +// Copyright (c) 2019 ml5 +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +/* === +ml5 Example +Webcam Image Classification using a pre-trained customized model and p5.js +This example uses p5 preload function to create the classifier +=== */ + +// Classifier Variable +let classifier; +// Model URL +let imageModelURL = 'https://storage.googleapis.com/teachable-machine-pubilshed-models/fa542ec0-b94b-4aa9-add4-c256963b0720/model.json'; + +// Video +let video; +let flippedVideo; +// To store the classification +let label = ""; + +// Load the model first +function preload() { + classifier = ml5.imageClassifier(imageModelURL); +} + +function setup() { + createCanvas(320, 260); + // Create the video + video = createCapture(VIDEO); + video.size(320, 240); + video.hide(); + + flippedVideo = ml5.flipImage(video) + // Start classifying + classifyVideo(); +} + +function draw() { + background(0); + // Draw the video + image(flippedVideo, 0, 0); + + // Draw the label + fill(255); + textSize(16); + textAlign(CENTER); + text(label, width / 2, height - 4); +} + +// Get a prediction for the current video frame +function classifyVideo() { + flippedVideo = ml5.flipImage(video) + classifier.classify(flippedVideo, gotResult); +} + +// When we get a result +function gotResult(error, results) { + // If there is an error + if (error) { + console.error(error); + return; + } + // The results are in an array ordered by confidence. + // console.log(results[0]); + label = results[0].label; + // Classifiy again! + classifyVideo(); +} \ No newline at end of file diff --git a/p5js/TeachableMachine/SoundModel_TM/index.html b/p5js/TeachableMachine/SoundModel_TM/index.html new file mode 100644 index 00000000..636443ad --- /dev/null +++ b/p5js/TeachableMachine/SoundModel_TM/index.html @@ -0,0 +1,19 @@ + + + + +This is a demonstration of sound classification using a model trained with Google's Teachable Machine project. If + you clap, this model will classify the sound as "clap." (Until a clap is detected the canvas displays "listening.") +
+ + + + \ No newline at end of file diff --git a/p5js/TeachableMachine/SoundModel_TM/sketch.js b/p5js/TeachableMachine/SoundModel_TM/sketch.js new file mode 100644 index 00000000..50a365c5 --- /dev/null +++ b/p5js/TeachableMachine/SoundModel_TM/sketch.js @@ -0,0 +1,53 @@ +// Copyright (c) 2019 ml5 +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +/* === +ml5 Example +Webcam Image Classification using a pre-trained customized model and p5.js +This example uses p5 preload function to create the classifier +=== */ + +// Global variable to store the classifier +let classifier; + +// Label (start by showing listening) +let label = "listening"; + +// Teachable Machine model URL: +let soundModelURL = 'https://storage.googleapis.com/tm-speech-commands/eye-test-sound-yining/model.json'; + + +function preload() { + // Load the model + classifier = ml5.soundClassifier(soundModelURL); +} + +function setup() { + createCanvas(320, 240); + // Start classifying + // The sound model will continuously listen to the microphone + classifier.classify(gotResult); +} + +function draw() { + background(0); + // Draw the label in the canvas + fill(255); + textSize(32); + textAlign(CENTER, CENTER); + text(label, width / 2, height / 2); +} + + +// The model recognizing a sound will trigger this event +function gotResult(error, results) { + if (error) { + console.error(error); + return; + } + // The results are in an array ordered by confidence. + // console.log(results[0]); + label = results[0].label; +} \ No newline at end of file diff --git a/p5js/UNET/UNET_webcam/index.html b/p5js/UNET/UNET_webcam/index.html index 60218500..6456650e 100755 --- a/p5js/UNET/UNET_webcam/index.html +++ b/p5js/UNET/UNET_webcam/index.html @@ -4,7 +4,7 @@- +
@@ -29,8 +29,8 @@Between - and - + and +
@@ -38,9 +38,9 @@- is to - as - + is to + as +
diff --git a/p5js/YOLO/YOLO_single_image/index.html b/p5js/YOLO/YOLO_single_image/index.html index 6d7d1f35..6d37271f 100644 --- a/p5js/YOLO/YOLO_single_image/index.html +++ b/p5js/YOLO/YOLO_single_image/index.html @@ -9,7 +9,7 @@ - + diff --git a/p5js/YOLO/YOLO_webcam/index.html b/p5js/YOLO/YOLO_webcam/index.html index ef10804a..c246ca61 100644 --- a/p5js/YOLO/YOLO_webcam/index.html +++ b/p5js/YOLO/YOLO_webcam/index.html @@ -7,7 +7,7 @@ - + diff --git a/package.json b/package.json index 82cde6a0..7f9d1b39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ml5-examples", - "version": "0.4.0", + "version": "0.4.1", "description": "ml5-examples repo", "main": "index.js", "scripts": { @@ -8,7 +8,8 @@ "test": "echo \"Error: no test specified\" && exit 1", "update:ml5": "node scripts/update-ml5-reference.js", "update:ml5-dev": "NODE_ENV=dev node scripts/update-ml5-reference.js", - "create:example-index": "node scripts/create-examples-index.js" + "create:example-index": "node scripts/create-examples-index.js", + "merge:release:ours": "git merge --strategy-option ours release" }, "repository": { "type": "git", diff --git a/public/index.html b/public/index.html index 7929ddda..1d010f81 100644 --- a/public/index.html +++ b/public/index.html @@ -8,13 +8,13 @@ > - +Index page for ml5 examples.
-