FLming / CRNN.tf2

Convolutional Recurrent Neural Network(CRNN) for End-to-End Text Recognition - TensorFlow 2
MIT License
152 stars 56 forks source link

Invalid argument error #36

Closed whansk50 closed 2 years ago

whansk50 commented 2 years ago

I train with this code for Korean and I got this error:

(most recent call last):
  File "crnn/train.py", line 58, in <module>
    model.fit(train_ds, epochs=config['epochs'], callbacks=callbacks,
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1183, in fit
    tmp_logs = self.train_function(iterator)
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 889, in __call__
    result = self._call(*args, **kwds)
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 917, in _call
    return self._stateless_fn(*args, **kwds)  # pylint: disable=not-callable
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3023, in __call__
    return graph_function._call_flat(
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 1960, in _call_flat
    return self._build_call_outputs(self._inference_function.call(
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 591, in call
    outputs = execute.execute(
  File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: 3 root error(s) found.
  (0) Invalid argument:  data/im\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00pg; Invalid argument
     [[{{node ReadFile}}]]
     [[MultiDeviceIteratorGetNextFromShard]]
     [[RemoteCall]]
     [[IteratorGetNextAsOptional]]
     [[ReadVariableOp/_290]]
  (1) Invalid argument:  data/im\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00pg; Invalid argument
     [[{{node ReadFile}}]]
     [[MultiDeviceIteratorGetNextFromShard]]
     [[RemoteCall]]
     [[IteratorGetNextAsOptional]]
  (2) Invalid argument:  data/im\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00pg; Invalid argument
     [[{{node ReadFile}}]]
     [[MultiDeviceIteratorGetNextFromShard]]
     [[RemoteCall]]
     [[IteratorGetNextAsOptional]]
     [[replica_1/assert_equal_1/Assert/Assert/data_3/_218]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_23254]

Function call stack:
train_function -> train_function -> train_function

I think if this codes can recognize Chinese with no problem it can do other utf-8 texts too, but it can't

What is cause about this error? The difference of my data and example is file name(is Korean, ex: 가나다_453.jpg ), so is this cause about it?

FLming commented 2 years ago

Yes, the code can handle any utf-8 characters, from the error message, it seems to be the image path? Maybe you can run the dataset script first to check the iteration content of the dataset.

在 2022年6月27日,10:57,whansk50 @.***> 写道:

 I train with this code for Korean and I got this error:

(most recent call last): File "crnn/train.py", line 58, in model.fit(train_ds, epochs=config['epochs'], callbacks=callbacks, File "/home//miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1183, in fit tmp_logs = self.train_function(iterator) File "/home//miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 889, in call result = self._call(args, kwds) File "/home//miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 917, in _call return self._stateless_fn(args, kwds) # pylint: disable=not-callable File "/home//miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3023, in call return graph_function._call_flat( File "/home//miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 1960, in _call_flat return self._build_call_outputs(self._inference_function.call( File "/home//miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 591, in call outputs = execute.execute( File "/home/***/miniconda3/envs/gpu38/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.InvalidArgumentError: 3 root error(s) found. (0) Invalid argument: data/im\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00pg; Invalid argument [[{{node ReadFile}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [[IteratorGetNextAsOptional]] [[ReadVariableOp/_290]] (1) Invalid argument: data/im\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00pg; Invalid argument [[{{node ReadFile}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [[IteratorGetNextAsOptional]] (2) Invalid argument: data/im\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00pg; Invalid argument [[{{node ReadFile}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [[IteratorGetNextAsOptional]] [[replica_1/assert_equal_1/Assert/Assert/data_3/_218]] 0 successful operations. 0 derived errors ignored. [Op:__inference_train_function_23254]

Function call stack: train_function -> train_function -> train_function

I think if this codes can recognize Chinese with no problem it can do other utf-8 texts too, but it can't

What is cause about this error? The difference of my data and example is file name(is Korean, ex: 가나다_453.jpg ), so is this cause about it?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

whansk50 commented 2 years ago

Okay, I checked txt files and some lines were written wrong, so I removed them Then I saw training going with no problem It was just my mistake 😂 Thanks for reply