Giter Club home page Giter Club logo

handwritten-tf-1.0's Introduction

Ion Mosnoi - Machine Learning Engineer

Recent projects

  • Generate newsletter from news articles
  • Generate romantic stories from user feedback
  • Generate 1k exam questions per hours using gpt4 and langchain
  • Discuss with pdf and excel files
  • Developed handwiting recognition models for back cheque data extraction
  • Developed Supervised and Unsupervised models for multi language document processing
  • Developed models for user segmentation in medical apps
  • Created Open-source name entity recognition annotation tools for jupyter
  • Developed active learning models for named entity recognition

Connect with me

ion | LinkedIn

Languages and Tools

Python

C++

Docker

Linux

PyTorch

Keras

OpenCV



twitter youtube linkedin devdotto telegram views

stats

languages

handwritten-tf-1.0's People

Contributors

johnsmithm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

handwritten-tf-1.0's Issues

why use slices ?

hello, @johnsmithm , I found you use slices to cut the original input image to a pack of slices, why not just use CNN stride param to represent the sliding windows?

And when you use slices, how to handle the labels? It's hard to align each slice with a correct label.

loss is high

Why is the loss so high in the training? I have resized images to (36,90). it's around 76-88.

InvalidArgumentError: Number of float values != expected. Values size: 3456000 but output shape: [3240]

Hi I created tfrecords. Then i ran tried to train the model. But I am getting below error. I tried to debug the code but i am not able to do so.

Error:
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, Name: , Key: imageInput, Index: 0. Number of float values != expected. Values size: 3456000 but output shape: [3240]
[[Node: test_input/ParseExample_1/ParseExample = ParseExample[Ndense=2, Nsparse=1, Tdense=[DT_FLOAT, DT_INT64], dense_shapes=[[3240], [1]], sparse_types=[DT_INT64], _device="/job:localhost/replica:0/task:0/cpu:0"](test_input/ReaderReadUpToV2_1:1, test_input/ParseExample_1/ParseExample/names, test_input/ParseExample_1/ParseExample/sparse_keys_0, test_input/ParseExample_1/ParseExample/dense_keys_0, test_input/ParseExample_1/ParseExample/dense_keys_1, test_input/ParseExample_1/Const, test_input/ParseExample_1/Const_1)]]

Caused by op u'test_input/ParseExample_1/ParseExample', defined at:
File "train.py", line 818, in
app.run()
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "train.py", line 806, in main
FLAGS.export_model_steps).run(start_new_model=FLAGS.start_new_model)
File "train.py", line 435, in run
saver = self.build_model(self.model, self.reader)
File "train.py", line 699, in build_model
num_epochs=FLAGS.num_epochs)
File "train.py", line 280, in build_graph
num_epochs=num_epochs,nameT='test'))
File "train.py", line 200, in get_input_data_tensors
reader.prepare_reader(filename_queue,batch_size) for _ in range(num_readers)
File "/media/nikhil/Data/Experiments/Handwritten text Extraction/handwriting Extraction Codes/handwritten-tf-1.0-master/readers.py", line 81, in prepare_reader
return self.prepare_serialized_examples(serialized_examples)
File "/media/nikhil/Data/Experiments/Handwritten text Extraction/handwriting Extraction Codes/handwritten-tf-1.0-master/readers.py", line 114, in prepare_serialized_examples
features = tf.parse_example(serialized_examples, features=feature_map)
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/ops/parsing_ops.py", line 563, in parse_example
dense_types, dense_defaults, dense_shapes, name)
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/ops/parsing_ops.py", line 688, in _parse_example_raw
name=name)
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/ops/gen_parsing_ops.py", line 178, in _parse_example
dense_shapes=dense_shapes, name=name)
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op
op_def=op_def)
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2336, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/nikhil/anaconda/envs/tfone/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1228, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Name: , Key: imageInput, Index: 0. Number of float values != expected. Values size: 3456000 but output shape: [3240]

command to train
python train.py --slices 26 --width 12 --stride 3 --Bwidth 90 --train_data_pattern batch/tf-data-40x320-81/handwritten-test-{}.tfrecords --train_dir separable_lstm --test_data_pattern batch/tf-data-40x320-81/handwritten-test-{}.tfrecords --max_steps 6000 --batch_size 20 --beam_size 3 --input_chanels 1 --model MDLSTMCTCModel --base_learning_rate 0.001 --num_readers 2 --export_model_steps 500 --display_step 10 --display_step_lme 100 --start_new_model

Please help

Epoch limit reached

I am running the following :
python train.py --slices 55 --width 12 --stride 1 --Bwidth 350 --vocabulary_size 29
--height 25 --train_data_pattern ./tf-data/handwritten-test-{}.tfrecords --train_dir models-feds
--test_data_pattern ./tf-data/handwritten-test-{}.tfrecords --max_steps 20 --batch_size 20 --beam_size 1
--input_chanels 1 --start_new_model --rnn_cell LSTM --model LSTMCTCModel --num_epochs 6000

