TensorFlow 2.0 中文手写字识别(汉字OCR)
请问出现这样的问题是什么原因,我没有改动代码,就用只是拿HWDB1.1的其中一个gnt跑了一下convert_to_tfrecord.py,而且也成功打印出数据了,可是想尝试运行一下神经网络的时候显示输入的张量数量不符合,求助一下。
E:\Anaconda\envs\py35\python.exe D:/python/program/Deep_learning/ocrcn_tf2-master/train_simple.py
['D:/python/program/Deep_learning/ocrcn_tf2-master/dataset/HWDB1.1trn_gnt.tfrecord']
INFO 02.20 14:40:40 train_simple.py:43: all characters: 3749
<RepeatDataset shapes: ((None, 64, 64, 1), (None,)), types: (tf.float32, tf.int64)>
<MapDataset shapes: {image: (None, None), label: ()}, types: {image: tf.float32, label: tf.int64}>
Traceback (most recent call last):
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\eager\context.py", line 1897, in execution_mode
yield
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\data\ops\iterator_ops.py", line 659, in _next_internal
output_shapes=self._flat_output_shapes)
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\ops\gen_dataset_ops.py", line 2479, in iterator_get_next_sync
_ops.raise_from_not_ok_status(e, name)
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\framework\ops.py", line 6606, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 4600 values, but the requested shape has 4096
[[{{node Reshape}}]] [Op:IteratorGetNextSync]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/python/program/Deep_learning/ocrcn_tf2-master/train_simple.py", line 123, in
train()
File "D:/python/program/Deep_learning/ocrcn_tf2-master/train_simple.py", line 51, in train
for data in train_dataset.take(2):
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\data\ops\iterator_ops.py", line 630, in next
return self.next()
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\data\ops\iterator_ops.py", line 674, in next
return self._next_internal()
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\data\ops\iterator_ops.py", line 665, in _next_internal
return structure.from_compatible_tensor_list(self._element_spec, ret)
File "E:\Anaconda\envs\py35\lib\contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\eager\context.py", line 1900, in execution_mode
executor_new.wait()
File "E:\Anaconda\envs\py35\lib\site-packages\tensorflow_core\python\eager\executor.py", line 67, in wait
pywrap_tensorflow.TFE_ExecutorWaitForAllPendingNodes(self._handle)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 4600 values, but the requested shape has 4096
[[{{node Reshape}}]]
Process finished with exit code 1