main.cpp
1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include"Layers.hpp"
#include"SimpleConvNet.hpp"
using namespace std;
int main() {
input_dim id = { 3, 32, 32 };
conv_param cp = { 32,32,64, 3,1,1 };
SimpleConvNet SCN(id, cp);
freopen("input.txt", "r", stdin);
vector<Mat> X;
int nx = 1, dim = 3, row = 32, col = 32;
double tmp;
for (int i = 0; i < nx; i++) {
vector<double> rev;
for (int d = 0; d < dim; d++) {
for (int r = 0; r < row; r++) {
for (int c = 0; c < col; c++) {
scanf("%lf", &tmp);
rev.push_back(tmp);
}
}
}
X.push_back(Mat(dim, row, col, rev));
}
freopen("pred.txt", "r", stdin);
nx = 2, dim = 3, row = 32, col = 32;
for (int i = 0; i < nx; i++) {
vector<double> rev;
for (int d = 0; d < dim; d++) {
for (int r = 0; r < row; r++) {
for (int c = 0; c < col; c++) {
scanf("%lf", &tmp);
rev.push_back(tmp);
}
}
}
X.push_back(Mat(dim, row, col, rev));
}
auto x = SCN.predict(X);
auto pred = SCN.argmax(x);
int num = 0, pd;
printf("predict : %d ", pred[0]);
return 0;
}