Browse Source

Some code cleaning.

Joel Janai 2 years ago
parent
commit
b35d55ee8e
3 changed files with 0 additions and 97 deletions
  1. 0 87
      utils/hypothesis.cpp
  2. 0 5
      utils/hypothesis.h
  3. 0 5
      utils/parameter_list.cpp

+ 0 - 87
utils/hypothesis.cpp

@@ -92,20 +92,6 @@ hypothesis* hypothesis::new_complete(int approach) {
92 92
 
93 93
 #define C_X(i) (gsl_vector_get(c_x,(i)))
94 94
 #define C_Y(i) (gsl_vector_get(c_y,(i)))
95
-//#define COV_X(i,j) (gsl_matrix_get(cov_x,(i),(j)))
96
-//#define COV_Y(i,j) (gsl_matrix_get(cov_y,(i),(j)))
97
-
98
-//		{
99
-//			printf("# best fit: Y = %g + %g X + %g X^2\n", C_X(0), C_X(1), C_X(2));
100
-//			printf("# best fit: Y = %g + %g X + %g X^2\n", C_Y(0), C_Y(1), C_Y(2));
101
-//
102
-//			printf("# covariance matrix:\n");
103
-//			printf("[ %+.5e, %+.5e, %+.5e  \n", COV_X(0, 0), COV_X(0, 1), COV_X(0, 2));
104
-//			printf("  %+.5e, %+.5e, %+.5e  \n", COV_X(1, 0), COV_X(1, 1), COV_X(1, 2));
105
-//			printf("  %+.5e, %+.5e, %+.5e ]\n", COV_X(2, 0), COV_X(2, 1), COV_X(2, 2));
106
-//			printf("# chisq = %g\n", chisq_x);
107
-//		}
108
-
109 95
 
110 96
 		// create new hypothesis while replacing the points used to fit!
111 97
 		double *new_flow_y = new double[F];
@@ -148,8 +134,6 @@ hypothesis* hypothesis::new_perturbed(double u_p, double v_p) {
148 134
 	for(int f = 0; f < F; f++) {
149 135
 		float scale = (0.9f / F) * f + 0.1;					// linear scaling
150 136
 
151
-//		perturbed_h->flow_x[f] = flow_x[f] + scale * u_p;
152
-//		perturbed_h->flow_y[f] = flow_y[f] + scale * v_p;
153 137
 		if(flow_x[f] > 0)
154 138
 			perturbed_h->flow_x[f] = flow_x[f] + scale * u_p;
155 139
 		else
@@ -300,77 +284,6 @@ double hypothesis::distance(hypothesis& h, int method) {
300 284
 	return sum;
301 285
 }
302 286
 
303
-//int hypothesis::compare(const hypothesis& h, double thres, int method) {
304
-//	if(!completed() || !h.completed()) {
305
-//		cerr << "Comparing hypotheses have different length!" << endl;
306
-//		return -2;
307
-//	}
308
-//
309
-//	int first = 0;
310
-//	int length = F;
311
-//
312
-//	double dist = 0;
313
-//	// difference of final, accumulated or adjacent flow
314
-//	if(method == FINAL) {
315
-//		// final flow
316
-//		int end = first + length;
317
-//
318
-//		Vec2d flow_f = Vec2d(flow_y[end], flow_x[end]);
319
-//		Vec2d flow_f_h = Vec2d(h.flow_y[end], h.flow_x[end]);
320
-//
321
-//		double ysq = (flow_f[0] - flow_f_h[0]);
322
-//		double xsq = (flow_f[1] - flow_f_h[1]);
323
-//
324
-//		dist += sqrt(xsq*xsq + ysq*ysq);
325
-//	} else {
326
-//		int l = 1;
327
-//		for(int f = first; f < first + length; f++, l++) {
328
-//			double ysq = 0, xsq = 0;
329
-//
330
-//			Vec2d flow_f = Vec2d(flow_y[f], flow_x[f]);
331
-//			Vec2d flow_f_h = Vec2d(h.flow_y[f], h.flow_x[f]);
332
-//
333
-//			// comparison method
334
-//			if(method == ACC) {
335
-//				// accumulated flow
336
-//				ysq = flow_f[0] - flow_f_h[0];
337
-//				xsq = flow_f[1] - flow_f_h[1];
338
-//
339
-//				dist += sqrt(xsq*xsq + ysq*ysq) / l;
340
-//			} else if(method == ADJ) {
341
-//				// adjacent flow
342
-//				Vec2d flow_fm1 = Vec2d(0,0), flow_fm1_h = Vec2d(0,0);
343
-//
344
-//				if(f > first) {
345
-//					flow_fm1 = Vec2d(flow_y[f - 1], flow_x[f - 1]);
346
-//					flow_fm1_h = Vec2d(h.flow_y[first - 1], h.flow_x[first - 1]);
347
-//				}
348
-//
349
-//				ysq = ((flow_f[0] - flow_fm1[0]) - (flow_f_h[0] - flow_fm1_h[0]));
350
-//				xsq = ((flow_f[1] - flow_fm1[1]) - (flow_f_h[1] - flow_fm1_h[1]));
351
-//
352
-//				dist += sqrt(xsq*xsq + ysq*ysq);
353
-//			}
354
-//		}
355
-//	}
356
-//
357
-////	if(method != ACC)
358
-//		dist /= length;																		// normalize by length
359
-//
360
-//	if(dist > thres)   																		// compare distance to linear threshold
361
-//		return -2;
362
-//	else if(not_extrapolated_length < h.not_extrapolated_length)							// the other trajectory is longer
363
-//		return -1;
364
-//	else if(not_extrapolated_length > h.not_extrapolated_length)							// this trajectory is longer
365
-//		return 1;
366
-//	else if(extrapolation_err > h.extrapolation_err)										// the other has a smaller error
367
-//		return -1;
368
-//	else if(extrapolation_err < h.extrapolation_err)										// this trajectory has a smaller error
369
-//		return 1;
370
-//	else																					// both trajectories are equal
371
-//		return 0;
372
-//}
373
-
374 287
 int hypothesis::compare(const hypothesis& h, double thres, int method) {
375 288
 	int first = max(h.startF, startF);
376 289
 	int length = min((endF - first), (h.endF - first));

+ 0 - 5
utils/hypothesis.h

@@ -144,15 +144,12 @@ public:
144 144
 		endF = F;
145 145
 		double* n_flow_x = new double[F];
146 146
 		double* n_flow_y = new double[F];
147
-		// OCCLUSIONS ARE UPDATED AFTER ADAPTION!
148
-//		int* n_occlusions = new int[F];
149 147
 
150 148
 		if(skip >= 1) {
151 149
 			for(int i = 0; i < F; i++) {
152 150
 				int off = i * skip + (skip - 1);
153 151
 				n_flow_x[i] = flow_x[off];
154 152
 				n_flow_y[i] = flow_y[off];
155
-//				n_occlusions[i] = max(n_occlusions[i], occlusions[off]);
156 153
 			}
157 154
 		} else {
158 155
 			for(int i = 0; i < F; i++) {
@@ -170,7 +167,6 @@ public:
170 167
 				n_flow_x[i] = last_x + skip * (flow_x[off] - last_x);	// scale last flow
171 168
 				n_flow_y[i] = last_y + skip * (flow_y[off] - last_y);	// scale last flow
172 169
 
173
-//				n_occlusions[i] = max(n_occlusions[i], occlusions[off]);
174 170
 			}
175 171
 		}
176 172
 
@@ -179,7 +175,6 @@ public:
179 175
 		delete[] occlusions;
180 176
 		flow_x = n_flow_x;
181 177
 		flow_y = n_flow_y;
182
-//		occlusions = n_occlusions;
183 178
 	}
184 179
 
185 180
 	hypothesis& operator =(const hypothesis& h);

+ 0 - 5
utils/parameter_list.cpp

@@ -397,7 +397,6 @@ string ParameterList::cfgString(bool all_exps) const {
397 397
 	}
398 398
 
399 399
 	int tabs = ceil(max_length/8) + 1;
400
-//	int tabs = 1;
401 400
 	for(uint32_t f = 0; f < id_list.size(); f++)
402 401
 		os << "id" << string(tabs,'\t') << id_list[f] << "\n";
403 402
 
@@ -445,7 +444,6 @@ string ParameterList::cfgString(bool all_exps) const {
445 444
 
446 445
 	for(uint32_t i = 0; i < F; i++) {
447 446
 		if(i < set.size() && set[i] > 0) {
448
-//			os << "pixels " << i << string(ceil(max_length/8),'\t') ;
449 447
 			os << "pixels " << i << "\t";
450 448
 
451 449
 			for(int p = 0 ; p < set[i]; p++)
@@ -469,8 +467,6 @@ string ParameterList::cfgString(bool all_exps) const {
469 467
 		uint32_t iter = paramslist_iterator[idx];
470 468
 
471 469
 		// print parameter name and add tabs
472
-//		int tabs = ceil(max_length/8) - floor(name.length()/8) + 1;
473
-//		os << name << string(tabs,'\t');
474 470
 		os << name << string(1,'\t');
475 471
 
476 472
 		if(!all_exps || paramslist[idx].size() == 1)
@@ -490,7 +486,6 @@ string ParameterList::cfgString(bool all_exps) const {
490 486
 	}
491 487
 
492 488
 	if(bf_weights.size() > 0) {
493
-//		os << "bf_weights" << string(ceil(max_length/8),'\t') ;
494 489
 		os << "bf_weights\t";
495 490
 		for(uint32_t i = 0; i < bf_weights.size(); i++) {
496 491
 			os << bf_weights[i] << "\t";