Comments (10)
@hiepph you may write your own version of char_dict.txt in data/char_dict folder and use the scripts in tools to establish a new map json file. The json file char_dict.json is used to map origin character to its unicode coding, the rest json files are used to map the unicode coding to the label index which is used to compute the ctc loss
from crnn_tensorflow.
What exactly the format of char_dict.txt
? Is it the same with char_dict.json
?
And besides, what scripts in tools
to generate JSON files from char_dict.txt
. I don't see it anywhere on your README or your code..
from crnn_tensorflow.
@hiepph The char_dict.txt is the file contains the character you want to recognize. You are supposed to write each character in a single line in the char_dict.txt and then use the tools/establish_char_dict.py to generate the json file.
from crnn_tensorflow.
Sorry, tools/establish_char_dict.py
doesn't exist.
If you mean local_utils/establish_char_dict.py
, as I see this is just a module, not a script for taking a file input and output JSON files.
from crnn_tensorflow.
@hiepph Sorry I put the scripts in chinese_version_debug branch you may see it when you check out the branch ==!
from crnn_tensorflow.
In branch chinese_version_debug
: Everything was okay with char_dict.txt
, I ran establish_char_dict.py
and had char_dict.json
stuff. I provided sample.txt
and ran write_text_tfrecords.py
and had train data.
But when I ran:
python tools/train_shadownet_subnet.py --dataset_dir path/to/my/tfrecords
It showed this error:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 498, in make_tensor_proto
str_values = [compat.as_bytes(x) for x in proto_values]
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 498, in <listcomp>
str_values = [compat.as_bytes(x) for x in proto_values]
File "/usr/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 66, in as_bytes
(bytes_or_text,))
TypeError: Expected binary or unicode string, got <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x7f68cb31a630>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train_shadownet_subnet.py", line 157, in <module>
train_shadownet(args.dataset_dir, args.weights_path)
File "train_shadownet_subnet.py", line 65, in train_shadownet
tf.argmax(input_labels, 1))
File "/usr/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 316, in new_func
return func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 211, in argmax
return gen_math_ops.arg_max(input, axis, name=name, output_type=output_type)
File "/usr/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 472, in arg_max
name=name)
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 513, in _apply_op_helper
raise err
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 510, in _apply_op_helper
preferred_dtype=default_dtype)
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1013, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 233, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 212, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 502, in make_tensor_proto
"supported type." % (type(values), values))
TypeError: Failed to convert object of type <class 'tensorflow.python.framework.sparse_tensor.SparseTensor'> to Tensor. Contents: SparseTensor(indices=Tensor("shuffle_batch/control_dependency_1:0", shape=(?, 2), dtype=int64), values=Tensor("shuffle_batch/control_dependency_2:0", shape=(?,), dtype=int32), dense_shape=Tensor("shuffle_batch/control_dependency_3:0", shape=(2,), dtype=int64)). Consider casting elements to a TypeError: Failed to convert object of type <class 'tensorflow.python.framework.sparse_tensor.SparseTensor'> to Tensor. Contents: SparseTensor(indices=Tensor("shuffle_batch/control_dependency_1:0", shape=(?, 2), dtype=int64), values=Tensor("shuffle_batch/control_dependency_2:0", shape=(?,), dtype=int32), dense_shape=Tensor("shuffle_batch/control_dependency_3:0", shape=(2,), dtype=int64)). Consider casting elements to a supported type.supported type.
As I see, it had error on this line on tools/train_shadownet_subnet.py
:
File "train_shadownet_subnet.py", line 65, in train_shadownet
tf.argmax(input_labels, 1))
with following log:
TypeError: Failed to convert object of type <class 'tensorflow.python.framework.sparse_tensor.SparseTensor'> to Tensor. Contents: SparseTensor(indices=Tensor("shuffle_batch/control_dependency_1:0", shape=(?, 2), dtype=int64), values=Tensor("shuffle_batch/control_dependency_2:0", shape=(?,), dtype=int32), dense_shape=Tensor("shuffle_batch/control_dependency_3:0", shape=(2,), dtype=int64)). Consider casting elements to a supported type.
What went wrong? How can I fix this?
from crnn_tensorflow.
@hiepph You should use train_shadownet.py to train the crnn model. I am so sorry that i have not got to much time to clear up the repo, the train_shadow_subnet.py is used for another program which you can ignore. Once I have enough time i will clear up the messy repo and pull again.
from crnn_tensorflow.
After generating char_dict.json
, I check out again master
branch keeping char_dict.json
and move index_2_ord_map.json
to ord_map.json
, follow your README and everything went out OK.
Thank you for your supporting, hope you will release the new version soon. I'll close the issue for now.
from crnn_tensorflow.
@hiepph Once I have time I will clear this up. You are welcomed to keep me informed of any mistake.
from crnn_tensorflow.
Hi,i can't find chinese_version_debug branch ,and local_utils/establish_char_dict.py can't convert to json files,can you show me the content of establish_char_dict.py?or send me this file? thank you very much.
from crnn_tensorflow.
Related Issues (20)
- getting this error while trying to train model HOT 8
- Could you upload Chinese data to other drive beside Baidu? HOT 1
- https://www.dropbox.com/sh/y4eaunamardibnd/AAB4h8NkakASDoc6Ek4knEGIa?dl=0 这个链接打不开啊 求助中文模型 HOT 1
- 固定label shape后训练loss比较高 HOT 6
- Val generator get next error HOT 8
- How to batch inference using grpc? HOT 6
- STR with lexicons supplied at runtime HOT 4
- Are the results from the pretrained model on real world images supposed to be poor? HOT 2
- Train on other languages like Farsi HOT 1
- 自己训练的模型预测结果完全不对 HOT 4
- python tools/test_shadownet.py --weights_path ./model/crnn_synth90k --char_dict_path ./data/test_images/char_dict/char_dict_en.json --ord_map_dict_path ./data/test_images/char_dict/ord_map_en.json --visualize 1 HOT 2
- evaluate_shadownet.py 发现标签不正确的问题 HOT 4
- the predict text is longer than the labeled text HOT 5
- error on Windows HOT 1
- ModuleNotFoundError: No module named 'crnn_model' HOT 2
- 训练所使用的数据集 HOT 4
- 在进行单张测试时遇到的问题
- 该如何对其他数据集进行测试? HOT 1
- recongnize_chinese_pdf.py报错 HOT 1
- 固化模型为pb文件的时候,单张图片推理速度为5S。 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crnn_tensorflow.