# compute normalized reconstruction error file_name_ref = "_".join(["ae_loss", "test_set", flags.object_class]) + ".npy" file_path_ref = osp.join(conf.ae_dir, "eval", file_name_ref) if osp.exists(file_path_ref): ae_loss_per_pc_ref = np.load(file_path_ref) nre_per_pc = np.divide(ae_loss_per_pc, ae_loss_per_pc_ref) log_file.write("Normalized reconstruction error: %.9f\n" % nre_per_pc.mean()) log_file.close() # use any plotting mechanism, such as matplotlib, to visualize the results if flags.visualize_results: i = 0 plot_3d_point_cloud(pc_data_test.point_clouds[i][:, 0], pc_data_test.point_clouds[i][:, 1], pc_data_test.point_clouds[i][:, 2], in_u_sphere=True, title="Complete input point cloud") plot_3d_point_cloud(sampled_pc[i][:, 0], sampled_pc[i][:, 1], sampled_pc[i][:, 2], in_u_sphere=True, title="S-NET sampled points") plot_3d_point_cloud(reconstructions[i][:, 0], reconstructions[i][:, 1], reconstructions[i][:, 2], in_u_sphere=True, title="Reconstruction from S-NET points")
log_file = open(osp.join(eval_dir, log_file_name), "w", 1) log_file.write("Evaluation flags: %s\n" % flags) log_file.write("Mean ae loss: %.9f\n" % ae_loss_per_pc.mean()) # compute normalized reconstruction error file_name_ref = "_".join(["ae_loss", "test_set", flags.object_class]) + ".npy" file_path_ref = osp.join(conf.ae_dir, "eval", file_name_ref) if osp.exists(file_path_ref): ae_loss_per_pc_ref = np.load(file_path_ref) nre_per_pc = np.divide(ae_loss_per_pc, ae_loss_per_pc_ref) log_file.write("Normalized reconstruction error: %.9f\n" % nre_per_pc.mean()) log_file.close() # use any plotting mechanism, such as matplotlib, to visualize the results if flags.visualize_results: i = 0 plot_3d_point_cloud( pc_data_test.point_clouds[i], in_u_sphere=True, title="Complete input point cloud", ) plot_3d_point_cloud( sampled_pc[i][:n_sample_points], in_u_sphere=True, title="SampleNetProgressive sampled points" ) plot_3d_point_cloud( reconstructions[i], in_u_sphere=True, title="Reconstruction from SampleNetProgressive points", )
"fps", "%04d" % n_sample_points, ]) + ".txt") else: log_file_name = log_file_name_wo_fps log_file = open(osp.join(eval_dir, log_file_name), "w", 1) log_file.write("Mean ae loss: %.9f\n" % loss_per_pc.mean()) # compute normalized reconstruction error file_path_ref = osp.join(eval_dir, file_name_wo_fps) if osp.exists(file_path_ref): loss_per_pc_ref = np.load(file_path_ref) nre_per_pc = np.divide(loss_per_pc, loss_per_pc_ref) log_file.write("Normalized reconstruction error: %.3f\n" % nre_per_pc.mean()) log_file.close() # use any plotting mechanism, such as matplotlib, to visualize the results if flags.visualize_results: i = 0 plot_3d_point_cloud( pc_data_test.point_clouds[i], in_u_sphere=True, title="Complete input point cloud", ) plot_3d_point_cloud(reconstructions[i], in_u_sphere=True, title="Reconstruction from complete input")
n_sample_points, :] # sample form ProgressiveNet points sorted_pc = ae.sess.run(ae.x_sorted, feed_dict={ae.x: complete_pc}) # complete pc sorted by FPS fps_pc = sorted_pc[:, :n_sample_points, :] # FPS points # Reconstruct reconstructed_from_sampled = ae.reconstruct(complete_pc, S=ordered_pc)[0] reconstructed_from_fps = ae.reconstruct(complete_pc, S=sorted_pc)[0] # Use any plotting mechanism, such as matplotlib, to visualize the results i = 0 plot_3d_point_cloud(complete_pc[i][:, 0], complete_pc[i][:, 1], complete_pc[i][:, 2], in_u_sphere=True, title='Complete input point cloud') plot_3d_point_cloud(sampled_pc[i][:, 0], sampled_pc[i][:, 1], sampled_pc[i][:, 2], in_u_sphere=True, title='ProgressiveNet sampled points') plot_3d_point_cloud(fps_pc[i][:, 0], fps_pc[i][:, 1], fps_pc[i][:, 2], in_u_sphere=True, title='FPS sampled points') plot_3d_point_cloud(reconstructed_from_sampled[i][:, 0], reconstructed_from_sampled[i][:, 1], reconstructed_from_sampled[i][:, 2],
file_path_ref = osp.join(conf.ae_dir, "eval", file_name_ref) if osp.exists(file_path_ref): ae_loss_per_pc_ref = np.load(file_path_ref) nre_per_pc = np.divide(ae_loss_per_pc, ae_loss_per_pc_ref) log_file.write("Normalized reconstruction error: %.9f\n" % nre_per_pc.mean()) log_file.close() # use any plotting mechanism, such as matplotlib, to visualize the results if flags.visualize_results: i = 0 plot_3d_point_cloud( pc_data_test.point_clouds[i][:, 0], pc_data_test.point_clouds[i][:, 1], pc_data_test.point_clouds[i][:, 2], in_u_sphere=True, title="Complete input point cloud", ) plot_3d_point_cloud(sampled_pc[i][:n_sample_points, 0], sampled_pc[i][:n_sample_points, 1], sampled_pc[i][:n_sample_points, 2], in_u_sphere=True, title="ProgressiveNet sampled points") plot_3d_point_cloud( reconstructions[i][:, 0], reconstructions[i][:, 1], reconstructions[i][:, 2], in_u_sphere=True, title="Reconstruction from ProgressiveNet points", )