Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about the test mode #372

Closed
XDUSPONGE opened this issue May 18, 2020 · 3 comments
Closed

about the test mode #372

XDUSPONGE opened this issue May 18, 2020 · 3 comments

Comments

@XDUSPONGE
Copy link

First, thanks very much for your shared code
When I run the code as ptyhon ethmnist.py
I find for the dataloader the training_data is the same with the test_data
So, if there is anything wrong?
And my env is
pytorch 1.4
cuda10.1

@Hananel-Hazan
Copy link
Collaborator

Hi, thank you for using BindNET.

You need to create another dataloader with the option of train=False, and then use this object in your testing loop.

For example:

# Load MNIST data.
test_dataset = MNIST(
    PoissonEncoder(time=time, dt=dt),
    None,
    root=os.path.join("..", "..", "data", "MNIST"),
    download=True,
    train=False,
    transform=transforms.Compose(
        [transforms.ToTensor(), transforms.Lambda(lambda x: x * intensity)]
    ),
)

@XDUSPONGE
Copy link
Author

hello, thanks for your reply, as the paper says,

After trianing is done, we set the learning rate to zero, fix each neuron's spiking threshould, and assign a class to each neuron, based on its highest response to the ten classes of digits over one presentation of the training seet

so the whole pipeline I understood is

train_dataloader = 
test_dataloader = 
for epoch in range(n_epochs):
	# training ....
	for step, batch in enumerate(tqdm(train_dataloader)):
		if uptate_inter:
			activity_pred = ..
			accuracy = ..
			assign_labels ..

		network.run(inputs)
	# testing ....
	for step, batch in enumerate(tqdom(test_dataloader)):
		if uptate_inter:
			activity_pred = ...
			accuracy = ...
			#test does not assign label
		network.run(inputs)

so my question is
how to keep the set the learning rate to zero, fix each neuron's spiking threshould afterting the training is done, the pipeline I do did not to these two things

@Hananel-Hazan
Copy link
Collaborator

Please use: network.train(mode=False) before starting the testing process. That should disable the synapses modulation.
When you want to go back and train the network use: network.train(mode=True).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants