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


C++ CStopWatch::CheckTime方法代码示例

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


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

示例1: ClassifySTL

// ------------------------------------------------------------------------------------------
// Classify STL Test Image Set and save each file separated class into Image/class no. folder
// 
void ClassifySTL()
{
	CImageObject debugImage;
	//debugImage.CreateReshape(serialized, rt.Width(), rt.Height(), 3);	
	//m_ImageDebugDlg.DrawImage(debugImage);

#if 1
	
	CMatLoader inputImages("trainImages2000");
	CMatLoader inputLabels("trainLabels2000");
	CMatLoader pooledFeatures("pooledFeaturesTrain2000");
	CMatLoader softmaxOptTheta("softmaxOptTheta2000");
#else
	CMatLoader inputImages("testImages");
	CMatLoader inputLabels("testLabels");
	// 3600 x m	
	CMatLoader pooledFeatures("pooledFeaturesTest");	
	CMatLoader softmaxOptTheta("softmaxOptTheta2000");
#endif

	// 4 x 3600
	

	vector <BYTE *> vecImages;
	SerializeSTLImage(inputImages, vecImages);

	// CMatLoader testImages("testImages");

	CStopWatch w;
	vector <short> vecLabel;
	vector <float> vecConfidence;
	
	ClassifySoftmaxRegression(pooledFeatures, softmaxOptTheta, vecLabel, vecConfidence);

	int count = 0;
	int i;
	//CLog log("result2.csv", true);
	for (i=0;i<(int)vecLabel.size();i++)
	{
		if (vecLabel[i] == (int)inputLabels.data[i])
			count++;
		//log.WriteLog("%d, %d, %d\n", vecLabel[i] , (int)inputLabels.data[i], vecLabel[i] - (int)inputLabels.data[i]);
	}

	
	printf("Classification finished     accuracy : %f %%\n", (float)count / (float)vecLabel.size() * 100.0f);
	printf("Elapsed time %.0f msec\n", w.CheckTime());

	mkdir("ResultImage");
	mkdir("ResultImage\\1");
	mkdir("ResultImage\\2");
	mkdir("ResultImage\\3");
	mkdir("ResultImage\\4");
	mkdir("ResultImage\\5");
	if (1)
	{
		for (i=0;i<(int)vecImages.size();i++)
			//for (i=0;i<100;i++)
		{
			debugImage.CreateReshape(vecImages[i], 64, 64, 3);
			CString str;
			str.Format("ResultImage\\%d\\%d.bmp", vecLabel[i],i);
			debugImage.SaveToBMP(str.GetBuffer(0));
			
		}
		// Classification(pooledFeaturesTest, softmaxOptTheta, vecLabel);
	}
	printf("%d classified images are saved into ResultImage/classNo directory\n",(int)vecImages.size());

	for (i = 0;i<(int)vecImages.size();i++)
		delete [] vecImages[i];

	return;

} 
开发者ID:gnoses,项目名称:CNNObjectDetection,代码行数:78,代码来源:GnosesConvNetConsole.cpp

示例2: ClassifyIntegralFeature


