main.cpp 1019 Bytes
#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;
}