diff options
author | Davide Morelli <morellid@users.sourceforge.net> | 2005-05-18 15:55:56 +0000 |
---|---|---|
committer | Davide Morelli <morellid@users.sourceforge.net> | 2005-05-18 15:55:56 +0000 |
commit | f42f2bf2238c6b61eec5c238b9bcbd37d5818c00 (patch) | |
tree | d827b0c02d46e54e674711406f54a02543269bbc /examples/ann_td | |
parent | f64944ede13a3f95e9ad3130c74a53833f1a04bf (diff) |
new example for ann_td
svn path=/trunk/externals/ann/; revision=3013
Diffstat (limited to 'examples/ann_td')
-rwxr-xr-x | examples/ann_td/example.pd | 316 | ||||
-rwxr-xr-x | examples/ann_td/tdnn.net | 7 |
2 files changed, 323 insertions, 0 deletions
diff --git a/examples/ann_td/example.pd b/examples/ann_td/example.pd new file mode 100755 index 0000000..29b9b16 --- /dev/null +++ b/examples/ann_td/example.pd @@ -0,0 +1,316 @@ +#N canvas 520 90 539 296 12;
+#N canvas 103 30 724 595 guts 0;
+#X msg 89 147 0 \, destroy;
+#X obj 111 177 gemwin;
+#X msg 94 124 reset \, create \, 1;
+#X obj 331 165 gemhead;
+#X obj 331 186 translateXYZ;
+#X obj 402 118 * -1;
+#X obj 331 206 color 0.5 0 0;
+#X obj 383 66 gemmouse 8 8;
+#X obj 363 109 - 4;
+#X obj 405 99 - 4;
+#X obj 331 226 sphere 0.6;
+#X msg 156 102 cursor 0;
+#X msg 126 66 bang;
+#X msg 166 150 lighting 1;
+#N canvas 463 128 573 394 lights 0;
+#X obj 242 277 world_light;
+#X obj 242 163 gemhead 1;
+#X obj 242 225 rotateXYZ;
+#X msg 109 193 debug 0;
+#X msg 110 224 debug 1;
+#X text 20 169 figure out where the light is;
+#X obj 311 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 354 133 pack f f;
+#X obj 334 159 line;
+#X msg 364 42 1;
+#X obj 364 23 loadbang;
+#X obj 344 298 world_light;
+#X obj 346 271 gemhead 1;
+#X obj 429 203 loadbang;
+#X obj 311 63 metro 20000;
+#X msg 400 104 10000;
+#X obj 119 57 delay 10000;
+#X msg 339 96 300;
+#X msg 292 96 50;
+#X msg 364 235 1 1 1;
+#X msg 422 266 0.6 0.3 0;
+#X connect 1 0 2 0;
+#X connect 2 0 0 0;
+#X connect 3 0 0 0;
+#X connect 4 0 0 0;
+#X connect 6 0 14 0;
+#X connect 7 0 8 0;
+#X connect 8 0 2 2;
+#X connect 9 0 6 0;
+#X connect 10 0 9 0;
+#X connect 10 0 15 0;
+#X connect 12 0 11 0;
+#X connect 13 0 19 0;
+#X connect 13 0 20 0;
+#X connect 14 0 17 0;
+#X connect 14 0 16 0;
+#X connect 15 0 7 1;
+#X connect 16 0 18 0;
+#X connect 17 0 7 0;
+#X connect 18 0 7 0;
+#X connect 19 0 0 1;
+#X connect 20 0 11 1;
+#X restore 543 135 pd lights;
+#X obj 269 139 s posx;
+#X obj 439 152 s posy;
+#X obj 225 25 inlet;
+#X obj 77 19 inlet;
+#X connect 0 0 1 0;
+#X connect 2 0 1 0;
+#X connect 3 0 4 0;
+#X connect 4 0 6 0;
+#X connect 5 0 4 2;
+#X connect 5 0 16 0;
+#X connect 6 0 10 0;
+#X connect 7 0 8 0;
+#X connect 7 1 9 0;
+#X connect 8 0 4 1;
+#X connect 8 0 15 0;
+#X connect 9 0 5 0;
+#X connect 11 0 1 0;
+#X connect 12 0 2 0;
+#X connect 12 0 13 0;
+#X connect 12 0 11 0;
+#X connect 13 0 1 0;
+#X connect 17 0 0 0;
+#X connect 18 0 12 0;
+#X restore 11 150 pd guts;
+#X obj 10 104 tgl 15 0 empty empty rendering 0 -6 0 8 -262144 -1 -1
+1 1;
+#X obj 47 128 bng 15 250 50 0 empty empty destroy_gemwin 0 -6 0 8 -262144
+-1 -1;
+#N canvas 209 7 826 609 train 0;
+#X floatatom 45 391 5 0 0 0 - - -;
+#X floatatom 83 390 5 0 0 0 - - -;
+#X floatatom 120 392 5 0 0 0 - - -;
+#X floatatom 160 394 5 0 0 0 - - -;
+#X obj 190 206 metro 100;
+#X obj 190 187 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 42 430 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
+-1 -1 2512 1;
+#X obj 80 430 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
+-1 -1 0 1;
+#X obj 115 430 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
+-1 -1 0 1;
+#X obj 154 434 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144
+-1 -1 0 1;
+#X text 174 15 1- create the ann;
+#N canvas 503 57 704 411 train 0;
+#X obj 66 319 outlet;
+#X obj 213 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X msg 84 16 train;
+#N canvas 0 0 490 340 outputs 0;
+#X obj 89 60 key;
+#X obj 41 122 sel 97;
+#X text 84 101 "a" key;
+#X obj 218 120 sel 115;
+#N canvas 0 0 458 308 a 0;
+#X obj 130 150 s output1;
+#X obj 86 76 inlet;
+#X text 88 56 bang;
+#X obj 241 80 inlet;
+#X text 243 60 reset;
+#X msg 86 101 1;
+#X msg 241 110 0;
+#X connect 1 0 5 0;
+#X connect 3 0 6 0;
+#X connect 5 0 0 0;
+#X connect 6 0 0 0;
+#X restore 41 145 pd a pressed;
+#N canvas 0 0 458 308 s 0;
+#X obj 86 76 inlet;
+#X text 88 56 bang;
+#X obj 241 80 inlet;
+#X text 243 60 reset;
+#X msg 86 101 1;
+#X msg 241 110 0;
+#X obj 130 150 s output2;
+#X connect 0 0 4 0;
+#X connect 2 0 5 0;
+#X connect 4 0 6 0;
+#X connect 5 0 6 0;
+#X restore 217 142 pd s pressed;
+#X text 295 92 "s" key;
+#X obj 228 57 keyup;
+#X obj 132 123 sel 97;
+#X obj 308 120 sel 115;
+#X floatatom 19 80 5 0 0 0 - - -;
+#X obj 39 183 sel 100;
+#X obj 130 184 sel 100;
+#X obj 216 181 sel 102;
+#X obj 306 181 sel 102;
+#N canvas 0 0 466 316 d 0;
+#X obj 86 76 inlet;
+#X text 88 56 bang;
+#X obj 241 80 inlet;
+#X text 243 60 reset;
+#X msg 86 101 1;
+#X msg 241 110 0;
+#X obj 130 150 s output3;
+#X connect 0 0 4 0;
+#X connect 2 0 5 0;
+#X connect 4 0 6 0;
+#X connect 5 0 6 0;
+#X restore 39 206 pd d pressed;
+#N canvas 0 0 470 320 f 0;
+#X obj 86 76 inlet;
+#X text 88 56 bang;
+#X obj 241 80 inlet;
+#X text 243 60 reset;
+#X msg 86 101 1;
+#X msg 241 110 0;
+#X obj 130 150 s output4;
+#X connect 0 0 4 0;
+#X connect 2 0 5 0;
+#X connect 4 0 6 0;
+#X connect 5 0 6 0;
+#X restore 215 203 pd f pressed;
+#X connect 0 0 1 0;
+#X connect 0 0 3 0;
+#X connect 0 0 10 0;
+#X connect 0 0 11 0;
+#X connect 0 0 13 0;
+#X connect 1 0 4 0;
+#X connect 3 0 5 0;
+#X connect 7 0 8 0;
+#X connect 7 0 9 0;
+#X connect 7 0 12 0;
+#X connect 7 0 14 0;
+#X connect 8 0 4 1;
+#X connect 9 0 5 1;
+#X connect 11 0 15 0;
+#X connect 12 0 15 1;
+#X connect 13 0 16 0;
+#X connect 14 0 16 1;
+#X restore 131 57 pd outputs;
+#X obj 130 87 r output1;
+#X obj 213 86 r output2;
+#X floatatom 130 108 5 0 0 0 - - -;
+#X floatatom 212 108 5 0 0 0 - - -;
+#X floatatom 297 106 5 0 0 0 - - -;
+#X floatatom 378 107 5 0 0 0 - - -;
+#X obj 297 85 r output3;
+#X obj 379 85 r output4;
+#X text 128 14 1- change to training mode;
+#X text 248 49 2- change keys if you want;
+#X text 264 61 defaults are "a" "s" "d" "f";
+#X text 239 182 3- toggle on to start training and off to stop;
+#X msg 170 282 run;
+#X text 200 283 4- switch to run mode when ready;
+#X obj 305 226 inlet;
+#X obj 344 256 nbx 8 14 -1e+037 1e+037 0 0 empty empty MSE 0 -6 0 10
+-262144 -1 -1 0 256;
+#N canvas 111 7 818 550 inputs 0;
+#X obj 107 65 r posx;
+#X obj 166 65 r posy;
+#X obj 68 103 f;
+#X obj 41 46 inlet;
+#X obj 55 300 outlet;
+#X obj 71 138 pack f f;
+#X connect 0 0 2 1;
+#X connect 1 0 5 1;
+#X connect 2 0 5 0;
+#X connect 3 0 2 0;
+#X connect 5 0 4 0;
+#X restore 213 226 pd inputs;
+#N canvas 84 111 802 315 merge 0;
+#X obj 56 34 inlet;
+#X obj 306 38 r output1;
+#X obj 382 38 r output2;
+#X obj 460 39 r output3;
+#X obj 537 39 r output4;
+#X obj 78 184 outlet;
+#X obj 56 73 unpack f f;
+#X obj 79 137 pack f f f f f f;
+#X connect 0 0 6 0;
+#X connect 1 0 7 2;
+#X connect 2 0 7 3;
+#X connect 3 0 7 4;
+#X connect 4 0 7 5;
+#X connect 6 0 7 0;
+#X connect 6 1 7 1;
+#X connect 7 0 5 0;
+#X restore 140 254 pd merge outputs;
+#X obj 213 202 metro 100;
+#X connect 1 0 22 0;
+#X connect 2 0 0 0;
+#X connect 4 0 6 0;
+#X connect 5 0 7 0;
+#X connect 10 0 8 0;
+#X connect 11 0 9 0;
+#X connect 16 0 0 0;
+#X connect 18 0 19 0;
+#X connect 20 0 21 0;
+#X connect 21 0 0 0;
+#X connect 22 0 20 0;
+#X restore 133 114 pd train on the fly;
+#X text 224 182 3- run the nn switching this metro ON;
+#X text 277 213 (note \, you must be in run mode);
+#X msg 281 231 run;
+#X text 364 275 4- when you are happy with you nn save it;
+#X obj 301 404 nbx 8 14 -1e+037 1e+037 0 0 empty empty mse 0 -6 0 10
+-262144 -1 -1 0 256;
+#X text 300 422 mse is usefull while training on-the-fly: tells you
+the global error in the net \, how much net's output differs from desired
+output.;
+#X text 325 115 2- train on the fly in realtime;
+#X obj 64 348 unpack f f f f;
+#X msg 249 279 save tdnn.net;
+#X msg 249 298 load tdnn.net;
+#X text 24 412 still;
+#X text 72 412 left;
+#X text 111 413 right;
+#X text 156 415 na;
+#X obj 66 325 ann_tdnn 2 5 tdnn.net;
+#N canvas 111 7 822 554 inputs 0;
+#X obj 107 65 r posx;
+#X obj 166 65 r posy;
+#X obj 68 103 f;
+#X obj 41 46 inlet;
+#X obj 55 300 outlet;
+#X obj 72 138 pack f f;
+#X connect 0 0 2 1;
+#X connect 1 0 5 1;
+#X connect 2 0 5 0;
+#X connect 3 0 2 0;
+#X connect 5 0 4 0;
+#X restore 156 245 pd inputs;
+#X msg 66 15 create 2 4 5;
+#X text 363 301 remember that you can load it also passing filename
+as the 3rd argument;
+#X connect 0 0 6 0;
+#X connect 1 0 7 0;
+#X connect 2 0 8 0;
+#X connect 3 0 9 0;
+#X connect 4 0 27 0;
+#X connect 5 0 4 0;
+#X connect 11 0 26 0;
+#X connect 14 0 26 0;
+#X connect 19 0 0 0;
+#X connect 19 1 1 0;
+#X connect 19 2 2 0;
+#X connect 19 3 3 0;
+#X connect 20 0 26 0;
+#X connect 21 0 26 0;
+#X connect 26 0 19 0;
+#X connect 26 1 16 0;
+#X connect 26 1 11 0;
+#X connect 27 0 26 0;
+#X connect 28 0 26 0;
+#X restore 9 224 pd train and run nn;
+#X text 94 94 1- start rendering;
+#X text 72 203 2- open the subpatch and follow instructions;
+#X text 15 5 TDNN implementation (Time Delay Neural Network) useful
+for gesture recognition;
+#X connect 1 0 0 0;
+#X connect 2 0 0 1;
diff --git a/examples/ann_td/tdnn.net b/examples/ann_td/tdnn.net new file mode 100755 index 0000000..6c9540d --- /dev/null +++ b/examples/ann_td/tdnn.net @@ -0,0 +1,7 @@ +FANN_FLO_1.1
+3 0.700000 1.000000 0 5 5 5.00000000000000000000e-001 5.00000000000000000000e-001
+11 4 5
+0 0 0 0 0 0 0 0 0 0 0
+11 11 11 0
+4 4 4 4 0
+(0 3.98359465599060060000e+000) (1 -3.46662133932113650000e-001) (2 1.66724932193756100000e+000) (3 -3.35077017545700070000e-001) (4 -5.66196799278259280000e-001) (5 -3.65077793598175050000e-001) (6 -2.26146197319030760000e+000) (7 1.53752446174621580000e-001) (8 -3.91640329360961910000e+000) (9 4.93833124637603760000e-001) (10 -4.37475204467773440000e+000) (0 2.48541951179504390000e+000) (1 2.93741494417190550000e-001) (2 1.34525704383850100000e+000) (3 3.87542009353637700000e-001) (4 2.62434352189302440000e-002) (5 4.33074653148651120000e-001) (6 -9.10757899284362790000e-001) (7 2.65246361494064330000e-001) (8 -2.17471313476562500000e+000) (9 3.53803992271423340000e-001) (10 -7.55431175231933590000e-001) (0 -4.49254703521728520000e+000) (1 -6.78778812289237980000e-002) (2 -2.04198622703552250000e+000) (3 -1.45705610513687130000e-001) (4 1.97579100728034970000e-001) (5 -4.57823067903518680000e-001) (6 2.62115192413330080000e+000) (7 -2.74485975503921510000e-001) (8 4.33024168014526370000e+000) (9 -2.26368784904479980000e-001) (10 -3.94826436042785640000e+000) (11 -1.19106411933898930000e+000) (12 -2.40987926721572880000e-001) (13 -1.45797419548034670000e+000) (14 2.45804578065872190000e-001) (11 6.82796686887741090000e-002) (12 -3.14634591341018680000e-002) (13 1.29793524742126460000e+000) (14 1.30129599571228030000e+000) (11 1.01107788085937500000e+000) (12 4.44010108709335330000e-001) (13 3.43794375658035280000e-001) (14 8.93330514430999760000e-001) (11 1.50074372683870950000e-016) (12 4.71110857886675280000e-017) (13 1.25351783824343270000e-016) (14 1.36875296494823600000e-017)
|