forked from IDEALLab/design_embeddings_jmd_2016
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshape_distribution.py
39 lines (30 loc) · 1.01 KB
/
shape_distribution.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
"""
Plots given shapes in the semantic space using trained models
Author(s): Wei Chen ([email protected])
"""
import ConfigParser
import numpy as np
from util import load_model, get_fname
from shape_plot import plot_samples
model_name = 'KPCA'
c = 0
directory = './synthesized_shapes/diversity/'
indices = np.load(directory+'ranking.npy')
indices = indices.flatten()[:10]
X = np.load(get_fname(model_name, c, directory=directory, extension='npy'))[indices]
# Get the low-dimensional representation of X
xpca = load_model('xpca', c)
F = xpca.transform(X)
model = load_model(model_name, c)
F = model.transform(F)
fpca = load_model(model_name+'_fpca', c)
F = fpca.transform(F)
fscaler = load_model(model_name+'_fscaler', c)
F = fscaler.transform(F)
config = ConfigParser.ConfigParser()
config.read('config.ini')
source = config.get('Global', 'source')
if source == 'glass':
plot_samples(F, X, None, range(X.shape[0]), [], directory, '', c)
else:
plot_samples(F, X, None, range(X.shape[0]), [], directory, '', c, mirror=False)