Skip to content

Commit d065036

Browse files
committed
2022/04/15-08:16:58 (Linux cray unknown)
0 parents  commit d065036

34 files changed

+3718
-0
lines changed

data/A.png

445 Bytes
Loading

data/B.png

417 Bytes
Loading

data/C.png

419 Bytes
Loading

data/D.png

390 Bytes
Loading

data/E.png

253 Bytes
Loading

data/F.png

247 Bytes
Loading

data/G.png

430 Bytes
Loading

data/H.png

248 Bytes
Loading

data/I.png

235 Bytes
Loading

data/J.png

303 Bytes
Loading

data/character.xcf

1.23 KB
Binary file not shown.

data/polar/A_polar.png

3.19 KB
Loading

data/polar/B_polar.png

3.64 KB
Loading

data/tabletolisp.pl

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#! /usr/bin/perl -w
2+
3+
use strict;
4+
5+
print("(\n");
6+
7+
while(<STDIN>) {
8+
chop;
9+
my @line = split(/[\t ]/, $_);
10+
my $n = $#line;
11+
print("(#(");
12+
for(my $i = 1; $i < $n; $i++) {
13+
print(" $line[$i]");
14+
}
15+
# print(") #(1 -1))\n") if $line[$n] == 1;
16+
# print(") #(-1 1))\n") if $line[$n] == 0;
17+
18+
print(") #(1 -1 -1 -1 -1 -1 -1 -1 -1 -1))\n") if $line[$n] == 0;
19+
print(") #(-1 1 -1 -1 -1 -1 -1 -1 -1 -1))\n") if $line[$n] == 1;
20+
print(") #(-1 -1 1 -1 -1 -1 -1 -1 -1 -1))\n") if $line[$n] == 2;
21+
print(") #(-1 -1 -1 1 -1 -1 -1 -1 -1 -1))\n") if $line[$n] == 3;
22+
print(") #(-1 -1 -1 -1 1 -1 -1 -1 -1 -1))\n") if $line[$n] == 4;
23+
print(") #(-1 -1 -1 -1 -1 1 -1 -1 -1 -1))\n") if $line[$n] == 5;
24+
print(") #(-1 -1 -1 -1 -1 -1 1 -1 -1 -1))\n") if $line[$n] == 6;
25+
print(") #(-1 -1 -1 -1 -1 -1 -1 1 -1 -1))\n") if $line[$n] == 7;
26+
print(") #(-1 -1 -1 -1 -1 -1 -1 -1 1 -1))\n") if $line[$n] == 8;
27+
print(") #(-1 -1 -1 -1 -1 -1 -1 -1 -1 1))\n") if $line[$n] == 9;
28+
}
29+
30+
print(")\n");

data/tabletom.pl

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /usr/bin/perl -w
2+
3+
use strict;
4+
5+
print("{\n");
6+
while(<>) {
7+
chop;
8+
my @line = split(/[\t ]/, $_);
9+
my $n = $#line;
10+
print("{{");
11+
for(my $i = 1; $i < $n-1; $i++) {
12+
print("$line[$i],");
13+
}
14+
print("$line[$n-1]");
15+
16+
print("},{ 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},\n") if $line[$n] == 0;
17+
print("},{-1, 1, -1, -1, -1, -1, -1, -1, -1, -1}},\n") if $line[$n] == 1;
18+
print("},{-1, -1, 1, -1, -1, -1, -1, -1, -1, -1}},\n") if $line[$n] == 2;
19+
print("},{-1, -1, -1, 1, -1, -1, -1, -1, -1, -1}},\n") if $line[$n] == 3;
20+
print("},{-1, -1, -1, -1, 1, -1, -1, -1, -1, -1}},\n") if $line[$n] == 4;
21+
print("},{-1, -1, -1, -1, -1, 1, -1, -1, -1, -1}},\n") if $line[$n] == 5;
22+
print("},{-1, -1, -1, -1, -1, -1, 1, -1, -1, -1}},\n") if $line[$n] == 6;
23+
print("},{-1, -1, -1, -1, -1, -1, -1, 1, -1, -1}},\n") if $line[$n] == 7;
24+
print("},{-1, -1, -1, -1, -1, -1, -1, -1, 1, -1}},\n") if $line[$n] == 8;
25+
print("},{-1, -1, -1, -1, -1, -1, -1, -1, -1, 1}},\n") if $line[$n] == 9;
26+
27+
}
28+
print("}\n");

