def __init__(self, model, config_file, train=True): self.model = model self.config = utils.get_yaml_contents(config_file) self.is_train = train self.exclude_blocks = [ 'Mixed_1', 'Mixed_2', 'Mixed_3', 'Mixed_4', 'Mixed_5', 'Mixed_6', 'maxpool4', 'maxpool7', 'inception_fc0', 'inception_fc1', 'dp0_inception_fc', 'dp1_inception_fc', 'pc_fc0', 'pc_fc1', 'dp0_pc_fc', 'dp1_pc_fc', 'dp_combined', 'fc1', 'dp1', 'logits', 'Logits', 'Predictions', 'Logits/biases', 'agg', 'agg/biases', 'transform_net1', 'dgcnn1', 'dgcnn2', 'dgcnn3', 'dgcnn4', 'fc2', 'fc3', 'dp2' ] if self.model == "3DmFV": self.m = self.config['models']['3DmFV']['n_gaussians'] self.gmm_variance = self.config['models']['3DmFV']['gmm_variance'] self.gmm = utils.get_3d_grid_gmm( subdivisions=[self.m, self.m, self.m], variance=self.gmm_variance) self.set_config() self.set_logdir() self.load_train_data() self.input_dim = 6 if self.model_config.pointcloud_color else 3 self.load_model()
cos = cos_ang[expert_to_use, range(len(expert_to_use))] ang_err_batch = np.rad2deg(np.arccos(np.abs(cos))) # unoriented ang_err.append(ang_err_batch) loss_sum += loss_val test_writer.add_summary(summary, step) total_seen += BATCH_SIZE mean_loss = loss_sum / float(test_num_batchs) log_string('eval mean loss: %f' % (mean_loss)) ang_err = np.reshape(ang_err, [n_shapes, PATCHES_PER_SHAPE]) rms = np.sqrt(np.mean(np.square(ang_err), axis=1)) mean_rms = np.mean(rms) log_string('eval mean rms: %f' % (mean_rms)) tf.summary.scalar('Eval RMS angle', mean_rms) return mean_loss if __name__ == "__main__": gmm = utils.get_3d_grid_gmm( subdivisions=[N_GAUSSIANS, N_GAUSSIANS, N_GAUSSIANS], variance=GMM_VARIANCE) pickle.dump(gmm, open(os.path.join(LOG_DIR, 'gmm.p'), "wb")) train(gmm) LOG_FOUT.close()
default='data/test/PMD_M20.pcd') parser.add_argument( '--dataset', help='cloud to test', default='/media/emha/HDD4/pointcloud_dataset/pcd/asus/test') # /home/emha/pmd_multiview_dataset/ # /media/emha/HDD1/Dataset/rgbd-dataset-51/ args = parser.parse_args() cloud = args.pcd data_folder = args.dataset gmm = None if fe is not "mc": n_gaussian = int(''.join(filter(str.isdigit, fe))) print(n_gaussian) gmm = utils.get_3d_grid_gmm( subdivisions=[n_gaussian, n_gaussian, n_gaussian], variance=0.05) acc = evaluate_maxrdd_fv_cls(data_folder, classifier, objects='all', color=True, gmm=gmm, feature_extraction=fe, mc_feature=True) #acc = evaluate_cls_using_pgz(data_folder, gmm, classifier, fe, [10,13]) accuracies.append(acc) indices.append(int(idx)) plt.scatter(indices, accuracies)