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