//.........这里部分代码省略.........
						{
							meanFeature.data[featureIndex++] = (features[i].GetBlockMeanByIntegralImage(col + (col2 * k), row + (row2 * k), k, k));
							//if (col == 95 && row == 0)
							//	log.WriteLog("%f\n", meanFeature.data[i]);
						}
					}
					
				}
				//log.WriteLog("\n");
				//ClassifySoftmaxRegressionSingle(meanFeature, softmaxOptTheta, vecLabel, vecConfidence);
				//if (vecLabel[0] == 5 ) continue;
				CRectEx rt;
				rt.SetRect(0,0,k*3+8,k*3+8);
				rt.Offset(col,row);

				//m_OvrDisp.DrawRect(rt,color[vecLabel[0]], 10,"%s(%d)",className[vecLabel[0]], vecLabel[0]);
				//log.WriteLog("%s,%d, %.1f, %.1f, %.1f, %.1f,%.1f,",className[vecLabel[0]], vecLabel[0], vecConfidence[0],vecConfidence[1],vecConfidence[2],vecConfidence[3], vecConfidence[4]);

				ClassifySoftmaxRegressionSingle(meanFeature, softmaxOptTheta5320, vecLabel, vecConfidence);
				if (k==start)
					vecCandidateLabel.push_back(vecLabel[0]-1);
				else if (vecLabel[0] == candidate)
				{
					//m_OvrDisp.DrawRect(rt,color[vecLabel[0]], 10,"%s(%d) %.1f %.1f %.1f %.1f",className[vecLabel[0]], vecLabel[0], vecConfidence[0]);
					//vecRect.push_back(rt);
					rtFinal = rt;
					found = TRUE;
				}

				log.WriteLog(",%s,%d,%.1f, %.1f, %.1f, %.1f\n",className[vecLabel[0]], vecLabel[0], vecConfidence[0],vecConfidence[1],vecConfidence[2],vecConfidence[3]);
				if (vecLabel[0] != 5 && vecConfidence[0] > 0.99)		
				{					
					//ClassifySoftmaxRegression(meanFeature, softmaxOptTheta100percentTraining, vecLabel, vecConfidence);
				//	m_OvrDisp.DrawRect(rt,color[vecLabel[0]], 10,"%s(%d) %.1f %.1f %.1f %.1f",className[vecLabel[0]], vecLabel[0], vecConfidence[0]);
				//	goto FINISH;
				}
				else
				{
					//m_OvrDisp.DrawRect(rt,color[vecLabel[0]], 10,"%s(%d) %f",className[vecLabel[0]], vecLabel[0], vecConfidence[0]);
				}


				//m_OvrDisp.DrawRect(rt,MCYAN);
				//log.WriteLog("%d,%f\n",vecLabel[0],vecConfidence[0]);
				
			}
		}

		if (k == start)
		{
			vector <int> histo;
			histo.resize(4);
			for (int l=0;l<(int)vecCandidateLabel.size();l++)
				histo[vecCandidateLabel[l]]++;

			candidate = distance(histo.begin(), max_element(histo.begin(), histo.end())) + 1;
			rtCadidate.SetRect(0,0,k*3+8,k*3+8);
			//rtCadidate.Offset(col,row);
		}
		
	}

	if (found == FALSE)
		printf("%d, %d, %d %d = %s\n", rtCadidate.left,rtCadidate.top,rtCadidate.right,rtCadidate.bottom, className[candidate]);
	else
		printf("%d, %d, %d %d = %s\n", rtCadidate.left,rtFinal.top,rtFinal.right,rtFinal.bottom, className[candidate]);

	printf("Elapsed time in %.0f msec (%d x %d image)\n", w.CheckTime(),m_Image.Width(), m_Image.Height());

	/*for (row = 0;row <= rowSize-3;row+=step)
		//for (row = 0;row < 1;row++)
	{
		for (col = 0;col <= colSize-3;col+=step)
			//for (col = 0;col < 1;col++)
		{
			//w.StartTime();
			//double error = ClassifyMeans(pooledFeaturesLarge,row, col,3,3, meanFeature, vecLabel);
			//if (vecLabel[0] == 0 ) continue;
			ClassifySoftmaxRegression(convolvedFeatures,row, col,3,3, softmaxOptTheta, vecLabel, vecConfidence);
			//if (vecLabel[0] == 5) continue;
			//if (vecConfidence[0] < thr) continue;

			//m_OvrDisp.DrawText(10 + (row *10),10, MGREEN, 20, "%.0f msec", w.CheckTime());

			CRectEx rt;
			rt.SetRect(0,0,63,63);
			rt.Offset(int((float)col / 3.0f * 64.0f),int((float)row / 3.0f * 64.0f));

			m_OvrDisp.DrawRect(rt,color[vecLabel[0]], 10,"%s(%d) %f",className[vecLabel[0]], vecLabel[0], vecConfidence[0]);
			//m_OvrDisp.DrawText(rt.CenterPoint().x,rt.CenterPoint().y,MGREEN, 10,"%s",className[vecLabel[0]]);
			//m_OvrDisp.DrawRect(rt,MRED, 10,"%d,%d,%d,%d",vecLabel[0], vecLabel[1],vecLabel[2],vecLabel[3]);
			//m_OvrDisp.DrawRect(rt,MRED);
		}
	}*/

	//m_OvrDisp.DrawText(10,10, MCYAN, 15, "%d x %d %.0f msec", m_Image.Width(), m_Image.Height(),w.CheckTime());
	delete [] features;
	return;

} 
开发者ID:gnoses,项目名称:CNNObjectDetection,代码行数:101,代码来源:GnosesConvNetConsole.cpp


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