Coder Social home page Coder Social logo

Comments (24)

frereit avatar frereit commented on August 16, 2024

Hello. I suspect a problem with how you preprocessed the data. Did you follow my tutorial Preprocessing the data to generate the .npy files? If you want to, you can e-mail me your .npy data, and I will check them to make sure they are correct.

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Could you run this script and send me the output?

import numpy as np
images = np.load("nist_images_32x32.npy")
labels = np.load("nist_labels_32x32.npy")
print(images.shape)
print(labels.shape)

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Okay, thank you. I will recreate that and check if I get it to work with the latest commit. I'll get back to you later.

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Yeah, that seems correct. I'll check my code; I was messing around with it to test some new stuff, maybe I accidentally committed non-functional code.

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Hmm. So I just ran rename_images.py and the script I asked you to run, and my output is:

(101784, 32, 32, 1)
(101784, 47)

I wonder if there is a difference between running that script on Linux and Windows, but a difference of 1 image cannot affect the accuracy. I'll run the training for 15,000 epochs. Currently, I suspect that the optimizer is configured faulty; Maybe the learning rate is too low. Did you run training_32x32.py with the default learning rate of 0.001?

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Huh, after only 800 steps with the latest public training_32x32.py I got an accuracy of 60.5%. I'll check the script on Linux now, but at least on windows, the newest commit is working fine.

2018-04-14T14:34:58.860221 Loading data...
2018-04-14T14:34:59.305223 Data loaded... Shuffling...
2018-04-14T14:34:59.774221 Shuffled!
2018-04-14T14:34:59.774221 Performed train-test split
2018-04-14T14:35:00.380722 Model created!
2018-04-14T14:35:01.430837 Variables initialized!
2018-04-14T14:35:01.430837 Training for 15000 epochs.
2018-04-14T14:35:03.682129 Step: 0; Accuracy: 0.06;
2018-04-14T14:36:14.368702 Step: 200; Accuracy: 0.15; Time (200 Steps): 70.6860728263855
2018-04-14T14:37:25.080658 Step: 400; Accuracy: 0.38; Time (200 Steps): 70.71145606040955
2018-04-14T14:38:35.513445 Step: 600; Accuracy: 0.42; Time (200 Steps): 70.43228793144226
2018-04-14T14:39:45.505531 Step: 800; Accuracy: 0.52; Time (200 Steps): 69.99208521842957
2018-04-14T14:40:55.696452 Step: 1000; Accuracy: 0.605; Time (200 Steps): 70.19092130661011

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Are you using tensorflow cpu or tensorflow gpu with cuDNN?

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Okay. Yes, I am talking about the commit from 29 days ago. About the small change in cross entropy calculation:
I used _v2(), because tensorflow was giving me a Warning that nn.softmax_cross_entropy_with_logits() was deprecated:

WARNING:tensorflow:From training_32x32.py:161: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See tf.nn.softmax_cross_entropy_with_logits_v2.

I now switched it back to tf.nn.softmax_cross_entropy_with_logits and I still achieve a 25% accuracy after only 400 epochs. Since you dind't find nn.softmax_cross_entropy_with_logits_v2(), maybe your tensorflow version is outdated? For me, python -c "import tensorflow as tf; print(tf.__version__)" in terminal returns 1.6.0.

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Okay, I now committed a model which works with the graph from the latest commit. It was trained over 15,000 epochs and has reached the best accuracy I was able to achieve with my computing power and experience: 0.85. I trained this model on Linux with the tensorflow CPU version.
I'd still be interested in your tensorflow version python -c "import tensorflow as tf; print(tf.__version__)", because I am very interested in your problem.

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

from tensorflowhandwritingrecognition.

frereit avatar frereit commented on August 16, 2024

Hmm. Maybe that is the problem, but I doubt it. There has to be some problem on your side as I just confirmed the code is working fine with tensorflow CPU on windows and Linux (Ubuntu) and tensorflow GPU on windows. I didn't check tensorflow GPU on Linux, because I couldn't get it to work.

from tensorflowhandwritingrecognition.

garchit33 avatar garchit33 commented on August 16, 2024

@IshanBhattOfficial I got an error :

File "F:\TensorflowHandwritingRecognition-master\training_32x32.py", line 211, in
main()
File "F:\TensorflowHandwritingRecognition-master\training_32x32.py", line 184, in main
epochs = int(sys.argv[1])
IndexError: list index out of range

Can you please help me with this asap.

from tensorflowhandwritingrecognition.

ivbhatt avatar ivbhatt commented on August 16, 2024

Have you specified "number of epochs" as a command line argument?
It looks like you're using Windows (and an IDE)
If using PyCharm, here's how to specific command line arguments:

https://i.stack.imgur.com/6KQF2.gif

For other IDE, a quick Google search should cut it.

from tensorflowhandwritingrecognition.

garchit33 avatar garchit33 commented on August 16, 2024

Got it ... Thanks!!

from tensorflowhandwritingrecognition.

garchit33 avatar garchit33 commented on August 16, 2024

@IshanBhattOfficial Have you got the correct accuracy.....How much you have got??

from tensorflowhandwritingrecognition.

sanksys avatar sanksys commented on August 16, 2024

@frereit
i got below error in training_32x32.py

2019-01-23T16:39:17.376486 Loading data...
2019-01-23T16:39:30.611663 Data loaded... Shuffling...
2019-01-23T16:39:31.936904 Shuffled!
2019-01-23T16:39:31.937902 Performed train-test split
2019-01-23T16:39:32.497435 Model created!
2019-01-23T16:39:40.379682 Variables initialized!
2019-01-23T16:39:40.379682 Training for 15000 epochs.
Traceback (most recent call last):

File "", line 222, in
main()

File "", line 199, in main
summary, _ = sess.run([merged, train], feed_dict={x: batch[0], y_true: batch[1], hold_prob: 0.5})
InvalidArgumentError: You must feed a value for placeholder tensor 'x' with dtype float and shape [?,32,32,1]
[[Node: x = Placeholderdtype=DT_FLOAT, shape=[?,32,32,1], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

i have attached the variable explorer image
i am using Anaconda Spyder with python 3.6 and TF 1.10.0
image

from tensorflowhandwritingrecognition.

Related Issues (9)

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.