#pragma once
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cv.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <chrono>

#include "avansvisionlib20.h" // versie 2.0 (!)

class NeuralNetwork
{
public:
	NeuralNetwork();
	~NeuralNetwork();
	Mat Train(Mat& in, Mat& out);
	void Predict(Mat& ITset, string& name);
	void Read();
	void getClass(const string& name, Mat& ref);
private:
	Mat V0, W0;
	const int MAXRUNS = 30000;
	const double MAX_OUTPUT_ERROR = 1E-11;
	void write();
	void load();

	const int numclasses = 10;
	map<int, string> classes;
	int classidx = 0;
	void save_class(const string& name, Mat& ref);
	void class_mat(int index, Mat& ref);
	void mat_class(Mat& ref, string& name);

	chrono::milliseconds timestamp();
};