def load_pointcloud(pc_filename): pointcloud = pc_util.read_xyzrgb_ply(pc_filename) return pointcloud
sampling='seed_fps', num_class=DC.num_class).to(device) print('Constructed model.') # Load checkpoint optimizer = optim.Adam(net.parameters(), lr=0.001) checkpoint = torch.load(checkpoint_path) net.load_state_dict(checkpoint['model_state_dict']) optimizer.load_state_dict(checkpoint['optimizer_state_dict']) epoch = checkpoint['epoch'] print("Loaded checkpoint %s (epoch: %d)" % (checkpoint_path, epoch)) # Load and preprocess input point cloud net.eval() # set model to eval mode (for bn and dp) # point_cloud = read_ply(pc_path) point_cloud = read_xyzrgb_ply(pc_path) pc = preprocess_point_cloud(point_cloud) print('Loaded point cloud data: %s' % (pc_path)) # Model inference inputs = {'point_clouds': torch.from_numpy(pc).to(device)} tic = time.time() with torch.no_grad(): end_points = net(inputs) toc = time.time() print('Inference time: %f' % (toc - tic)) end_points['point_clouds'] = inputs['point_clouds'] if not os.path.exists(dump_dir): os.mkdir(dump_dir) MODEL.dump_results(end_points, dump_dir, DC, True) print('Dumped detection results to folder %s' % (dump_dir))