-
Notifications
You must be signed in to change notification settings - Fork 27
/
gen_gan.py
45 lines (33 loc) · 1.03 KB
/
gen_gan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from __future__ import print_function
from show3d_balls import *
import argparse
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
from torch.autograd import Variable
from datasets import PartDataset
from pointnet import PointGen, PointGenC
import torch.nn.functional as F
import matplotlib.pyplot as plt
#showpoints(np.random.randn(2500,3), c1 = np.random.uniform(0,1,size = (2500)))
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=str, default = '', help='model path')
opt = parser.parse_args()
print (opt)
gen = PointGen()
gen.load_state_dict(torch.load(opt.model))
sim_noises = Variable(torch.randn(10, 100))
points = gen(sim_noises)
point_np = points.transpose(2,1).data.numpy()
print(point_np.shape)
#showpoints(point_np)
np.savez('points.npz', point_np)