text stringlengths 1 93.6k |
|---|
# draw the final graph
|
pos = dict()
|
first_it = True
|
for node in final_G.nodes():
|
x = final_G.node[node]['x']
|
y = final_G.node[node]['y']
|
pos[node] = [x, y]
|
if first_it is True:
|
x_min = x
|
y_min = y
|
x_max = x
|
y_max = y
|
first_it = False
|
else:
|
if x > x_max:
|
x_max = x
|
elif x < x_min:
|
x_min = x
|
if y > y_max:
|
y_max = y
|
elif y < y_min:
|
y_min = y
|
margin = 0.01
|
delta_x = abs(x_max - x_min)
|
delta_y = abs(y_max - y_min)
|
print('x_min = {}\nx_max = {}\ny_min = {}\ny_max = {}'.format(x_min, x_max, y_min, y_max))
|
plt.xlim(x_min - margin * delta_x, x_max + margin * delta_x)
|
plt.ylim(y_min - margin * delta_y, y_max + margin * delta_y)
|
nx.draw_networkx(final_G, pos, with_labels=False, node_size=2, linewidths=0.0)
|
plt.show()
|
plt.close()
|
# <FILESEP>
|
"""
|
Client to submit new render request to server
|
"""
|
import logging
|
from util import client
|
logging.basicConfig(level=logging.INFO)
|
LOGGER = logging.getLogger(__name__)
|
def send(d):
|
"""
|
Send/Submit a new render request
|
:param d: dict. a render request serialized as dictionary
|
"""
|
rrequest = client.add_request(d)
|
if rrequest:
|
LOGGER.info('request %s sent to server', rrequest.uid)
|
if __name__ == '__main__':
|
test_job_a = {
|
'name': 'street_seq01',
|
'owner': 'TEST_SUBMITTER_01',
|
'umap_path': '/Game/Cinematics/Street/Level_Cin_Street.Level_Cin_Street',
|
'useq_path': '/Game/Cinematics/Street/Shots/Shot01/LS_Shot_Street_Shot01.LS_Shot_Street_Shot01',
|
'uconfig_path': '/Game/Cinematics/Preset/Test.Test'
|
}
|
test_job_b = {
|
'name': 'street_seq02',
|
'owner': 'TEST_SUBMITTER_01',
|
'umap_path': '/Game/Cinematics/Street/Level_Cin_Street.Level_Cin_Street',
|
'useq_path': '/Game/Cinematics/Street/Shots/Shot02/LS_Shot_Street_Shot02.LS_Shot_Street_Shot02',
|
'uconfig_path': '/Game/Cinematics/Preset/Test.Test'
|
}
|
for job in [test_job_a, test_job_b]:
|
send(job)
|
# <FILESEP>
|
"""
|
This code is modified based on Jin-Hwa Kim's repository (Bilinear Attention Networks - https://github.com/jnhwkim/ban-vqa) by Xuan B. Nguyen
|
"""
|
import torch
|
import utils
|
import contextlib
|
from collections import defaultdict, OrderedDict
|
from meters import AverageMeter, TimeMeter
|
class Trainer(object):
|
"""
|
Main class for training.
|
"""
|
def __init__(self, args, model, criterion, optimizer=None, ae_criterion = None):
|
self.args = args
|
# copy model and criterion on current device
|
self.model = model.to(self.args.device)
|
self.criterion = criterion.to(self.args.device)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.