能运行加减测试 但是除法不能测试
修改main.py
将第22行original_img, binary_img = read_img_and_convert_to_binary('./testImgs/easy div/25.jpg')后无法通过测试
错误提示
(cv3) G:\mathAI\系统代码(code)>python main.py C:\Users\Administrator\.conda\envs\cv3\lib\site-packages\tensorflow\python\framework\dtypes.py:458: 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)]) C:\Users\Administrator\.conda\envs\cv3\lib\site-packages\tensorflow\python\framework\dtypes.py:459: 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)]) C:\Users\Administrator\.conda\envs\cv3\lib\site-packages\tensorflow\python\framework\dtypes.py:460: 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)]) C:\Users\Administrator\.conda\envs\cv3\lib\site-packages\tensorflow\python\framework\dtypes.py:461: 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)]) C:\Users\Administrator\.conda\envs\cv3\lib\site-packages\tensorflow\python\framework\dtypes.py:462: 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)]) C:\Users\Administrator\.conda\envs\cv3\lib\site-packages\tensorflow\python\framework\dtypes.py:465: 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)]) INFO:tensorflow:Using default config. INFO:tensorflow:Using config: {'_model_dir': './my_cnn_model_config5', '_tf_random_seed': 1, '_save_summary_steps': 100, '_save_checkpoints_secs': 600, '_save_checkpoints_steps': None, '_session_config': None, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000} 2020-07-20 17:55:06.593325: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.604402: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.614630: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.634000: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.645301: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.656658: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.684921: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2020-07-20 17:55:06.697061: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. INFO:tensorflow:Restoring parameters from ./my_cnn_model_config5\model.ckpt-16000 <generator object Estimator.predict at 0x000001F0EC80BD58> INFO:tensorflow:Restoring parameters from ./my_cnn_model_config5\model.ckpt-16000 排序前的字符列表 [{'location': (54, 42, 84, 105), 'candidates': [{'symbol': '4', 'probability': 0.9998342}]}, {'location': (197, 47, 18, 23), 'candidates': [{'symbol': 'times', 'probability': 0.98560405}]}, {'location': (162, 84, 81, 13), 'candidates': [{'symbol': '-', 'probability': 0.9998073}]}, {'location': (198, 105, 23, 26), 'candidates': [{'symbol': 'times', 'probability': 0.9965108}]}, {'location': (260, 56, 53, 75), 'candidates': [{'symbol': '2', 'probability': 0.99996924}]}] 排序后的字符序列 [[(54, 42, 84, 105), [{'symbol': '4', 'probability': 0.9998342}]], [(197, 47, 18, 23), [{'symbol': 'times', 'probability': 0.98560405}]], [(162, 84, 81, 13), [{'symbol': '-', 'probability': 0.9998073}]], [(198, 105, 23, 26), [{'symbol': 'times', 'probability': 0.9965108}]], [(260, 56, 53, 75), [{'symbol': '2', 'probability': 0.99996924}]]] 识别出的token [{'location': [54, 42, 84, 105], 'token_string': '4', 'token_type': 1}, {'location': [197, 47, 18, 23], 'token_string': 'times', 'token_type': 0}, {'location': [162, 84, 81, 13], 'token_string': 'f', 'token_type': 0}, {'location': [198, 105, 23, 26], 'token_string': 'times', 'token_type': 0}, {'location': [260, 56, 53, 75], 'token_string': '2', 'token_type': 1}] {'structure': [{'structure': [{'structure': 4, 'type': 2, 'location': [54, 42, 84, 105]}, {'structure': ['times', {'structure': 'f', 'type': 15, 'location': [162, 84, 81, 13]}, {'structure': ['times', {'structure': 2, 'type': 2, 'location': [260, 56, 53, 75]}], 'type': 5}], 'type': 5}], 'type': 6}], 'type': 8} Traceback (most recent call last): File "main.py", line 73, in <module> latex_str = post_order(parser_tree) File "G:\mathAI\系统代码(code)\calculator\__init__.py", line 278, in post_order t = post_order(child[0]) File "G:\mathAI\系统代码(code)\calculator\__init__.py", line 206, in post_order t_pi = post_order(child[1]) File "G:\mathAI\系统代码(code)\calculator\__init__.py", line 170, in post_order node['status'] = max(child[1]['status'],child[2]['status']) KeyError: 'status'