Эх сурвалжийг харах

*** empty log message ***

froehlich 15 жил өмнө
parent
commit
343811d277

+ 6 - 2
classifier/FPCnone.cpp

@@ -30,7 +30,7 @@ ClassificationResult FPCnone::classify ( Example & pce )
 	
 	
 	double sum  = 0.0;
 	double sum  = 0.0;
 		
 		
-	for(int i = 0; i < maxClassNo; i++)
+	for(int i = 0; i < maxClassNo+1; i++)
 	{
 	{
 		overall_distribution[i] = (*pce.vec)[i];
 		overall_distribution[i] = (*pce.vec)[i];
 		
 		
@@ -48,7 +48,11 @@ ClassificationResult FPCnone::classify ( Example & pce )
 		overall_distribution[i] /= sum;
 		overall_distribution[i] /= sum;
 	}*/
 	}*/
 	
 	
-	cout << "Klasse: " << classno << " prob: " << overall_distribution[classno] << endl;
+	//cout << "Klasse: " << classno << " prob: " << overall_distribution[classno] << endl;
+	if(classno > 12)
+	{
+		cout << "failure" << endl;
+	}
 
 
 	return ClassificationResult ( classno, overall_distribution );
 	return ClassificationResult ( classno, overall_distribution );
 }
 }

+ 13 - 38
progs/test.cpp

@@ -26,47 +26,22 @@ using namespace OBJREC;
 int main(int argc, char **argv)
 int main(int argc, char **argv)
 {
 {
 	
 	
-	//popen test
-	string fn = "/tmp/img.ppm";
-	std::string call = "ls *";
-	const int buffersize = 65536;
-	char *buffer = new char [buffersize];
+	Image tmp(101,195);
+	tmp.set(0);
+	string infile = "/home/froehlich/Desktop/wichtiges/coind/out.txt";
+	ifstream in(infile.c_str());
 	
 	
-	FILE *f = popen ( call.c_str(), "r" );
-
-	cout << call << endl;
-	
-	if ( f == NULL )
-	{
-		fprintf (stderr, "FATAL ERROR, unable to run program\n");
-		return -1;
-	}
-	
-	while ( ! feof(f) ) 
+	while(!in.eof())
 	{
 	{
-		if ( fgets ( buffer, buffersize, f ) <= 0 )
-		{
-			break;
-		} else {
-			fprintf (stderr, "%s", buffer );
-		}
+		int x,y,v;
+		in >> x;
+		in >> y;
+		in >> v;
+		if(v == 0)
+			v = 1;
+		tmp.setPixel(x,y,v);
 	}
 	}
-	pclose(f);
-
-	//openMP test
-#pragma omp parallel for
-	for(int i = 0; i < 3; i++)
-	{
-		cout << i << endl;
-	}
-	
-	Config * conf = new Config();
-	RegionSegmentationMethod *tmprsm = new RSMeanShift(conf);
-	RSCache rsm( conf, tmprsm );
-	Image cimg(fn);
-	Matrix mask;
-	Globals::setCurrentImgFN ( fn );
-	rsm.segRegions (cimg, mask);
+	tmp.write("/home/froehlich/Desktop/wichtiges/coind/out.pgm");
 	
 	
 	
 	
 	return 0;
 	return 0;

+ 6 - 6
progs/testRF.cpp

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file testRF.cpp
 * @file testRF.cpp
 * @brief test random forest implementation
 * @brief test random forest implementation
 * @author Björn Fröhlich
 * @author Björn Fröhlich
@@ -24,15 +24,15 @@ int main (int argc, char **argv)
 		cerr << "Bitte Datei angeben" << endl;
 		cerr << "Bitte Datei angeben" << endl;
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	string filename;
 	string filename;
 	filename += argv[1];
 	filename += argv[1];
 	cout << "file: " << filename << endl;
 	cout << "file: " << filename << endl;
-	
+
 	Config *conf = new Config();
 	Config *conf = new Config();
-	
+
 	FeaturePoolClassifier *fpcrfCs = new FPCRandomForests(conf, "CsurkaForest");
 	FeaturePoolClassifier *fpcrfCs = new FPCRandomForests(conf, "CsurkaForest");
-	
+
 	//Vector *vec = new Vector(384);
 	//Vector *vec = new Vector(384);
 	//Example ex(vec);
 	//Example ex(vec);
 
 
@@ -40,7 +40,7 @@ int main (int argc, char **argv)
 	fpcrfCs->read(filename);
 	fpcrfCs->read(filename);
 	/*
 	/*
 	ClassificationResult r;
 	ClassificationResult r;
-			
+
 	if(fpcrfCs != NULL)
 	if(fpcrfCs != NULL)
 	{
 	{
 		r = fpcrfCs->classify ( ex );
 		r = fpcrfCs->classify ( ex );

+ 5 - 0
progs/testSemanticSegmentation.cpp

@@ -109,6 +109,7 @@ int main(int argc, char **argv)
 
 
 	LOOP_ALL_S(*testFiles)
 	LOOP_ALL_S(*testFiles)
 	{
 	{
+		cout << 1 << endl;
 		EACH_INFO(classno, info);
 		EACH_INFO(classno, info);
 		pb.update(testFiles->count());
 		pb.update(testFiles->count());
 
 
@@ -146,6 +147,7 @@ int main(int argc, char **argv)
 
 
 		if (write_results_pascal)
 		if (write_results_pascal)
 		{
 		{
+
 			NICE::Image pascal_lm(lm.width(), lm.height());
 			NICE::Image pascal_lm(lm.width(), lm.height());
 			int backgroundClass = classNames.getBackgroundClass();
 			int backgroundClass = classNames.getBackgroundClass();
 
 
@@ -173,7 +175,9 @@ int main(int argc, char **argv)
 			NICE::ColorImage orig(file);
 			NICE::ColorImage orig(file);
 			NICE::ColorImage rgb;
 			NICE::ColorImage rgb;
 			NICE::ColorImage rgb_gt;
 			NICE::ColorImage rgb_gt;
+
 			classNames.labelToRGB(lm, rgb);
 			classNames.labelToRGB(lm, rgb);
+
 			classNames.labelToRGB(lm_gt, rgb_gt);
 			classNames.labelToRGB(lm_gt, rgb_gt);
 
 
 			if (write_results)
 			if (write_results)
@@ -203,6 +207,7 @@ int main(int argc, char **argv)
 
 
 		cerr << M << endl;
 		cerr << M << endl;
 		fileno++;
 		fileno++;
+		cout << 7 << endl;
 	}
 	}
 
 
 	pb.hide();
 	pb.hide();