data/tabletosvm.pl

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#! /usr/bin/perl -w
2+
3+
use strict;
4+
5+
while(<STDIN>) {
6+
chop;
7+
my @line = split(/[\t ]/, $_);
8+
my $n = $#line;
9+
print("$line[$n]");
10+
for(my $i = 1; $i < $n; $i++) {
11+
print(" $i:$line[$i]");
12+
}
13+
print("\n");
14+
}

data/train/import.pl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /usr/bin/perl -w
2+
3+
use strict;
4+
5+
my $n = 100;
6+
my $path = "..";
7+
8+
opendir(DIR,$path) or die "Couldn't open directory: $!";
9+
10+
while (defined(my $file = readdir(DIR))) {
11+
if ($file =~ /.*.png/) {
12+
for (my $i = 1; $i <= $n; $i++) {
13+
my $out = sprintf("%.3d-$file",$i);
14+
# scale & rotate
15+
if (rand(1) >= 0.5) {
16+
my $s = [1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0]->[int(rand(10))];
17+
my $r = int(rand(360));
18+
print("$i: $file: Rotate ($r) & Scale ($s)\n");
19+
system("convert ".$path."/".$file." -type Grayscale -depth 8 -gravity center -background white -rotate $r -crop 64x64+0+0\! -flatten ".$out."\n");
20+
system("convert ". $out ." -type Grayscale -depth 8 -gravity center -affine $s,0,0,$s -transform -background white -crop 64x64+0+0\! -flatten ".$out."\n");
21+
}
22+
# translate & rotate
23+
else {
24+
my $x = int(rand(30)-15);
25+
my $y = int(rand(30)-15);
26+
my $r = int(rand(360));
27+
print("$i: $file: Rotate ($r) & Translate ($x,$y)\n");
28+
system("convert ".$path."/".$file." -type Grayscale -depth 8 -gravity center -background white -rotate $r -crop 64x64+0+0\! -flatten ".$out."\n");
29+
system("convert ". $out ." -type Grayscale -depth 8 -gravity center -affine 1,0,0,1,$x,$y -transform -background white -crop 64x64+0+0\! -flatten ".$out."\n");
30+
}
31+
}
32+
}
33+
}
34+
closedir(DIR);

data/train2/import.pl

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /usr/bin/perl -w
2+
3+
use strict;
4+
5+
my $n = 1000;
6+
my $path = "..";
7+
8+
opendir(DIR,$path) or die "Couldn't open directory: $!";
9+
10+
while (defined(my $file = readdir(DIR))) {
11+
if ($file =~ /.*.png/) {
12+
for (my $i = 1; $i <= $n; $i++) {
13+
my $out = sprintf("%.3d-$file",$i);
14+
# scale & rotate
15+
if (rand(1) >= 0.5) {
16+
my $s = [1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0]->[int(rand(10))];
17+
my $r = int(rand(360));
18+
print("$i: $file: Rotate ($r) & Scale ($s)\n");
19+
system("convert ".$path."/".$file." -type Grayscale -depth 8 -gravity center -background white -rotate $r -crop 64x64+0+0\! -flatten ".$out."\n");
20+
system("convert ". $out ." -type Grayscale -depth 8 -gravity center -affine $s,0,0,$s -transform -background white -crop 64x64+0+0\! -flatten ".$out."\n");
21+
}
22+
# translate & rotate
23+
else {
24+
my $x = int(rand(30)-15);
25+
my $y = int(rand(30)-15);
26+
my $r = int(rand(360));
27+
print("$i: $file: Rotate ($r) & Translate ($x,$y)\n");
28+
system("convert ".$path."/".$file." -type Grayscale -depth 8 -gravity center -background white -rotate $r -crop 64x64+0+0\! -flatten ".$out."\n");
29+
system("convert ". $out ." -type Grayscale -depth 8 -gravity center -affine 1,0,0,1,$x,$y -transform -background white -crop 64x64+0+0\! -flatten ".$out."\n");
30+
}
31+
}
32+
}
33+
}
34+
closedir(DIR);

data/train2/scale.R

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
t <- read.table("features.txt")
2+
t[1:1024] <- scale(t[1:1024])
3+
write.table(t,"features.scaled.txt", quote = FALSE, sep = '\t', row.names = FALSE, col.names = FALSE)

0 commit comments

Comments
 (0)