Python network.network() Examples
The following are 23
code examples of network.network().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
network
, or try the search function
.
Example #1
Source File: 00_freeze_lsmod.py From PINTO_model_zoo with MIT License | 6 votes |
def main(): graph = tf.Graph() with graph.as_default(): #in_image = tf.compat.v1.placeholder(tf.float32, [None, TEST_CROP_FRAME, None, None, 4], name='input') #gt_image = tf.compat.v1.placeholder(tf.float32, [None, TEST_CROP_FRAME, None, None, 3], name='gt') in_image = tf.compat.v1.placeholder(tf.float32, [None, CROP_FRAME, 256, 256, 4], name='input') gt_image = tf.compat.v1.placeholder(tf.float32, [None, CROP_FRAME, 256, 256, 3], name='gt') out_image = network(in_image) saver = tf.compat.v1.train.Saver(tf.compat.v1.global_variables()) sess = tf.compat.v1.Session() sess.run(tf.compat.v1.global_variables_initializer()) sess.run(tf.compat.v1.local_variables_initializer()) saver.restore(sess, './1_checkpoint/16_bit_HE_to_HE_gt/model.ckpt') saver.save(sess, './1_checkpoint/16_bit_HE_to_HE_gt/modelfilnal.ckpt') graphdef = tf.compat.v1.graph_util.convert_variables_to_constants(sess, graph.as_graph_def(), ['output']) tf.io.write_graph(graphdef, './1_checkpoint/16_bit_HE_to_HE_gt', 'lsmod_256.pb', as_text=False)
Example #2
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 6 votes |
def on_click(self, event): if event.inaxes == self.ax and self.running == False: self.params = model.params_three() self.coupling = np.zeros((9), float) self.coupling[:6] = self.network.coupling_strength length = self.system.N_output(self.CYCLES) self.t = self.system.dt*np.arange(length) self.trajectory = np.zeros((length, 3), float) self.li_b.set_data(self.t, self.trajectory[:, 0]) self.li_g.set_data(self.t, self.trajectory[:, 1]-0.06) self.li_r.set_data(self.t, self.trajectory[:, 2]-0.12) ticks = np.asarray(self.t[::self.t.size/10], dtype=int) self.ax.set_xticks(ticks) self.ax.set_xticklabels(ticks) self.ax.set_xlim(self.t[0], self.t[-1]) self.fig.canvas.draw() self.anim = animation.FuncAnimation(self.fig, self.compute_step, init_func=self.init, frames=self.trajectory.shape[0], interval=0, blit=True, repeat=False) self.running = True
Example #3
Source File: torus_2D.py From Motiftoolbox with GNU General Public License v2.0 | 6 votes |
def __init__(self, system, network, traces, info=None, position=None): win.window.__init__(self, position) self.system = system self.network = network self.traces = traces self.info = info self.GRID = 10 self.USE_GPU = False self.PLOT_ARROWS = False self.basin_image = None ticks = 0.1*np.arange(11) self.ax_traces = self.fig.add_subplot(121, xticks=ticks, yticks=ticks[1:]) self.ax_traces.set_xlabel(r'$\Delta\theta_{12}$', fontsize=20) self.ax_traces.set_ylabel(r'$\Delta\theta_{13}$', fontsize=20) self.ax_traces.set_xlim(0., 1.) self.ax_traces.set_ylim(0., 1.) self.ax_basins = self.fig.add_subplot(122, xticks=ticks, yticks=ticks[1:]) self.ax_basins.set_xlabel(r'$\Delta\theta_{12}$', fontsize=20) self.key_func_dict.update(dict(u=torus_2D.increase_grid, i=torus_2D.decrease_grid, E=type(self).erase_traces, g=torus_2D.switch_processor, A=torus_2D.switch_arrows)) self.fig.canvas.mpl_connect('button_press_event', self.on_click)
Example #4
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 6 votes |
def compute_traces(self, initial_condition=None): if initial_condition == None: initial_condition = self.initial_condition V_i = fh.integrate_four_rk4( initial_condition, self.network.get_coupling(), self.system.dt/float(self.system.stride), self.system.N_output(self.CYCLES), self.system.stride) t = self.system.dt*np.arange(V_i.shape[0]) ticks = np.asarray(t[::t.size/10], dtype=int) self.li_b.set_data(t, V_i[:, 0]) self.li_g.set_data(t, V_i[:, 1]-2.) self.li_r.set_data(t, V_i[:, 2]-4.) self.li_y.set_data(t, V_i[:, 3]-6.) self.ax.set_xticks(ticks) self.ax.set_xticklabels(ticks) self.ax.set_xlim(t[0], t[-1]) self.fig.canvas.draw() return t, V_i
Example #5
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 6 votes |
def __init__(self, phase_potrait, network, traces, info=None, position=None): win.window.__init__(self, position, infoWindow=info) self.system = phase_potrait self.network = network self.traces = traces self.GRID = 6 self.USE_GPU = False self.ax = self.fig.add_subplot(111, projection='3d', xticks=ticks, yticks=ticks, zticks=ticks) self.ax.mouse_init(zoom_btn=None) self.ax.set_xlabel(r'$\Delta\theta_{12}$', fontsize=15) self.ax.set_ylabel(r'$\Delta\theta_{13}$', fontsize=15) self.ax.set_zlabel(r'$\Delta\theta_{14}$', fontsize=15) self.ax.set_xlim(0., 1.) self.ax.set_ylim(0., 1.) self.ax.set_zlim(0., 1.) self.fig.tight_layout() self.ax.autoscale(False) self.key_func_dict.update( dict( u=torus.increase_grid, i=torus.decrease_grid, R=torus.show_torus, E=torus.resetTorus, v=torus.reset_view ) ) #g=torus.switchProcessor)) self.fig.canvas.mpl_connect('button_press_event', self.clickTorus)
Example #6
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 6 votes |
def computeTraces(self, initial_condition=None, plotit=True): if initial_condition == None: initial_condition = self.initial_condition V_i = th2.integrate_three_rk4( initial_condition, self.network.coupling_strength, self.system.dt/float(self.system.stride), self.system.N_output(self.CYCLES), self.system.stride) t = self.system.dt*np.arange(V_i.shape[0]) if plotit: ticks = np.asarray(t[::t.size/10], dtype=int) self.li_b.set_data(t, np.cos(V_i[:, 0])) self.li_g.set_data(t, np.cos(V_i[:, 1])-2.) self.li_r.set_data(t, np.cos(V_i[:, 2])-4.) self.ax.set_xticks(ticks) self.ax.set_xticklabels(ticks) self.ax.set_xlim(t[0], t[-1]) self.fig.canvas.draw() return t, V_i
Example #7
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def phaseTrace_cpu(self, i, X): V_i = np.transpose( model.integrate_four_rk4( X[i, :], self.network.get_coupling(), self.dt/float(self.stride), self.N_output, self.stride)) ti, d = tl.phase_difference(V_i, V_trigger=torus.V_trigger) return d
Example #8
Source File: test.py From Learning-to-See-Moving-Objects-in-the-Dark with MIT License | 5 votes |
def main(): sess = tf.Session() in_image = tf.placeholder(tf.float32, [None, TEST_CROP_FRAME, None, None, 4]) gt_image = tf.placeholder(tf.float32, [None, TEST_CROP_FRAME, None, None, 3]) out_image = network(in_image) saver = tf.train.Saver() sess.run(tf.global_variables_initializer()) ckpt = tf.train.get_checkpoint_state(CHECKPOINT_DIR) if ckpt: print('loaded ' + ckpt.model_checkpoint_path) saver.restore(sess, ckpt.model_checkpoint_path) if not os.path.isdir(TEST_RESULT_DIR): os.makedirs(TEST_RESULT_DIR) for i, file0 in enumerate(in_paths): t0 = time.time() # raw = vread(file0) raw = np.load(file0) if raw.shape[0] > MAX_FRAME: print 'Video with shape', raw.shape, 'is too large. Splitted.' count = 0 begin_frame = 0 while begin_frame < raw.shape[0]: t1 = time.time() print 'processing segment %d ...' % (count + 1), new_filename = '.'.join(file0.split('.')[:-1] + [str(count)] + file0.split('.')[-1::]) process_video(sess, in_image, out_image, new_filename, raw[begin_frame: begin_frame + MAX_FRAME, :, :, :]) count += 1 begin_frame += MAX_FRAME print '\t{}s'.format(time.time() - t1) else: process_video(sess, in_image, out_image, file0, raw, out_file=train_ids[i] + '.mp4') print train_ids[i], '\t{}s'.format(time.time() - t0)
Example #9
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def compute_phase_trace_gpu(self, X): X = X.flatten() V_all = model.cuda_integrate_four_rk4(X, self.network.get_coupling(), self.dt/float(self.stride), self.N_output, self.stride) V_all = np.swapaxes(V_all, 1, 2) # V_all[initial condition, voltage trace, time index] return fm.distribute(phase_trace_gpu, 'i', range(V_all.shape[0]), kwargs={'V': V_all})
Example #10
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, phase_potrait, network, traces, info=None, position=None): win.window.__init__(self, position) self.system = phase_potrait self.network = network self.traces = traces self.info = info self.GRID = 6 self.USE_GPU = False self.ax = self.fig.add_subplot(111, projection='3d', xticks=ticks, yticks=ticks, zticks=ticks) self.ax.mouse_init(zoom_btn=None) self.ax.set_xlabel(r'$\Delta\theta_{12}$', fontsize=15) self.ax.set_ylabel(r'$\Delta\theta_{13}$', fontsize=15) self.ax.set_zlabel(r'$\Delta\theta_{14}$', fontsize=15) self.ax.set_xlim(0., 1.) self.ax.set_ylim(0., 1.) self.ax.set_zlim(0., 1.) #self.fig.tight_layout() self.ax.autoscale(False) self.key_func_dict.update(dict( u=torus.increase_grid, i=torus.decrease_grid, R=torus.show_torus, E=torus.reset_torus, g=torus.switch_processor, v=torus.reset_view)) self.fig.canvas.mpl_connect('button_press_event', self.click_torus) self.fig.canvas.mpl_connect('axes_enter_event', self.focus_in)
Example #11
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, phase_potrait, network, info=None, position=None): self.system = phase_potrait self.network = network self.CYCLES = 10 self.info = info self.initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand(), pl.rand()) self.fig = pl.figure('Voltage Traces', figsize=(6, 2), facecolor='#EEEEEE') self.ax = self.fig.add_subplot(111, frameon=False, yticks=[]) self.li_b, = self.ax.plot([], [], 'b-', lw=2.) self.li_g, = self.ax.plot([], [], 'g-', lw=2.) self.li_r, = self.ax.plot([], [], 'r-', lw=2.) self.li_y, = self.ax.plot([], [], 'y-', lw=2.) self.ax.set_xlabel(r'time (sec.)', fontsize=20) self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_xlim(0., 100.) self.ax.set_ylim(-8.5, 1.5) #self.fig.tight_layout() self.key_func_dict = dict(u=traces.increase_cycles, i=traces.decrease_cycles) self.fig.canvas.mpl_connect('key_press_event', self.on_key) self.fig.canvas.mpl_connect('axes_enter_event', self.focus_in) if not position == None: try: self.fig.canvas.manager.window.wm_geometry(position) except: pass
Example #12
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, system, network, traces, info=None, position=None): torus_2D.torus_2D.__init__(self, system, network, traces, info, position)
Example #13
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def computeTraces(self, initial_condition=None, plotit=True): if initial_condition == None: initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand()) V_i = fh.integrate_three_rk4( initial_condition, self.network.coupling_strength, self.system.dt/float(self.system.stride), self.system.N_output(self.CYCLES), self.system.stride) t = self.system.dt*np.arange(V_i.shape[0]) if plotit: ticks = np.asarray(t[::t.size/10], dtype=int) xscale, yscale = t[-1], 2. for (i, li) in enumerate([self.li_b, self.li_g, self.li_r]): tj, Vj = tl.adjustForPlotting(t, V_i[:, i], ratio=xscale/yscale, threshold=0.05*xscale) li.set_data(tj, Vj-i*2) self.ax.set_xticks(ticks) self.ax.set_xticklabels(ticks) self.ax.set_xlim(t[0], t[-1]) self.fig.canvas.draw() return t, V_i
Example #14
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, system, network, info=None, position=None): win.window.__init__(self, position) self.system = system self.network = network self.info = info self.CYCLES = 20 self.ax = self.fig.add_subplot(111, frameon=False, yticks=[]) self.li_b, = self.ax.plot([], [], 'b-', lw=2.) self.li_g, = self.ax.plot([], [], 'g-', lw=2.) self.li_r, = self.ax.plot([], [], 'r-', lw=2.) self.ax.set_xlabel(r'time (sec.)', fontsize=20) self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_xlim(0., 100.) self.ax.set_ylim(-5.5, 1.5) #self.fig.tight_layout() self.key_func_dict = dict(u=traces.increaseCycles, i=traces.decreaseCycles) self.fig.canvas.mpl_connect('axes_enter_event', self.focusIn) self.computeTraces()
Example #15
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def computePhaseTrace_gpu(self, X): X = X.flatten() V_all = model.cuda_integrate_four_rk4(X, self.network.get_coupling(), self.dt/float(self.stride), self.N_output, self.stride) V_all = np.swapaxes(V_all, 1, 2) # V_all[initial condition, voltage trace, time index] return distribute.distribute(self(type).phaseTrace_gpu, 'i', range(V_all.shape[0]), kwargs={'V': V_all})
Example #16
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, system, network, info=None, position=None): win.window.__init__(self, position) self.system = system self.network = network self.info = info self.CYCLES = 20 self.ax = self.fig.add_subplot(111, frameon=False, yticks=[]) self.li_b, = self.ax.plot([], [], 'b-', lw=2.) self.li_g, = self.ax.plot([], [], 'g-', lw=2.) self.li_r, = self.ax.plot([], [], 'r-', lw=2.) self.ax.set_xlabel(r'time (sec.)', fontsize=20) self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_xlim(0., 100.) self.ax.set_ylim(-5.5, 1.5) #self.fig.tight_layout() self.key_func_dict = dict(u=traces.increaseCycles, i=traces.decreaseCycles) self.fig.canvas.mpl_connect('axes_enter_event', self.focusIn) self.computeTraces()
Example #17
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, phase_potrait, network, info=None, position=None): self.system = phase_potrait self.network = network self.CYCLES = 10 self.info = info self.initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand(), pl.rand()) self.fig = pl.figure('Voltage Traces', figsize=(6, 2), facecolor='#EEEEEE') self.ax = self.fig.add_subplot(111, frameon=False, yticks=[]) self.li_b, = self.ax.plot([], [], 'b-', lw=2.) self.li_g, = self.ax.plot([], [], 'g-', lw=2.) self.li_r, = self.ax.plot([], [], 'r-', lw=2.) self.li_y, = self.ax.plot([], [], 'y-', lw=2.) self.ax.set_xlabel(r'time (sec.)', fontsize=20) self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_xlim(0., 100.) self.ax.set_ylim(-0.06-0.18, 0.04) self.fig.tight_layout() self.key_func_dict = dict(u=traces.increase_cycles, i=traces.decrease_cycles) self.fig.canvas.mpl_connect('key_press_event', self.on_key) self.fig.canvas.mpl_connect('axes_enter_event', self.focus_in) if not position == None: try: self.fig.canvas.manager.window.wm_geometry(position) except: pass
Example #18
Source File: torus_2D.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def compute_phase_trace_gpu(self, X): X = X.flatten() V_all = type(self).model.cuda_integrate_three_rk4(X, self.network.coupling_strength, self.dt/float(self.stride), self.N_output, self.stride) V_all = np.swapaxes(V_all, 1, 2) # V_all[initial condition, voltage trace, time index] return distribute.distribute(self.phase_trace_gpu, 'i', range(V_all.shape[0]), kwargs={'V': V_all})
Example #19
Source File: torus_2D.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def phase_trace_cpu(self, i, X): V_i = np.transpose( type(self).model.integrate_three_rk4( X[i, :], self.network.coupling_strength, self.dt/float(self.stride), self.N_output, self.stride)) ti, d = tl.phase_difference(V_i, V_trigger=type(self).V_trigger) return d
Example #20
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, system, network, traces, info=None, position=None): torus_2D.torus_2D.__init__(self, system, network, traces, info, position) self.ax_traces.set_xlabel(r'phase difference $\Delta\theta_{12}$', fontsize=20) self.ax_traces.set_ylabel(r'phase difference $\Delta\theta_{13}$', fontsize=20) self.ax_basins.set_xlabel(r'phase difference $\Delta\theta_{12}$', fontsize=20)
Example #21
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, system, network, info=None, position=None): win.window.__init__(self, position) self.system = system self.network = network self.info = info self.CYCLES = 8 self.state = system.load_initial_condition( pl.rand(), pl.rand() ) self.initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand()) self.running = False self.pulsed = 0 self.ax = self.fig.add_subplot(111, frameon=False, yticks=[]) self.li_b, = self.ax.plot([], [], 'b-', lw=1.) self.li_g, = self.ax.plot([], [], 'g-', lw=1.) self.li_r, = self.ax.plot([], [], 'r-', lw=1.) self.ax.set_xlabel(r'time (sec.)', fontsize=20) self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15) self.ax.set_xlim(0., 100.) self.ax.set_ylim(-0.06-0.12, 0.04) self.key_func_dict.update(u=traces.increase_cycles, i=traces.decrease_cycles) #self.fig.canvas.mpl_connect('button_press_event', self.on_click) self.fig.canvas.mpl_connect('axes_enter_event', self.focus_in)
Example #22
Source File: torus.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def __init__(self, system, network, traces, info=None, position=None): torus_2D.torus_2D.__init__(self, system, network, traces, info, position)
Example #23
Source File: traces.py From Motiftoolbox with GNU General Public License v2.0 | 5 votes |
def computeTraces(self, initial_condition=None, plotit=True): if initial_condition == None: initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand()) V_i = fh.integrate_three_rk4( initial_condition, self.network.coupling_strength, self.system.dt/float(self.system.stride), self.system.N_output(self.CYCLES), self.system.stride) t = self.system.dt*np.arange(V_i.shape[0]) if plotit: ticks = np.asarray(t[::t.size/10], dtype=int) xscale, yscale = t[-1], 2. for (i, li) in enumerate([self.li_b, self.li_g, self.li_r]): tj, Vj = tl.adjustForPlotting(t, V_i[:, i], ratio=xscale/yscale, threshold=0.05*xscale) li.set_data(tj, Vj-i*2) self.ax.set_xticks(ticks) self.ax.set_xticklabels(ticks) self.ax.set_xlim(t[0], t[-1]) self.fig.canvas.draw() return t, V_i