Git Product home page Git Product logo

handwriting-generation's People

Contributors

grzego avatar kristofbc 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

handwriting-generation's Issues

Extension of code for other language generation

Hey
What changes need to be made to enable training for other languages, other than the training data? I can see some style files being used, does that need to change as well? In which case, could you share how the style.npy files were created.

Error in running train.py

Hi! 👋

I'm following your instructions in README.md to get things running. For context: I'm running on a Microsoft Azure GPU, using Tensorflow 1.5 and Python 3.5. When I run python train.py, I'm getting the following error:

Traceback (most recent call last):
  File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/home/jameso2/handwriting-generation/.env/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/jameso2/handwriting-generation/.env/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

What could be causing this?

Thank you for this awesome work! 😊

Issue in running the train.py file

Hi @Grzego,

I am trying to run the train.py (python train.py) file on the same IAM Online handwriting dataset. But getting some error (using tf 1.15)

image

Thank you for your help!!

bavariate_normal

def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
                     mux=0.0, muy=0.0, sigmaxy=0.0):
    """
    Bivariate Gaussian distribution for equal shape *X*, *Y*.
    See `bivariate normal
    <http://mathworld.wolfram.com/BivariateNormalDistribution.html>`_
    at mathworld.
    """
    Xmu = X-mux
    Ymu = Y-muy

    rho = sigmaxy/(sigmax*sigmay)
    z = Xmu**2/sigmax**2 + Ymu**2/sigmay**2 - 2*rho*Xmu*Ymu/(sigmax*sigmay)
    denom = 2*np.pi*sigmax*sigmay*np.sqrt(1-rho**2)
    return np.exp(-z/(2*(1-rho**2))) / denom

this function is depricated, just included it in the generate file and should do the work for you.

Error - "Cannot convert a symbolic Tensor to a numpy array" while running train.py

Greetings Sir
Thank a lot for providing such a nice implementation. However, I was facing some issues while implementing the code.
First of all in new numpy version allow_pickle is False by default so I solved one of the error by using allow_pickle=True in np.load statements in batch_generator.py

However, while trying to run train.py I am getting an error "NotImplementedError: Cannot convert a symbolic Tensor (model/rnn_1/while/rnn/rnn_model/window/add_1:0) to a numpy array."

2

This is same error I am getting while trying to use pretrained model

I am using Tensorflow 1.15.2 and numpy 1.19.5 and running on Google Colab

Arabic

It's a great project,

Is the Arabic language included?

Trouble displaying output

I am following the instructions in the README to generate handwriting. When I enter the command:
python generate.py --noinfo --text="this was generated by computer" --bias=1.

I get the following error:

Traceback (most recent call last):
File "generate.py", line 247, in
main()
File "generate.py", line 202, in main
fig, ax = plt.subplots(1, 1)
File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/matplotlib/pyplot.py", line 1176, in subplots
fig = figure(**fig_kw)
File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/matplotlib/pyplot.py", line 539, in figure
**kwargs)
File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 171, in new_figure_manager
return cls.new_figure_manager_given_figure(num, fig)
File "/home/jameso2/handwriting-generation/.env/local/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 1049, in new_figure_manager_given_figure
window = Tk.Tk(className="matplotlib")
File "/usr/lib/python3.5/tkinter/init.py", line 1871, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

For context, I am running the code on a Linux virtual machine with Ubuntu. My laptop is a MacBook.

Any idea how to resolve this? I'd appreciate any help!

Tensorflow2.x version compatible

Thank you for this great work :)

When I try to run the code, I am getting many errors because of new TensorFlow 2.x changes. So, I tried to use tf_upgrade_v2 script, but still, I get an error and not sure how to proceed,

More specifically: Substructure "type=LSTMStateTuple str=LSTMStateTuple(c=<tf.Tensor 'rnn/rnn_model/lstm_0/lstm_cell/add_1:0' shape=(64, 400) dtype=float32>, h=<tf.Tensor 'rnn/rnn_model/lstm_0/lstm_cell/mul_2:0' shape=(64, 400) dtype=float32>)" is a sequence, while substructure "type=ResourceVariable str=<tf.Variable 'model/rnn/Variable:0' shape=(64, 400) dtype=float32>" is not
Entire first structure:
[., (.,), [LSTMStateTuple(c=., h=.), LSTMStateTuple(c=., h=.), LSTMStateTuple(c=., h=.), ., ., .]]
Entire second structure:
[., (.,), [., ., ., ., ., ., ., ., .]]

It would be great if anyone give comments to reproduce this work in Tensorflow2.x

Online handwriting

Would it be possible to output the text along a straight(er) line with this configuration?

data can't be downloaded

The data on this link: data/original-xml-part.tar.gz cannot be downloaded it's asking for username and password credentials. Is there another place where it can be found?

Training numbers

This is probably outside the scope of the "issues" but figure I'd ask.
I notice it doesn't take numbers. Is there away to add numbers to the xml data sets so it can also do numbers?

Cannot Restore Pretrained Model

Hello,

First off, I would like to thank you for this amazing work. I was giving it a go hoping to directly use your pretrained model. However, I ran into the following error upon doing generate.py --text="this was generated by computer" --bias=1. Any help will be greatly appreciated.
I think it might be a renaming of some variables in the checkpoint file ?

NotFoundError: Key rnnlm/multi_rnn_cell/cell_10/basic_lstm_cell/bias/Adam_1 not found in checkpoint
	 [[Node: save/RestoreV2_17 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_17/tensor_names, save/RestoreV2_17/shape_and_slices)]]

During handling of the above exception, another exception occurred:

NotFoundError                             Traceback (most recent call last)
/data.nfs/leo/handwriting-generation/generate.py in <module>()
    244 
    245 if __name__ == '__main__':
--> 246     main()

/data.nfs/leo/handwriting-generation/generate.py in main()
    132     with tf.Session(config=config) as sess:
    133         saver = tf.train.import_meta_graph(args.model_path + '.meta')
--> 134         saver.restore(sess, args.model_path)
    135 
    136         while True:

/data/dss-data-dir/code-envs/python/test_py3/lib/python3.6/site-packages/tensorflow/python/training/saver.py in restore(self, sess, save_path)
   1558     """
   1559     meta_graph.add_collection_def(meta_graph_def, key,
-> 1560                                   export_scope=export_scope)
   1561 

I am also running tensorflow 1.2.0

Extension to other languages

Hello, I am interested in training the model to other languages such as Spanish and Turkish but not sure how to generate the strokes sequence.Any help will be highly appreciated.
Thanks

NAN loss value

After successfully implementing the training I find that starting at Epoch 18 the loss value is set to NAN and all the models created are of no use.

Is there any way to save all models such that the ones where loss is not NAN they can be used for generation.

Can the system be trained to imitate a SINGLE PERSON's handwriting?

Thanks.

Tensorflow 2 version

Does anybody have the code converted to native Tensorflow 2 (without using tf.compat.v1) version?

Convert to tflite

What are the input and output nodes of the model, these are required while i am converting the model to .tflite .

No animation seen on mac

I see no difference, irrespective of wheather option --animation is given or not.
Generative for pretrained model.
My python version is 3.4.2
My OS-X version is 1.13.6

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.