test_main.cpp

来自「gmm test... gmm test... gmm test」· C++ 代码 · 共 72 行

CPP
72
字号
#include "GMM.h"


/*
1.mfcc 18,880
2.mfcc 19,600
3.mfcc 13,680
4.mfcc 25,120
5.mfcc 22,000
*/




void main()
{
	/*
	int size = 18880/sizeof(float);
	int dimension = 20;
	
	float *tempfeature = new float[size];
	
	FILE *fp = fopen("testfiles\\1.mfcc", "rb");
	if(fp == NULL)
		return;
	fread(tempfeature, sizeof(float), size, fp);
	
	CGMM model;
	model.InitializeGMM(1, 20, "烙矫");
	model.Training(tempfeature, size, 10);
	for(int i = 0; i < 10; i++)
		cout << model.ViewLog(i) << endl;

	model.SaveGMM("temp.txt", true);

	model.SetName("衬窍窍");

	model.LoadGMM("烙矫", "temp.txt");

	cout << model.GetName();

	
	
	cout << "泪矫 绒侥!";
	double tempsum = 0;
	float *ttttt = tempfeature;
	for(int i = 0; i < size/dimension; i++, ttttt+=dimension)
	{
		tempsum += log(model.GetProbability(ttttt));
	}
	tempsum /= (size/dimension);

	cout << tempsum << endl;
*/

	CGMM model[10];
	int i = 0;
	CGMM::LoadGMM(model[i++], "temp.txt");
	while(CGMM::LoadGMM(model[i]) == 0)
		i++;

	model[4] = model[3];
	for(int i = 0; i < 5; i++)
	{
		cout << model[i].GetName().c_str() << endl;
		model[i].SaveGMM("temp2.txt", i);
	}
}



⌨️ 快捷键说明

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