GithubHelp home page GithubHelp logo

snnlibpy's Issues

Plotting Spikes,weights,Performance

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" )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.