Ouput
FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
INFO:tensorflow:/job:master/task:0: Tensorflow version: 1.1.0.
(8750, '', 25, 350, 1)
[20, 25, 350, 1]
0
[20, 25, None, 1]
INFO:tensorflow:/job:master/task:0: Removing existing train directory.
INFO:tensorflow:/job:master/task:0: Flag 'start_new_model' is set. Building a new model.
INFO:tensorflow:Using batch size of 20 for training.
tf-data/handwritten-test-{}.tfrecords
INFO:tensorflow:Number of training files: 3.
(8750, '
', 25, 350, 1)
(8750, '', 25, 350, 1)
INFO:tensorflow:Using batch size of 20 for testing.
tf-data/handwritten-test-{}.tfrecords
INFO:tensorflow:Number of testing files: 3.
(8750, '
', 25, 350, 1)
(8750, '********************', 25, 350, 1)
Tensor("Reshape:0", shape=(20, 25, 350, 1), dtype=float32)
[20, 25, 350, 1]
0
[20, 25, None, 1]
INFO:tensorflow:/job:master/task:0: Starting managed session.
2018-03-19 18:25:13.630111: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-03-19 18:25:13.630151: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-03-19 18:25:13.630159: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2018-03-19 18:25:13.630174: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2instructions, but these are available on your machine and could speed up CPU computations.
2018-03-19 18:25:13.630180: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2018-03-19 18:25:16.371931: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-03-19 18:25:16.372284: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 with properties:
name: Tesla K80
major: 3 minor: 7 memoryClockRate (GHz) 0.8235
pciBusID 0000:00:1e.0
Total memory: 11.17GiB
Free memory: 11.10GiB
2018-03-19 18:25:16.372318: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0
2018-03-19 18:25:16.372332: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0: Y
2018-03-19 18:25:16.372347: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0)
INFO:tensorflow:/job:master/task:0: Entering training loop.
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:models-feds/model.ckpt-0 is not in all_model_checkpoint_paths. Manually adding it.
2018-03-19 18:25:19.788531: W tensorflow/core/kernels/queue_base.cc:302] _3_test_input/shuffle_batch_join/random_shuffle_queue: Skipping cancelled dequeue attempt with queue not closed
2018-03-19 18:25:19.789465: W tensorflow/core/kernels/queue_base.cc:302] _3_test_input/shuffle_batch_join/random_shuffle_queue: Skipping cancelled dequeue attempt with queue not closed
INFO:tensorflow:/job:master/task:0: Done training -- epoch limit reached.
INFO:tensorflow:/job:master/task:0: Exited training loop.

Not able to tun the program

When I tried running the given commad I got following on the screen...Its not running and repeating the same

INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:separable_lstm/model.ckpt-0 is not in all_model_checkpoint_paths. Manually adding it.
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:separable_lstm/model.ckpt-0 is not in all_model_checkpoint_paths. Manually adding it.
INFO:tensorflow:global_step/sec: 0

Vocabulary Contents

What does vocabulary.txt contain? Do they contain encoded words? Do they contain encoded characters? How was that generated?

Unable to find tfrecords needed for Training

I tried to execute the command for training but it is unable to find the tfrecord files needed

NewRandomAccessFile failed to Create/Open: ../tf-data/handwritten-test-54.tfrecords : The system cannot find the path specified.

How do I make the tfrecord files needed for training and testing? :O

Documentation lack

Peace be upon you,
@johnsmithm

  • What are the required dependencies/prerequisite?

  • is there nhidden option for training, LSTM units in hidden layer?

  • How to train .txt/png pairs?
    example data: Arabic example data.zip

  • How to use the trained model to ocr some images?

  • Can your software conduct line/layout segmentation & binarization?

Problem in code execution :: epoch limit reached error

I created tfrecords file and tried to run this below command.

python train.py --slices 26 --width 12 --stride 3 --Bwidth 90 --train_data_pattern batch/tf-data-40x320-81/handwritten-test-{}.tfrecords --train_dir separable_lstm --test_data_pattern batch/tf-data-40x320-81/handwritten-test-{}.tfrecords --max_steps 6000 --batch_size 20 --beam_size 3 --input_chanels 1 --model MDLSTMCTCModel --base_learning_rate 0.001 --num_readers 2 --export_model_steps 500 --display_step 10 --display_step_lme 100 --start_new_model


I get this below output:: simply throws exception as epoch limit reached

name: GeForce 940MX
major: 5 minor: 0 memoryClockRate (GHz) 1.2415
pciBusID 0000:01:00.0
Total memory: 1.96GiB
Free memory: 1.59GiB
2018-01-04 18:22:40.984476: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0
2018-01-04 18:22:40.984483: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0: Y
2018-01-04 18:22:40.984492: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0)
INFO:tensorflow:/job:master/task:0: Entering training loop.
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:separable_lstm/model.ckpt-0 is not in all_model_checkpoint_paths. Manually adding it.
2018-01-04 18:22:42.531717: W tensorflow/core/kernels/queue_base.cc:302] _3_test_input/shuffle_batch_join/random_shuffle_queue: Skipping cancelled dequeue attempt with queue not closed
2018-01-04 18:22:42.532438: W tensorflow/core/kernels/queue_base.cc:302] _3_test_input/shuffle_batch_join/random_shuffle_queue: Skipping cancelled dequeue attempt with queue not closed
INFO:tensorflow:/job:master/task:0: Done training -- epoch limit reached.
INFO:tensorflow:/job:master/task:0: Exited training loop.
(py27_tensorflow_gpu1.1) mlx@mlx-icr:~/Tensorflow_codes/tensorflow_intellichars/handwritten-tf-1.0-master$


Please help

makeTFRecords generates TFRecords with 0 bytes

I ran makeTFRecords.ipynb to generate the TFRecords needed for training after the modification made to it in this commit . But it gives me errors in this line:

for ii in range(batchSize): if totalI[ii].shape[0] < 50 or totalI[ii].shape[0] > 200 or \ totalI[ii].shape[1]<10 or totalI[ii].shape[1]>40: print('error!!') continue

I downloaded the handwriting images and xmls needed to make the TFRecords from IAM. I'm using Tensoflow 1.2.1 and the OS of my machine is Windows.

is the lstm2d the true mdlstm ?

I see you have changed the mdlstm to lstm2d, but I think the lstm2d implemented by tensorflow does not consider the both dimension as introduced by Alex Graves. Have you tested its accuracy?

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.