⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trsetmerger.cpp

📁 基于VC开发的神经网络工具箱
💻 CPP
字号:
/*
	Given two Annie Training Sets, merges them together
	(IO pairs of one appended to the other).
	Requires that the training set files be in binary format.
	If not, then use txt2bin to convert them.
*/
#include <annie.h>
#include <iostream>
#include <string>

using namespace std;
using namespace annie;

void printUsage(char *progname);

void main(int argc, char *argv[])
{
	string in1,in2,outfile;
	cout<<"First  training set (binary file) : "; cin>>in1;
	cout<<"Second training set (binary file) : "; cin>>in2;
	cout<<"Merged training set (binary file) : "; cin>>outfile;

	try
	{
		TrainingSet T1(in1.c_str(),annie::BINARY_FILE);
		cout<<"Read "<<in1<<" - "<<T1.getSize()<<endl;
		TrainingSet T2(in2.c_str(),annie::BINARY_FILE);
		cout<<"Read "<<in2<<" - "<<T2.getSize()<<endl;

		if (T1.getInputSize() != T2.getInputSize() || T1.getOutputSize() != T2.getOutputSize())
		{
			cout<<"Input/output counts don't match\nAbort\n";
			exit(-1);
		}
		
		cout<<"Merging....";
		T2.initialize();

		annie::VECTOR in,out;
		while (!T2.epochOver())
		{
			T2.getNextPair(in,out);
			T1.addIOpair(in,out);
		}
		T1.save(outfile.c_str(),annie::BINARY_FILE);
		cout<<"Saved into "<<outfile<<", "<<T1.getSize()<<" IO pairs"<<endl;
	}
	catch (Exception &e)
	{
		cerr<<e.what()<<endl;
		exit(-1);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -