TextRecognitionDataGenerator icon indicating copy to clipboard operation
TextRecognitionDataGenerator copied to clipboard

Missing modules for handwritten text generation

Open sukumar-v opened this issue 5 years ago • 6 comments

$ trdg -c 3 -w 5 -f 64 -b 1 -hw        
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/sukumar/miniconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Missing modules for handwritten text generation.
  0%|                                                                                                                                                                                                                                       | 0/3 [00:00<?, ?it/s]multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/sukumar/miniconda3/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/sukumar/miniconda3/lib/python3.7/site-packages/trdg/data_generator.py", line 21, in generate_from_tuple
    cls.generate(*t)
  File "/home/sukumar/miniconda3/lib/python3.7/site-packages/trdg/data_generator.py", line 65, in generate
    image, mask = handwritten_text_generator.generate(text, text_color)
NameError: name 'handwritten_text_generator' is not defined
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/sukumar/miniconda3/bin/trdg", line 8, in <module>
    sys.exit(main())
  File "/home/sukumar/miniconda3/lib/python3.7/site-packages/trdg/run.py", line 432, in main
    total=args.count,
  File "/home/sukumar/miniconda3/lib/python3.7/site-packages/tqdm/std.py", line 1081, in __iter__
    for obj in iterable:
  File "/home/sukumar/miniconda3/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
NameError: name 'handwritten_text_generator' is not defined
  0%|  

sukumar-v avatar May 16 '20 23:05 sukumar-v

@sukumar-varma
Is this error solved? Do you get solution?

sushant097 avatar Aug 08 '20 09:08 sushant097

Hi! This was never an error, it's my bad that I didn't answer.

To use handwritten text generation, you will need Tensorflow and a few more requirements that are not in the basic requirements.txt because it would slow down the overwhelming majority of users who don't use it.

The error will go away if you install the dependencies listed here: https://github.com/Belval/TextRecognitionDataGenerator/blob/master/requirements-hw.txt

Belval avatar Aug 10 '20 13:08 Belval

@Belval Thanks for your answer. But the error remains the same after installing requirements-hw.txt. I want to generate handwritten based on text extract from Wikipedia and save generated handwritten images and labels. I follow the exact documentation but not get around. I am using python 3.7. I think NameError: name 'handwritten_text_generator' is not defined Error says that this module not defined or combine properly. If any more hint, it would be more helpful.

sushant097 avatar Aug 11 '20 12:08 sushant097

Hi, I had the same issue. I manually installed opt-einsum and astunparse , that fixed things.

ronin0304 avatar Feb 21 '21 08:02 ronin0304

Hi everyone! I'm using python 3.7, I installed all the librearies included in "requirements-hw.txt" and also opt-einsum and astunparse but the error still remains (NameError: name 'handwritten_text_generator' is not defined)

Any suggestions? thank you all!!

riccardoregnicoli avatar Nov 08 '22 16:11 riccardoregnicoli

Hi everyone! I'm using python 3.7, I installed all the librearies included in "requirements-hw.txt" and also opt-einsum and astunparse but the error still remains (NameError: name 'handwritten_text_generator' is not defined)

Any suggestions? thank you all!!

you should goto your current pyhton site-packages path/trdg-1.7.0-py3.6.egg/trdg/ edit data_generator.py Replace from trdg import computer_text_generator, background_generator, distorsion_generator as from trdg import computer_text_generator, background_generator, distorsion_generator, handwritten_text_generator

xuyuan-hub avatar Feb 20 '23 07:02 xuyuan-hub