{"id":1568,"date":"2024-10-16T18:49:30","date_gmt":"2024-10-16T10:49:30","guid":{"rendered":"https:\/\/www.madbull.site\/?p=1568"},"modified":"2024-10-17T14:20:08","modified_gmt":"2024-10-17T06:20:08","slug":"cnocr%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/www.madbull.site\/?p=1568","title":{"rendered":"cnocr\u5b89\u88c5"},"content":{"rendered":"\n<p>CnOCR \u662f Python 3 \u4e0b\u7684\u6587\u5b57\u8bc6\u522b\uff08Optical Character Recognition\uff0c\u7b80\u79f0OCR\uff09\u5de5\u5177\u5305\uff0c\u652f\u6301\u7b80\u4f53\u4e2d\u6587\u3001\u7e41\u4f53\u4e2d\u6587\uff08\u90e8\u5206\u6a21\u578b\uff09\u3001\u82f1\u6587\u548c\u6570\u5b57\u7684\u5e38\u89c1\u5b57\u7b26\u8bc6\u522b\uff0c\u652f\u6301\u7ad6\u6392\u6587\u5b57\u7684\u8bc6\u522b\u3002<\/p>\n\n\n\n<p>\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/cnocr.readthedocs.io\/zh-cn\/stable\/install\/\">https:\/\/cnocr.readthedocs.io\/zh-cn\/stable\/install\/<\/a><\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>\u4e3a\u4e86\u907f\u514d\u4e00\u4e0b\u5305\u7684\u51b2\u7a81\uff0c\u53ef\u4ee5\u4f7f\u7528python\u7684\u865a\u62df\u73af\u5883\u5b89\u88c5\u6267\u884c\u3002\u865a\u62df\u73af\u5883\u4f7f\u7528\u8bf7\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=1558\">https:\/\/www.madbull.site\/?p=1558<\/a> python\u865a\u62df\u73af\u5883<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>\u5728\u6587\u7ae0 <a href=\"https:\/\/www.madbull.site\/?p=1558 python\u865a\u62df\u73af\u5883\">https:\/\/www.madbull.site\/?p=1558 <\/a>\u7684\u7b2c\u56db\u6b65\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u8fdb\u884c\u4e00\u4e9b\u5b89\u88c5\u548c\u8fd0\u884c\u4e86\u3002<\/p>\n\n\n\n<p>\u9700\u8981\u5b89\u88c5\u7684\u5305\u6709\uff1acnocr[ort-cpu]\u3001uvicorn\u3001pydantic\u3001fastapi\u3001python-multipart<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install -i https:\/\/pypi.doubanio.com\/simple --cache-dir \/data\/tmp cnocr&#91;ort-cpu]\npip install -i https:\/\/pypi.doubanio.com\/simple --cache-dir \/data\/tmp uvicorn\npip install -i https:\/\/pypi.doubanio.com\/simple --cache-dir \/data\/tmp pydantic\npip install -i https:\/\/pypi.doubanio.com\/simple --cache-dir \/data\/tmp\/ fastapi\npip install -i https:\/\/pypi.doubanio.com\/simple --cache-dir \/data\/tmp\/ python-multipart<\/code><\/pre>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>\u8fd0\u884c\uff1a<\/strong><\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>\u6307\u4ee4\uff1a<code>cnocr serve -p 3333<\/code><\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"657\" height=\"164\" src=\"https:\/\/www.madbull.site\/wp-content\/uploads\/2024\/10\/\u56fe\u7247-16.png\" alt=\"\" class=\"wp-image-1571\" srcset=\"https:\/\/www.madbull.site\/wp-content\/uploads\/2024\/10\/\u56fe\u7247-16.png 657w, https:\/\/www.madbull.site\/wp-content\/uploads\/2024\/10\/\u56fe\u7247-16-300x75.png 300w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/figure>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>systemd\u76d1\u63a7\u811a\u672c<\/strong>\uff1a<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--10);margin-bottom:var(--wp--preset--spacing--10);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=CnOcr\nWants=network-online.target\nAfter=network-online.target\n\n&#91;Service]\nType=simple\nUser=root\nGroup=root\n\nWorkingDirectory=\/data\/pyve\/py3.12\nExecStart=\/bin\/bash -c \". \/data\/pyve\/py3.12\/bin\/activate &amp;&amp; exec cnocr serve -p 2233 -H 127.0.0.1\"\n\nRestartSec=5\nRestart=always\nMemoryLimit=3G\n\n# Turn-off memory accounting by systemd, which is buggy.\nMemoryAccounting=no\n\n&#91;Install]\nWantedBy=multi-user.target<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CnOCR \u662f Python 3 \u4e0b\u7684\u6587\u5b57\u8bc6\u522b\uff08Optical Character Recognition\uff0c\u7b80\u79f0OCR\uff09\u5de5\u5177\u5305\uff0c\u652f\u6301\u7b80\u4f53\u4e2d\u6587\u3001\u7e41\u4f53\u4e2d\u6587\uff08\u90e8\u5206\u6a21\u578b\uff09\u3001\u82f1\u6587\u548c\u6570\u5b57\u7684\u5e38\u89c1\u5b57\u7b26\u8bc6\u522b\uff0c\u652f\u6301\u7ad6\u6392\u6587\u5b57\u7684\u8bc6\u522b\u3002<br \/>\n\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/cnocr.readthedocs.io\/zh-cn\/stable\/install\/<br \/>\n\u4e3a\u4e86\u907f\u514d\u4e00\u4e0b\u5305\u7684\u51b2\u7a81\uff0c\u53ef\u4ee5\u4f7f\u7528python<\/p>\n","protected":false},"author":1,"featured_media":548,"comment_status":"open","ping_status":"open","sticky":false,"template":"single-with-sidebar","format":"standard","meta":{"footnotes":""},"categories":[135,155,154],"tags":[514,515,516,142,512],"class_list":["post-1568","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-python","category-154","tag-cnocr","tag-ocr","tag-pip","tag-python","tag-virtualenv"],"_links":{"self":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/1568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1568"}],"version-history":[{"count":6,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/1568\/revisions"}],"predecessor-version":[{"id":1583,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/1568\/revisions\/1583"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/media\/548"}],"wp:attachment":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}