hiroshiaraki / snnlibpy Goto Github PK
View Code? Open in Web Editor NEWA tiny Spiking neural network library implemented by BindsNet.
A tiny Spiking neural network library implemented by BindsNet.
Hi,
I just started to follow your repository.You have done very well.
So, I wanted to plot my input spikes,weight and model performance but after training my plot didn't show.
I am confused how to solve this issue Can you tell me, how can I fix this issue?
My code is like this:
for epoch in range( n_epochs ):
if epoch % progress_interval == 0:
print( "Progress: %d / %d (%.4f seconds)" % (epoch, n_epochs, t() - start) )
start = t()
train_dataloader = torch.utils.data.DataLoader(
train_dataset, batch_size=1, shuffle=True)
for step, batch in enumerate( train_dataloader ):
# Get next input sample.
inputs = {"X": batch["encoded_image"].view( time, 1, 1, 28, 28 )}
if gpu:
inputs = {k: v.cuda() for k, v in inputs.items()}
label = batch["label"]
# Run the network on the input.
network.run( inputs=inputs, time=time, input_time_dim=1 )
# Optionally plot various simulation information.
if plot:
image = batch["image"].view( 28, 28 )
inpt = inputs["X"].view( time, 784 ).sum( 0 ).view( 28, 28 )
weights1 = conv_conn.w
_spikes = {
"X": spikes["X"].get( "s" ).view( time, -1 ),
"Y": spikes["Y"].get( "s" ).view( time, -1 ),
}
_voltages = {"Y": voltages["Y"].get( "v" ).view( time, -1 )}
inpt_axes, inpt_ims = plot_input(
image, inpt, label=label, axes=inpt_axes, ims=inpt_ims
)
spike_ims, spike_axes = plot_spikes( _spikes, ims=spike_ims, axes=spike_axes )
weights1_im = plot_conv2d_weights( weights1, im=weights1_im )
voltage_ims, voltage_axes = plot_voltages(
_voltages, ims=voltage_ims, axes=voltage_axes
)
#plt.ioff()
#plt.show()
plt.ioff()
# plt.pause( 1 )
plt.show()
network.reset_state_variables() # Reset state variables.
print( "Progress: %d / %d (%.4f seconds)\n" % (n_epochs, n_epochs, t() - start) )
print( "Training complete.\n" )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.