From 16f41f4534ca1a57cbe1771348b48aacdb883bf1 Mon Sep 17 00:00:00 2001 From: Davide Morelli Date: Sat, 22 Oct 2005 11:31:18 +0000 Subject: added a tutorial and a little faq svn path=/trunk/externals/ann/; revision=3748 --- examples/ann_mlp-FAQs.txt | 8 +++ examples/tutorial-ann_mlp.pd | 166 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100755 examples/ann_mlp-FAQs.txt create mode 100755 examples/tutorial-ann_mlp.pd diff --git a/examples/ann_mlp-FAQs.txt b/examples/ann_mlp-FAQs.txt new file mode 100755 index 0000000..309c0a6 --- /dev/null +++ b/examples/ann_mlp-FAQs.txt @@ -0,0 +1,8 @@ + +Ch_uzi couldn't create error: +ignore it, this object is needed to add GEM spheres in the second example, you don't need to run ann_mlp + +error: opening file.net +the ann weights file are normal textfiles but they don't seem to be cross-platform. +i made those files under win32 so they should not work on osx (on linux?) + diff --git a/examples/tutorial-ann_mlp.pd b/examples/tutorial-ann_mlp.pd new file mode 100755 index 0000000..4c49715 --- /dev/null +++ b/examples/tutorial-ann_mlp.pd @@ -0,0 +1,166 @@ +#N canvas 297 73 593 517 12; +#X obj 65 379 ann_mlp; +#X text 39 59 input: mouse coord; +#X text 37 76 output: 1 if mouse is in the upper left part of the screen +; +#N canvas 106 171 568 438 step1-creation 0; +#X text 141 13 let's create the ANN; +#X obj 130 354 outlet; +#X msg 132 185 create 2 1; +#X text 59 102 let's assume you have 2 inputs value X and Y and you +want 1 output value that tells 1 when the mouse in in the upper left +part of the screen; +#X text 242 185 send this message; +#X connect 2 0 1 0; +#X restore 128 158 pd step1-creation; +#N canvas 46 38 644 604 step2-train 0; +#X obj 97 530 outlet; +#X msg 44 130 train; +#X text 102 129 first switch to train mode; +#X obj 139 367 pack s f f f; +#N canvas 0 0 462 312 normalized-inputs 0; +#X obj 105 64 r X; +#X obj 173 67 r Y; +#X obj 173 92 / 240; +#X obj 105 91 / 320; +#X obj 104 116 - 1; +#X obj 173 118 - 1; +#X text 221 108 normalize inputs to [-1 \, 1]; +#X obj 104 211 outlet; +#X obj 177 215 outlet; +#X text 144 35 receive X and Y; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 2 0 5 0; +#X connect 3 0 4 0; +#X connect 4 0 7 0; +#X connect 5 0 8 0; +#X restore 127 271 pd normalized-inputs; +#N canvas 0 0 667 316 desired-output 0; +#X obj 383 63 key; +#X obj 383 92 select 97; +#X msg 382 118 1; +#X obj 528 97 select 97; +#X obj 528 68 keyup; +#X msg 527 123 0; +#X obj 183 195 outlet; +#X text 40 21 i send 1 when "a" is pressed \, 0 when released; +#X obj 180 108 r out; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 2 0 6 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 8 0 6 0; +#X restore 239 332 pd desired-output; +#X obj 91 192 tgl 15 0 empty empty train 0 -6 0 8 -258699 -1 -1 0 1 +; +#X text 117 190 <-- toggle to train; +#X text 119 404 everytime the metro bangs you send a training pattern +to ann_mlp; +#X floatatom 247 357 5 0 0 0 - - -; +#X floatatom 287 295 5 0 0 0 - - -; +#X floatatom 148 295 5 0 0 0 - - -; +#X obj 110 328 metro 50; +#X text 53 45 (for this to work you need to give focus to this window +but the gem window must be visible); +#X text 335 293 <-- check mouse position; +#X text 112 213 then move the mouse and press left button when you +are in the upper left part of the screen \, release button when you +are not in the upper left part of the screen; +#X text 293 357 <-- check button pressed/not pressed; +#X obj 124 475 unpack s f f f; +#X obj 145 501 pack f f f; +#X floatatom 296 518 5 0 0 0 mse mse -; +#X text 116 447 go on until mse is low enough (< 0.01); +#X connect 1 0 0 0; +#X connect 3 0 17 0; +#X connect 4 0 3 1; +#X connect 4 0 11 0; +#X connect 4 1 3 2; +#X connect 4 1 10 0; +#X connect 5 0 3 3; +#X connect 5 0 9 0; +#X connect 6 0 12 0; +#X connect 12 0 3 0; +#X connect 17 1 18 0; +#X connect 17 2 18 1; +#X connect 17 3 18 2; +#X connect 18 0 0 0; +#X restore 134 218 pd step2-train; +#N canvas 0 0 462 312 mouseInput 0; +#X obj 41 139 gemwin; +#X msg 44 69 create \, 1; +#X msg 134 71 0 \, destroy; +#X obj 143 120 gemmouse 640 480; +#X obj 143 161 s X; +#X obj 172 161 s Y; +#X obj 54 25 inlet; +#X obj 133 27 inlet; +#X obj 206 162 s out; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 4 0; +#X connect 3 1 5 0; +#X connect 3 2 8 0; +#X connect 6 0 1 0; +#X connect 7 0 2 0; +#X restore 287 443 pd mouseInput; +#X obj 287 423 bng 15 250 50 0 empty empty start_GEM 0 -6 0 8 -262144 +-1 -1; +#X obj 385 424 bng 15 250 50 0 empty empty stop_GEM 0 -6 0 8 -262144 +-1 -1; +#X obj 281 389 loadbang; +#X floatatom 116 414 5 0 0 0 mse - mse; +#N canvas 618 -3 682 470 step3-run 0; +#X obj 64 377 outlet; +#N canvas 0 0 466 316 normalized-inputs 0; +#X obj 105 64 r X; +#X obj 173 67 r Y; +#X obj 173 92 / 240; +#X obj 105 91 / 320; +#X obj 104 116 - 1; +#X obj 173 118 - 1; +#X text 221 108 normalize inputs to [-1 \, 1]; +#X obj 104 211 outlet; +#X obj 177 215 outlet; +#X text 144 35 receive X and Y; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 2 0 5 0; +#X connect 3 0 4 0; +#X connect 4 0 7 0; +#X connect 5 0 8 0; +#X restore 178 167 pd normalized-inputs; +#X obj 97 92 tgl 15 0 empty empty run 0 -6 0 8 -258699 -1 -1 1 1; +#X obj 145 267 pack s f f; +#X msg 50 30 run; +#X text 108 29 first switch to run mode; +#X text 123 90 <-- toggle to run; +#X obj 116 228 metro 50; +#X floatatom 332 196 5 0 0 0 - - -; +#X floatatom 191 193 5 0 0 0 - - -; +#X obj 145 293 unpack s f f; +#X obj 176 321 pack f f; +#X connect 1 0 3 1; +#X connect 1 0 9 0; +#X connect 1 1 3 2; +#X connect 1 1 8 0; +#X connect 2 0 7 0; +#X connect 3 0 10 0; +#X connect 4 0 0 0; +#X connect 7 0 3 0; +#X connect 10 1 11 0; +#X connect 10 2 11 1; +#X connect 11 0 0 0; +#X restore 139 284 pd step3-run; +#X floatatom 64 450 5 0 0 0 - - -; +#X connect 0 0 11 0; +#X connect 0 1 9 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 6 0 5 0; +#X connect 7 0 5 1; +#X connect 8 0 6 0; +#X connect 10 0 0 0; -- cgit v1.2.1