karpathy / convnetjs

Deep Learning in Javascript. Train Convolutional Neural Networks (or ordinary ones) in your browser.
MIT License
10.8k stars 2.04k forks source link

Same output with every input after exporting and using. #90

Closed dijs closed 6 years ago

dijs commented 6 years ago

I have verified the the images I am forwarding in are different. Although I am seeing the exact same weights every time I choose a different image. It is very strange...

I know I trained the network properly (for a beginner) because I calculated and saw the average cost_loss fall from ~2 to below 1. So that is great.

I feel I must be importing the network in wrong or possibly getting my predictions incorrectly.

I used the .toJSON and .fromJSON methods, just as I have seen in examples.

I can get some code examples up here, but was wondering if anyone had any ideas or if anyone had see this behavior before.

NoPinky commented 6 years ago

happened to me when I forgot to normalize the pixel data to a range from -0.5 to 0.5. Maybe it's the same with you?

dijs commented 6 years ago

I forgot to update this, glad you commented on it.

The reason I was seeing this behavior was because I trained the network with only 1 iteration... rookie mistake.

After training the data over a long period of time with random sampling, the network performed much better.

thegamecat commented 6 years ago

Can you share some examples of the to and from? I'm not convinced this is working.