Python util.get_args() Examples
The following are 1
code examples of util.get_args().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
util
, or try the search function
.
Example #1
Source File: test_demo.py From PartNet with MIT License | 5 votes |
def main(): config = util.get_args() config.cuda = not config.no_cuda torch.cuda.set_device(config.gpu) if config.cuda and torch.cuda.is_available(): print("Using CUDA on GPU ", config.gpu) else: print("Not using CUDA.") net = partnet_model.PARTNET(config) net.load_state_dict(torch.load(config.save_path + '/partnet_final.pkl', map_location=lambda storage, loc: storage.cuda(config.gpu))) if config.cuda: net.cuda() net.eval() if not os.path.exists(config.output_path + 'segmented'): os.makedirs(config.output_path + 'segmented') print("Loading data ...... ", end='\n', flush=True) shape = torch.from_numpy(sio.loadmat(config.data_path + 'demo.mat')['pc']).float() ##for your own new shape ##shape = normalize_shape(shape) with torch.no_grad(): shape = shape.cuda() points_feature = net.pointnet(shape) root_feature = net.pcEncoder(shape) global m m = 0 label = decode_structure(net, root_feature, points_feature, shape) #segmented results writeply(config.output_path + 'segmented/demo.ply', shape, label) print('Successfully output result!')