MCPcopy Create free account
hub / github.com/anton-jeran/MESH2IR / evaluate

Function evaluate

evaluate/evaluate_array.py:99–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97
98
99def evaluate():
100
101 embedding_directory ="Embeddings/"
102 graph_directory = "Mesh_Graphs/"
103 output_directory ="Output/"
104
105 netG_path = "Models/MESH2IR/netG_epoch_175.pth"
106 mesh_net_path = "Models/MESH2IR/mesh_net_epoch_175.pth"
107 gpus =[0,1]
108
109 #Specify the custom array geometry
110 custom_array = np.array([[0, 0.035, 0], [-0.0303, 0.0175, 0], [-0.0303, -0.0175, 0], [0, -0.035, 0], [0.0303, -0.0175, 0],
111 [0.0303, 0.0175, 0]])
112
113
114 batch_size = custom_array.shape[0]
115 # batch_size = 256
116
117 fs = 16000
118
119
120 if(not os.path.exists(output_directory)):
121 os.mkdir(output_directory)
122
123 netG, mesh_net = load_network_stageI(netG_path,mesh_net_path)
124 netG.eval()
125 mesh_net.eval()
126
127
128 netG.to(device='cuda')
129 mesh_net.to(device='cuda')
130
131 embedding_list = os.listdir(embedding_directory)
132
133 for embed in embedding_list:
134 embed_path = embedding_directory + "/"+embed
135 embeddings = load_embedding(embed_path)
136 embed_name = embed[0:len(embed)-7]
137 output_embed = output_directory+embed_name
138 if(not os.path.exists(output_embed)):
139 os.mkdir(output_embed)
140
141 print("embed_name ",output_embed)
142
143 graph_path,folder_name,wave_name,source_location,receiver_location = embeddings[0]
144
145 full_graph_path = graph_directory + graph_path
146
147 data_single = get_graph(full_graph_path)
148 data_list=[data_single]*batch_size
149 loader = DataLoader(data_list, batch_size=batch_size)
150
151 data = next(iter(loader))
152 data['edge_index'] = Variable(data['edge_index'])
153 data['pos'] = Variable(data['pos'])
154 data = data.cuda()
155
156

Callers 1

evaluate_array.pyFile · 0.70

Calls 3

load_network_stageIFunction · 0.70
load_embeddingFunction · 0.70
get_graphFunction · 0.70

Tested by

no test coverage detected