{"id":15027456,"url":"https://github.com/roujack/mathai","last_synced_at":"2025-05-15T18:04:16.444Z","repository":{"id":37735658,"uuid":"152852652","full_name":"Roujack/mathAI","owner":"Roujack","description":"一个拍照做题程序。输入一张包含数学计算题的图片，输出识别出的数学计算式以及计算结果。This is a mathematic expression recognition project.","archived":false,"fork":false,"pushed_at":"2020-12-13T02:14:38.000Z","size":81620,"stargazers_count":2339,"open_issues_count":15,"forks_count":565,"subscribers_count":82,"default_branch":"master","last_synced_at":"2025-04-18T14:31:59.499Z","etag":null,"topics":["compiler-principles","expression-recognition","opencv","pattern-recognition","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Roujack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-13T08:43:27.000Z","updated_at":"2025-04-17T05:57:35.000Z","dependencies_parsed_at":"2022-08-08T21:30:45.239Z","dependency_job_id":null,"html_url":"https://github.com/Roujack/mathAI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roujack%2FmathAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roujack%2FmathAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roujack%2FmathAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roujack%2FmathAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Roujack","download_url":"https://codeload.github.com/Roujack/mathAI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254394720,"owners_count":22063984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-principles","expression-recognition","opencv","pattern-recognition","tensorflow"],"created_at":"2024-09-24T20:06:27.940Z","updated_at":"2025-05-15T18:04:11.434Z","avatar_url":"https://github.com/Roujack.png","language":"Python","readme":"# mathAI\n\n一个拍照做题程序。输入一张包含数学计算题的图片，输出识别出的数学计算式以及计算结果。\n**请查看系统文档说明来运行程序。注意，这是一个半开源的项目，目前上传的版本只能处理简单的一维加减乘除算术表达式（如果想要识别更加复杂的表达式，可以参考数学公式识别的论文）。可以参考的代码是前面字符识别部分以及整个算法处理框架。**\n![image](https://github.com/Roujack/mathAI/blob/master/test.png)\n\n整个程序使用python实现，具体处理流程包括了图像预处理、字符识别、数学公式识别、数学公式语义理解、结果输出。\n\n本程序使用opencv对输入的图像进行预处理，并将字符裁剪出来再归一化成固定大小的矩阵。我在TensorFlow上实现了一个lenet5\n的卷积神经网络用来识别数学字符，训练使用CHROME数据集。对于数学公式的识别，主要是将识别出的独立的字符组织成计算机能够\n理解的数学公式（这里的数学公式就是纯字符的可求解的数学计算题）。大概的方法是使用编译原理的算符优先法和递归下降法进行实现。\n然后根据属性文法的值传递思想，将数学公式的值计算出来。最后使用python的matlibplot库把计算过程和答案打印出来。\n\n优点：这是一整套拍照做题的算法框架，同时能够处理多种多样的计算题，目前市面上还没有看到实现。OCR技术如此成熟的今天字符识别\n已经不算有挑战的东西了。\n缺点：字符空间关系判断只用了人类启发式规则，图像预处理不够鲁棒，数学公式的结构识别算法不够完美（可以考虑使用二维文法来做）。\n系统还有很大的提升空间。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froujack%2Fmathai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froujack%2Fmathai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froujack%2Fmathai/lists"}