当前位置: 首页>>代码示例>>C++>>正文


C++ Observations::addEvent方法代码示例

本文整理汇总了C++中Observations::addEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ Observations::addEvent方法的具体用法?C++ Observations::addEvent怎么用?C++ Observations::addEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Observations的用法示例。


在下文中一共展示了Observations::addEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
			// 	printf("Unknown scaleType %d\n", scaleType);
			// 	return 0;
			// }
			// currentFrames.push_back(tempMat);
			// currentFramenums.push_back(curFrame);

		}
		// printf("joining\n");
		for(int j = 0; j < i; j++)
			thr[j].join();
		// printf("done joining\n");
		if( i < batchSize )
			currentFrames.resize(i);

		// for(int i = 0; i < currentFramenums.size(); i++)
		// {
		// 	printf("%d ", currentFramenums[i]);
		// }
		// printf("\n");

		//run them through CNN and store results
		net.setData(currentFrames);
		net.run();
		net.getCalculatedClasses(calcClasses);
		net.getConfidences(curConfidences);

		for(int i = 0; i < currentFramenums.size(); i++)
			doneFrames.push_back(DoneFrame(currentFramenums[i],calcClasses[i], curConfidences[i]));

	}

	//now everything has been run through the cnn and we need to generate Observations
	Observations obs;

	//in theory, doneFrames should be in order by frame number
	for(int i = 0; i < doneFrames.size();)
	{
		int curClassIndex = doneFrames[i].classIndex;
		int startFrame = doneFrames[i].framenum;
		i++;
		while(i < doneFrames.size() && doneFrames[i].classIndex == curClassIndex)
			i++;
		int endFrame = doneFrames[i-1].framenum;

		int curStartTime = video_start_time + startFrame / fps;
		int curEndTime   = video_start_time + endFrame / fps;

		obs.addEvent(net.getNameForIndex(curClassIndex), curStartTime, curEndTime);
	}

	/*
	Fields in database
		id: int(11) autoincrement id for cnn_observations
		event_type: enum(...)
		cnn: cnn_id???
		start_time: time (hh:mm:ss)
		video_id: int(11)
		end_time: time (hh:mm:ss)
	*/

	/* 
	Format output file

	cnn:string //assimilator will turn into cnn_id
	video_name:string //assimilator will turn into video_id
	EVENT
	EVENT
	EVENT

	where EVENT is from Event::toString 
	*/

	//list of calculated events with no smoothing / signal processing / etc.
	ofstream outfile(getBoincFilename("results.txt"));
	outfile << cnn_config_id << endl;
	outfile << video_id << endl;
	outfile << obs.toString();
	outfile.close();

	//same format as checkpoint file
	ofstream rawout(getBoincFilename("raw_results.txt"));
	rawout << curFrame << endl;
	rawout << doneFrames.size() << endl;
	rawout << doneFrames[0].confidences.size() << endl;
	for(size_t i = 0; i < doneFrames.size(); i++)
	{
		rawout << doneFrames[i].framenum << " " << doneFrames[i].classIndex;
		for(int j = 0; j < doneFrames[i].confidences.size(); j++)
			rawout << " " << doneFrames[i].confidences[j];
		rawout << endl;
	}
	rawout.close();


	#ifdef _BOINC_APP_
	boinc_finish(0);
	#endif

	return 0;
}
开发者ID:Connor-Bowley,项目名称:neuralNetwork,代码行数:101,代码来源:ConvNetSeamRun_BOINC.cpp


注:本文中的Observations::addEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。