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

how to predict #11

Open
mechi33 opened this issue Jun 29, 2018 · 3 comments
Open

how to predict #11

mechi33 opened this issue Jun 29, 2018 · 3 comments

Comments

@mechi33
Copy link

mechi33 commented Jun 29, 2018

Hi,
thank you for the nice implementation.

Regarding predict, should I use Tensorflow original version?
(https://github.com/santi-pdp/segan/blob/master/main.py)

Your REDADME explain only about training, so let me confirm how to predict the model.

Regards,

@dansuh17
Copy link
Owner

dansuh17 commented Jun 29, 2018

By prediction, do you mean predicting whether an audio is noisy or not? (discriminator) Or, do you mean denoising? (generator) Either case, you can load the models saved at the end of every epoch using torch.load().

discriminator = torch.load('discriminator-5.pkl')
output = discriminator(audio)

@mechi33
Copy link
Author

mechi33 commented Jul 3, 2018

Thank you very much for your kind reply.
I tried your code below and face error.

gen=torch.load('generator-7.pkl')
nois_data='p232_001.wav'
output=gen(nois_data)

TypeError: 'collections.OrderedDict' object is not callable

Could you give some advice on this?

Thanks,

@dansuh17
Copy link
Owner

dansuh17 commented Jul 3, 2018

My bad. Since we're saving the .state_dict(), you should load the state_dict.

# the model should have all parameters loaded
model.load_state_dict('generator-7.pkl')

From ImageNet example

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