pengsida/NeuralBody
1
1import numpy as np2from lib.config import cfg3import os4 5 6class Evaluator:7 def evaluate(self, output, batch):8 cube = output['cube']9 cube = cube[10:-10, 10:-10, 10:-10]10 11 pts = batch['pts'][0].detach().cpu().numpy()12 pts = pts[cube > cfg.mesh_th]13 14 i = batch['i'].item()15 result_dir = os.path.join(cfg.result_dir, 'pts')16 os.system('mkdir -p {}'.format(result_dir))17 result_path = os.path.join(result_dir, '{}.npy'.format(i))18 np.save(result_path, pts)19 20 def summarize(self):21 return {}22 