MCPcopy Create free account
hub / github.com/diviswen/Cycle4Completion / eval_one_epoch

Function eval_one_epoch

main_code.py:355–398  ·  view source on GitHub ↗
(sess, ops, test_writer, epoch)

Source from the content-addressed store, hash-verified

353 code_loss_sum = 0.
354
355def eval_one_epoch(sess, ops, test_writer, epoch):
356 is_training = False
357 total_batch = TEST_DATASET.shape[0]
358 chamfer_loss_sum = 0.
359
360
361 for i in range(total_batch):
362 batch_input_data = TEST_DATASET[i]
363 batch_data_gt = TEST_DATASET_GT[i]
364
365 feed_dict = {
366 ops['pointclouds_pl']: batch_input_data[:, :, 0:3],
367 ops['pointclouds_gt']: batch_data_gt[:, :, 0:3],
368 ops['pointclouds_Y']: batch_data_gt[:, :, 0:3],
369 ops['is_training']: is_training
370 }
371 complete_CD, pred_val, pred_Y2X, pred_Y2X2Y, pred_X2Y2X = sess.run([ops['complete_CD'], ops['pointclouds_pred'], ops['incomplete_Y'], ops['pred_Y2X2Y'],ops['pred_X2Y2X']], feed_dict=feed_dict)
372 chamfer_loss_sum += complete_CD
373
374 mean_chamfer_loss = chamfer_loss_sum / total_batch
375
376 log_string('eval chamfer loss: %.3f' % \
377 (mean_chamfer_loss/2048. * 10000.))
378 LOG_RESULT_FOUT.write('%.3f\n' % (mean_chamfer_loss/2048. * 10000.))
379 LOG_RESULT_FOUT.flush()
380
381 os.makedirs(os.path.join(LOG_DIR,'vis/epoch_%d_%.2f'%(epoch, mean_chamfer_loss*4.883)))
382 for i in range(pred_val.shape[0]):
383 gt = batch_data_gt[i]
384 pred = pred_val[i]
385 res = batch_input_data[i]
386 Y2X = pred_Y2X[i]
387 Y2X2Y = pred_Y2X2Y[i]
388 X2Y2X = pred_X2Y2X[i]
389
390
391 io_util.write_ply(gt, os.path.join(LOG_DIR,'vis/epoch_%d_%.2f/gt_%d.ply'%(epoch, mean_chamfer_loss*4.883, i)))
392 io_util.write_ply(pred, os.path.join(LOG_DIR,'vis/epoch_%d_%.2f/pred_%d.ply'%(epoch, mean_chamfer_loss*4.883, i)))
393 io_util.write_ply(res, os.path.join(LOG_DIR,'vis/epoch_%d_%.2f/res_%d.ply'%(epoch, mean_chamfer_loss*4.883, i)))
394 io_util.write_ply(Y2X, os.path.join(LOG_DIR,'vis/epoch_%d_%.2f/pred_Y2X_%d.ply'%(epoch, mean_chamfer_loss*4.883, i)))
395 io_util.write_ply(Y2X2Y, os.path.join(LOG_DIR,'vis/epoch_%d_%.2f/pred_Y2X2Y_%d.ply'%(epoch, mean_chamfer_loss*4.883, i)))
396 io_util.write_ply(X2Y2X, os.path.join(LOG_DIR,'vis/epoch_%d_%.2f/pred_X2Y2X_%d.ply'%(epoch, mean_chamfer_loss*4.883, i)))
397
398 return mean_chamfer_loss*4.883
399
400
401if __name__ == "__main__":

Callers 1

trainFunction · 0.85

Calls 2

log_stringFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected