From 9bba40c148c83d3514c473ba46e8708c7adaa1e3 Mon Sep 17 00:00:00 2001 From: Bill Lotter Date: Mon, 11 Jul 2016 10:28:02 -0400 Subject: [PATCH] Write results to file --- kitti_evaluate.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kitti_evaluate.py b/kitti_evaluate.py index beb7f97..4592ecf 100644 --- a/kitti_evaluate.py +++ b/kitti_evaluate.py @@ -49,18 +49,20 @@ X_test = np.transpose(X_test, (1, 2, 0)) X_hat = np.transpose(X_hat, (1, 2, 0)) -# Compare MSE of PredNet predictions vs. using last frame. +# Compare MSE of PredNet predictions vs. using last frame. Write results to prediction_scores.txt mse_model = np.mean( (X_test[:, 1:] - X_hat[:, 1:])**2 ) # look at all timesteps except the first mse_prev = np.mean( (X_test[:, :-1] - X_test[:, 1:])**2 ) -print "Model MSE: %f" % mse_model -print "Previous Frame MSE: %f" % mse_prev +if not os.path.exists(results_save_dir): os.mkdir(results_save_dir) +f = open(results_save_dir + 'prediction_scores.txt', 'w') +f.write("Model MSE: %f\n" % mse_model) +f.write("Previous Frame MSE: %f" % mse_prev) +f.close() # Plot some predictions aspect_ratio = float(X_hat.shape[3]) / X_hat.shape[4] plt.figure(figsize = (nt, 2*aspect_ratio)) gs = gridspec.GridSpec(2, nt) gs.update(wspace=0.025, hspace=0.05) -if not os.path.exists(results_save_dir): os.mkdir(results_save_dir) plot_save_dir = os.path.join(results_save_dir, 'prediction_plots/') if not os.path.exists(plot_save_dir): os.mkdir(plot_save_dir) for i in range(n_plot):