GithubHelp home page GithubHelp logo

Comments (14)

HiroshiARAKI avatar HiroshiARAKI commented on May 26, 2024

Hi.

I have no idea about your problem completely.
So, before I answer your question, I have some questions for you.

  1. Do you know what error message said? If you know that please tell me.
  2. Do you use GPU computing??
  3. Didn't all plotting function work? (e.g. "Only Plotting spikes work properly," "only plotting weights doesn't work well, " or something like that)
  4. If your network is before training, all plotting functions work well??

that's all my questions.
If these questions' answers are crystal-clear, I may solve your problem.

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

Hi, Actually i am trying to plot these spikes after training.I am also using GPU and once training is complete, none of the spikes are generated.I didn't get any error message after training is completed.

from snnlibpy.

HiroshiARAKI avatar HiroshiARAKI commented on May 26, 2024

Hmm... I've not known well about that problem yet, but...
If you put on "plt.close()" after "plt.show()" or "plt.savefig()", how does your program work?

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

Hi,This is my code.
Can you see what's the problem in this code?

for epoch in range( args.n_epochs ):
    # Create a dataloader to iterate over dataset.
    dataloader = DataLoader(
        dataset,
        batch_size=args.batch_size,
        shuffle=True,
        num_workers=args.n_workers,
        pin_memory=args.gpu,
    )

    for step, batch in enumerate( tqdm( dataloader ) ):
        # Prep next input batch.
        inpts = {"I": batch["encoded_image"]}
        if args.gpu:
            inpts = {k: v.cuda() for k, v in inpts.items()}

        # Run the network on the input.
        network.run( inputs=inpts, time=args.time )

        # Plot simulation data.
        if args.plot:
            spikes = {}
            for name, monitor in network.monitors.items():
                spikes[name] = monitor.get( "s" )[:, 0].view( args.time, -1 )

            spike_ims, spike_axes = plot_spikes(
                spikes, ims=spike_ims, axes=spike_axes
            )

            conv1_weights_im = plot_conv2d_weights(
                conv1_connection.w, im=conv1_weights_im, wmin=-1.0, wmax=1.0
            )
            conv2_weights_im = plot_conv2d_weights(
                conv2_connection.w, im=conv2_weights_im, wmin=-1.0, wmax=1.0
            )
            dense_weights_im = plot_weights(
                dense_connection.w, im=dense_weights_im, wmin=-1.0, wmax=1.0
            )
            output_weights_im = plot_weights(
                output_connection.w, im=output_weights_im, wmin=-1.0, wmax=1.0
            )
            #plt.ioff()
           
            plt.show()
            plt.close()

        network.reset_state_variables()

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

When i run the program after calling plt.close().I had the same output and did not get any plot.
This is the output after training.
output

from snnlibpy.

HiroshiARAKI avatar HiroshiARAKI commented on May 26, 2024

Hi,
I can't find where the essential problem is.

How about that you stop giving 'im (AxesImage object)' as arguments and change to call "plt.show" or "plt.savefig()" after each plotting functions.
So, what happens if you modify a code as below.

plot_conv2d_weights(conv1_connection.w,  wmin=-1.0, wmax=1.0)
plt.savefig('****.png')
plt.close()

plot_conv2d_weights(conv2_connection.w, wmin=-1.0, wmax=1.0)
plt.savefig('****.png')
plt.close()

plot_weights(dense_connection.w, wmin=-1.0, wmax=1.0)
plt.savefig('****.png')
plt.close()

plot_weights(output_connection.w, wmin=-1.0, wmax=1.0)
plt.savefig('****.png')
plt.close()

If it does not work well, you try to do with one plotting function.
For example, only

plot_weights(output_connection.w, wmin=-1.0, wmax=1.0)
plt.savefig('****.png')
plt.close()

this code.

Maybe, this problem is about matplotlib, not bindsnet.

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

from snnlibpy.

HiroshiARAKI avatar HiroshiARAKI commented on May 26, 2024

And, check my plotting code out.

https://github.com/HiroshiARAKI/snnlibpy/blob/master/wbn/snnlib.py#L870

This code using bindsnet's plotting functions works properly on my environment.

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

from snnlibpy.

tehreemnaqvi avatar tehreemnaqvi commented on May 26, 2024

from snnlibpy.

HiroshiARAKI avatar HiroshiARAKI commented on May 26, 2024

Hi, you're welcome. Im glad to solve your problem.

from snnlibpy.

Related Issues (1)

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.