File size: 1,154 Bytes
06db6e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

import random
import pickle
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt

from app import App
from g2p.plot import plot_fp

model_path = '../Interface/model/model.pth'
device='cuda'
train_path='../Interface/static/Data/data_train_converted.pkl'
tf_path='../Interface/retrieval/tf_train.npy'
centroid_path='../Interface/retrieval/centroids_train.npy'
cluster_path='../Interface/retrieval/clusters_train.npy'
dataset_path = '../Interface/static/Data/data_test_converted.pkl'

app = App(model_path,device,train_path,tf_path,centroid_path,cluster_path)

dataset = pickle.load(open(dataset_path,'rb'))['data']

# retrieve-> transfer -> predict -> align -> decorate
data_boundary = dataset[0]
data_graph = app.retrieve(data_boundary)[0]
data = app.transfer(data_boundary,data_graph)
data = app.forward(data,network_data=False)
data = app.align(data)
data = app.decorate(data)
# or just: 
# data = app.generate(data_boundary)

# visualize and save
ax = plot_fp(data.boundary,data.newBox[data.order],data.rType[data.order],data.doors,data.windows)
fig = plt.gcf()
fig.canvas.draw()
fig.canvas.print_figure('test_interface_data.png')