def main(_): if not os.path.exists(FLAGS.sample_dir): os.makedirs(FLAGS.sample_dir) # gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5) # run_config = tf.ConfigProto(gpu_options=gpu_options) run_config = tf.ConfigProto() run_config.gpu_options.allow_growth = True if FLAGS.ae: with tf.Session(config=run_config) as sess: bsp_ae = BSP_AE( sess, FLAGS.phase, FLAGS.sample_vox_size, is_training=FLAGS.train or FLAGS.getz, dataset_name=FLAGS.dataset, checkpoint_dir=FLAGS.checkpoint_dir, sample_dir=FLAGS.sample_dir, data_dir=FLAGS.data_dir) if FLAGS.train: bsp_ae.train(FLAGS) elif FLAGS.getz: bsp_ae.get_z(FLAGS) else: if FLAGS.phase == 0: bsp_ae.test_dae3(FLAGS) else: # bsp_ae.test_bsp(FLAGS) bsp_ae.test_mesh_point(FLAGS) # bsp_ae.test_mesh_obj_material(FLAGS) elif FLAGS.svr: with tf.Session(config=run_config) as sess: bsp_svr = BSP_SVR( sess, FLAGS.phase, FLAGS.sample_vox_size, is_training=FLAGS.train, dataset_name=FLAGS.dataset, checkpoint_dir=FLAGS.checkpoint_dir, sample_dir=FLAGS.sample_dir, data_dir=FLAGS.data_dir) if FLAGS.train: bsp_svr.train(FLAGS) else: # bsp_svr.test_bsp(FLAGS) bsp_svr.test_mesh_point(FLAGS) # bsp_svr.test_mesh_obj_material(FLAGS) else: print("Please specify an operation: ae or svr?")
def main(_): if not os.path.exists(FLAGS.sample_dir): os.makedirs(FLAGS.sample_dir) #gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5) #run_config = tf.ConfigProto(gpu_options=gpu_options) run_config = tf.ConfigProto() run_config.gpu_options.allow_growth=True with tf.Session(config=run_config) as sess: bsp_ae = BSP_AE( sess, FLAGS.sample_vox_size, is_training = FLAGS.train, dataset_name=FLAGS.dataset, checkpoint_dir=FLAGS.checkpoint_dir, sample_dir=FLAGS.sample_dir, data_dir=FLAGS.data_dir) if FLAGS.train: bsp_ae.train(FLAGS) else: bsp_ae.test(FLAGS)
parser.add_argument("--sample_vox_size", action="store", dest="sample_vox_size", default=64, type=int, help="Voxel resolution for coarse-to-fine training [64]") parser.add_argument("--train", action="store_true", dest="train", default=False, help="True for training, False for testing [False]") parser.add_argument("--start", action="store", dest="start", default=0, type=int, help="In testing, output shapes [start:end]") parser.add_argument("--end", action="store", dest="end", default=16, type=int, help="In testing, output shapes [start:end]") parser.add_argument("--ae", action="store_true", dest="ae", default=False, help="True for ae [False]") parser.add_argument("--svr", action="store_true", dest="svr", default=False, help="True for svr [False]") parser.add_argument("--getz", action="store_true", dest="getz", default=False, help="True for getting latent codes [False]") FLAGS = parser.parse_args() if not os.path.exists(FLAGS.sample_dir): os.makedirs(FLAGS.sample_dir) if FLAGS.ae: bsp_ae = BSP_AE(FLAGS) print("starting in AE") if FLAGS.train: bsp_ae.train(FLAGS) elif FLAGS.getz: bsp_ae.get_z(FLAGS) else: if FLAGS.phase==0: bsp_ae.test_dae3(FLAGS) # bsp_ae.test_bsp(FLAGS) else: # bsp_ae.test_dae3(FLAGS) bsp_ae.test_bsp(FLAGS) bsp_ae.test_mesh_point(FLAGS) # bsp_ae.test_mesh_obj_material(FLAGS) elif FLAGS.svr: