File tree Expand file tree Collapse file tree 5 files changed +8
-8
lines changed
neuralNetwork-color-classifier
soundClassifier-teachable-machine Expand file tree Collapse file tree 5 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ function draw() {
54
54
let a = face . keypoints [ indexA ] ;
55
55
let b = face . keypoints [ indexB ] ;
56
56
let c = face . keypoints [ indexC ] ;
57
- const uvA = { x : uvCoords [ indexA ] [ 0 ] , y : uvCoords [ indexA ] [ 1 ] } ;
58
- const uvB = { x : uvCoords [ indexB ] [ 0 ] , y : uvCoords [ indexB ] [ 1 ] } ;
59
- const uvC = { x : uvCoords [ indexC ] [ 0 ] , y : uvCoords [ indexC ] [ 1 ] } ;
57
+ let uvA = { x : uvCoords [ indexA ] [ 0 ] , y : uvCoords [ indexA ] [ 1 ] } ;
58
+ let uvB = { x : uvCoords [ indexB ] [ 0 ] , y : uvCoords [ indexB ] [ 1 ] } ;
59
+ let uvC = { x : uvCoords [ indexC ] [ 0 ] , y : uvCoords [ indexC ] [ 1 ] } ;
60
60
vertex ( a . x , a . y , uvA . x , uvA . y ) ;
61
61
vertex ( b . x , b . y , uvB . x , uvB . y ) ;
62
62
vertex ( c . x , c . y , uvC . x , uvC . y ) ;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ function setup() {
58
58
classifier . normalizeData ( ) ;
59
59
60
60
// Step 6: train your neural network
61
- const trainingOptions = {
61
+ let trainingOptions = {
62
62
epochs : 32 ,
63
63
batchSize : 12 ,
64
64
} ;
@@ -71,7 +71,7 @@ function finishedTraining() {
71
71
72
72
// Step 8: make a classification
73
73
function classify ( ) {
74
- const input = [ r , g , b ] ;
74
+ let input = [ r , g , b ] ;
75
75
classifier . classify ( input , handleResults ) ;
76
76
}
77
77
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ function setup() {
36
36
} ;
37
37
classifier = ml5 . neuralNetwork ( classifierOptions ) ;
38
38
39
- const modelDetails = {
39
+ let modelDetails = {
40
40
model : "model/model.json" ,
41
41
metadata : "model/model_meta.json" ,
42
42
weights : "model/model.weights.bin" ,
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ class Creature {
69
69
}
70
70
71
71
// Predicting the force to apply
72
- const outputs = this . brain . predictSync ( inputs ) ;
72
+ let outputs = this . brain . predictSync ( inputs ) ;
73
73
let angle = outputs [ 0 ] . value * TWO_PI ;
74
74
let magnitude = outputs [ 1 ] . value ;
75
75
let force = p5 . Vector . fromAngle ( angle ) . setMag ( magnitude ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ let classifier;
14
14
let predictedSound = "" ;
15
15
16
16
// Link to custom Teachable Machine model
17
- const modelJson = "https://teachablemachine.withgoogle.com/models/FvsFiSwHW/" ;
17
+ let modelJson = "https://teachablemachine.withgoogle.com/models/FvsFiSwHW/" ;
18
18
19
19
function preload ( ) {
20
20
// Load Teachable Machine model
You can’t perform that action at this time.
0 commit comments