{"id":339334,"date":"2022-10-05T09:00:17","date_gmt":"2022-10-05T09:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=339334"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=339334","title":{"rendered":"<span>\u0414\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 EasyOCR<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/548\/cdc\/722\/548cdc7226262746b062167433dd0056.jpg\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/548\/cdc\/722\/548cdc7226262746b062167433dd0056.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c!<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u043e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f-\u043f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e EasyOCR<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e EasyOCR \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0435\u0431\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430, \u0435\u0451 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>\u2116<\/code> \u043d\u0435\u0442 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u0445 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f).<\/p>\n<h3>1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0431\u0430\u0437\u044b.<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f EasyOCR \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u0448\u0440\u0438\u0444\u0442\u043e\u043c \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <code>trdg<\/code>, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/github.com\/Belval\/TextRecognitionDataGenerator\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>p.s. \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044e \u043f\u0430\u0441\u043f\u043e\u0440\u0442\u0430, \u0438 \u0448\u0440\u0438\u0444\u0442\u043e\u0432 \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432 \u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c dataset.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/548\/a6d\/3e7\/548a6d3e79d12f4e9381c69867b3c346.jpg\" width=\"444\" height=\"43\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/548\/a6d\/3e7\/548a6d3e79d12f4e9381c69867b3c346.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/a2e\/a75\/f0e\/a2ea75f0ea40a8e7765f4271fa6f5708.jpg\" width=\"245\" height=\"40\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2e\/a75\/f0e\/a2ea75f0ea40a8e7765f4271fa6f5708.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/f0b\/c90\/82e\/f0bc9082ea9bbdbbed8f5e5c7fd2a478.jpg\" width=\"211\" height=\"40\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f0b\/c90\/82e\/f0bc9082ea9bbdbbed8f5e5c7fd2a478.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0438 \u0444\u0430\u0439\u043b <code>labels.csv<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/32a\/6b4\/c62\/32a6b4c6231d98ec86643ebe0bc6a3ac.png\" width=\"651\" height=\"229\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/32a\/6b4\/c62\/32a6b4c6231d98ec86643ebe0bc6a3ac.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0433\u0434\u0435 <code>filename<\/code> \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, <code>words<\/code> \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0430 2 \u0447\u0430\u0441\u0442\u0438 (<code>train<\/code> \u0438 <code>val<\/code>) , \u044d\u0442\u043e 2 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0444\u0430\u0439\u043b\u043e\u043c *.csv<\/p>\n<h3>2. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e.<\/h3>\n<p>   2.1. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 git: <a href=\"https:\/\/github.com\/JaidedAI\/EasyOCR\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/JaidedAI\/EasyOCR<\/a><\/p>\n<p>   2.2. \u0422\u0443\u0442 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>.\/trainer\/all_data<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442.<\/p>\n<pre><code class=\"xml\">\u251c\u2500\u2500 all_data \u2502\u00a0\u00a0 \u251c\u2500\u2500 ru_train_filtered \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 10001_1.jpg \u2502\u00a0\u00a0 \u2502\u00a0\u00a0       ... \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 labels.csv \u2502\u00a0\u00a0 \u2514\u2500\u2500 ru_val \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 10002_1.jpg \u2502\u00a0\u00a0 \u2502\u00a0\u00a0       ... \u2502\u00a0\u00a0     \u2514\u2500\u2500 labels.csv<\/code><\/pre>\n<p>   2.3. \u0414\u0430\u043b\u0435\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0443\u0436\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/drive.google.com\/file\/d\/1PIywV9_WZqNNfUIk6-bs598fX7OZTcbY\/view?usp=sharing\" rel=\"noopener noreferrer nofollow\"><u>cyrillic_g2<\/u><\/a> \u0438 \u043a\u043b\u0430\u0434\u0435\u043c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 OCR (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0444\u0430\u0439\u043b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0443\u0442 <code>~\/.EasyOCR\/model<\/code> \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>   2.4. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e 208 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0442\u043e \u043d\u0430\u0434\u043e \u0438\u0445 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c);<\/p>\n<\/li>\n<li>\n<p><code>saved_model<\/code> &#8212; \u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u043e\u0441\u044c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u044e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p><code>experi ment_name<\/code> &#8212; \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p><code>train_data, valid_data<\/code> &#8212; \u043f\u0443\u0442\u044c \u043a \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0443;<\/p>\n<\/li>\n<li>\n<p><code>num_iter<\/code> &#8212; \u043a\u043e\u043b-\u0432\u043e \u044d\u043f\u043e\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><code>valInterval<\/code>  &#8212; \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043f\u043e\u0445 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p><code>FT<\/code> &#8212; \u0440\u0435\u0436\u0438\u043c  \u0444\u0430\u0439\u043d\u0442\u044e\u043d\u043d\u0433\u0430;<\/p>\n<\/li>\n<li>\n<p><code>new_prediction<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441 \u043d\u0443\u043b\u044f \u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0443\u0442 False<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"yaml\">number: '0123456789' symbol: \"!\\\"#$%&amp;'()*+,-.\/:;&lt;=>?@[\\\\]\u2116_`{|}~ \u20ac\u20bd\" lang_char: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\u0410\u0411\u0412\u0413\u0414\u0415\u0401\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0451\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u0402\u0452\u0403\u0453\u0404\u0454\u0406\u0456\u0407\u0457\u0408\u0458\u0409\u0459\u040a\u045a\u040b\u045b\u040c\u045c\u040e\u045e\u040f\u045f\u0490\u0491\u0492\u0493\u049a\u049b\u04ae\u04af\u04b2\u04b3\u04b6\u04b7\u04c0\u04cf\u04e2\u04e3\u04e8\u04e9\u04ee\u04ef' experi ment_name: 'ru_filtered' train_data: 'all_data' valid_data: 'all_data\/val' manualSeed: 1111 workers: 6 batch_size: 64 #32  num_iter: 30000  valInterval: 200 saved_model: 'cyrillic_g2' FT: True optim: False # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - Adadelta lr: 1. beta1: 0.9 rho: 0.95 eps: 0.00000001 grad_clip: 5 #Data processing select_data: 'train' # \u044d\u0442\u043e \u043f\u0430\u043f\u043a\u0430 dataset \u0432 train_data batch_ratio: '1'  total_data_usage_ratio: 1.0 batch_max_length: 68  imgH: 64 imgW: 600 rgb: False contrast_adjust: False sensitive: True PAD: True contrast_adjust: 0.0 data_filtering_off: False # \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 Transformation: 'None' FeatureExtraction: 'VGG' SequenceModeling: 'BiLSTM' Prediction: 'CTC' num_fiducial: 20 input_channel: 1 output_channel: 256 hidden_size: 256 decode: 'greedy' new_prediction: False freeze_FeatureFxtraction: False freeze_SequenceModeling: False <\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u0430\u043a <code>custom_data_train.yaml<\/code> \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>config<\/code>.<\/p>\n<h3>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 EasyOCR<\/h3>\n<pre><code class=\"python\">!pip install utils  import os import torch.backends.cudnn as cudnn import yaml from train import train from utils import AttrDict import pandas as pd  cudnn.benchmark = True cudnn.deterministic = False  def get_config(file_path):     with open(file_path, 'r', encoding=\"utf8\") as stream:         opt = yaml.safe_load(stream)     opt = AttrDict(opt)     if opt.lang_char == 'None':         characters = ''         for data in opt['select_data'].split('-'):             csv_path = os.path.join(opt['train_data'], data, 'labels.csv')             df = pd.read_csv(csv_path, sep='^([^,]+),', engine='python', usecols=['filename', 'words'], keep_default_na=False)             all_char = ''.join(df['words'])             characters += ''.join(set(all_char))         characters = sorted(set(characters))         opt.character= ''.join(characters)     else:         opt.character = opt.number + opt.symbol + opt.lang_char     os.makedirs(f'.\/saved_models\/{opt.experiment_name}', exist_ok=True)     return opt  #\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 opt = get_config(\"config\/custom_data_train.yaml\") train(opt, amp=False)   <\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 EasyOCR<\/h3>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <a href=\"https:\/\/github.com\/JaidedAI\/EasyOCR\/releases\/download\/v1.4\/custom_example.zip\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/a>, \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b custom_example.py , custom_example.yaml \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 custom_EasyOCR (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = ~\/.EasyOCR\/user_network) \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 custom_example.pth (\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c) \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 model (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = ~\/.EasyOCR\/model) \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0441\u0435 3 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c custom_example <\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u0432\u0441\u0435 3 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0438\u043c\u044f.<\/p>\n<\/blockquote>\n<pre><code class=\"python\">reader = easyocr.Reader(['ru'],                         model_storage_directory='custom_EasyOCR\/model',                         user_network_directory='custom_EasyOCR\/user_network',                         recog_network='custom_example') <\/code><\/pre>\n<h3>\u041b\u0430\u0439\u0444\u0445\u0430\u043a\u0438 \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044e.<\/h3>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432 \u043e\u0442\u0442\u0435\u043d\u043a\u0438 \u0441\u0435\u0440\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">result = reader.readtext(image, allowlist='\u0410\u0411\u0412\u0413\u0414\u0415\u0401\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f-')<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u041d\u0430 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0441\u0442\u0440\u043e\u043a\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/691598\/\"> https:\/\/habr.com\/ru\/post\/691598\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c!<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u043e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f-\u043f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e EasyOCR<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e EasyOCR \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0435\u0431\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430, \u0435\u0451 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>\u2116<\/code> \u043d\u0435\u0442 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u0445 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f).<\/p>\n<h3>1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0431\u0430\u0437\u044b.<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f EasyOCR \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u0448\u0440\u0438\u0444\u0442\u043e\u043c \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <code>trdg<\/code>, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/github.com\/Belval\/TextRecognitionDataGenerator\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>p.s. \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044e \u043f\u0430\u0441\u043f\u043e\u0440\u0442\u0430, \u0438 \u0448\u0440\u0438\u0444\u0442\u043e\u0432 \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432 \u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c dataset.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0438 \u0444\u0430\u0439\u043b <code>labels.csv<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0433\u0434\u0435 <code>filename<\/code> \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, <code>words<\/code> \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0430 2 \u0447\u0430\u0441\u0442\u0438 (<code>train<\/code> \u0438 <code>val<\/code>) , \u044d\u0442\u043e 2 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0444\u0430\u0439\u043b\u043e\u043c *.csv<\/p>\n<h3>2. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e.<\/h3>\n<p>   2.1. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 git: <a href=\"https:\/\/github.com\/JaidedAI\/EasyOCR\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/JaidedAI\/EasyOCR<\/a><\/p>\n<p>   2.2. \u0422\u0443\u0442 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>.\/trainer\/all_data<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442.<\/p>\n<pre><code class=\"xml\">\u251c\u2500\u2500 all_data \u2502\u00a0\u00a0 \u251c\u2500\u2500 ru_train_filtered \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 10001_1.jpg \u2502\u00a0\u00a0 \u2502\u00a0\u00a0       ... \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 labels.csv \u2502\u00a0\u00a0 \u2514\u2500\u2500 ru_val \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 10002_1.jpg \u2502\u00a0\u00a0 \u2502\u00a0\u00a0       ... \u2502\u00a0\u00a0     \u2514\u2500\u2500 labels.csv<\/code><\/pre>\n<p>   2.3. \u0414\u0430\u043b\u0435\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0443\u0436\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/drive.google.com\/file\/d\/1PIywV9_WZqNNfUIk6-bs598fX7OZTcbY\/view?usp=sharing\" rel=\"noopener noreferrer nofollow\"><u>cyrillic_g2<\/u><\/a> \u0438 \u043a\u043b\u0430\u0434\u0435\u043c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 OCR (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0444\u0430\u0439\u043b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0443\u0442 <code>~\/.EasyOCR\/model<\/code> \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>   2.4. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e 208 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0442\u043e \u043d\u0430\u0434\u043e \u0438\u0445 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c);<\/p>\n<\/li>\n<li>\n<p><code>saved_model<\/code> &#8212; \u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u043e\u0441\u044c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u044e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p><code>experi ment_name<\/code> &#8212; \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p><code>train_data, valid_data<\/code> &#8212; \u043f\u0443\u0442\u044c \u043a \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0443;<\/p>\n<\/li>\n<li>\n<p><code>num_iter<\/code> &#8212; \u043a\u043e\u043b-\u0432\u043e \u044d\u043f\u043e\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><code>valInterval<\/code>  &#8212; \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043f\u043e\u0445 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p><code>FT<\/code> &#8212; \u0440\u0435\u0436\u0438\u043c  \u0444\u0430\u0439\u043d\u0442\u044e\u043d\u043d\u0433\u0430;<\/p>\n<\/li>\n<li>\n<p><code>new_prediction<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441 \u043d\u0443\u043b\u044f \u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0443\u0442 False<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"yaml\">number: '0123456789' symbol: \"!\\\"#$%&amp;'()*+,-.\/:;&lt;=>?@[\\\\]\u2116_`{|}~ \u20ac\u20bd\" lang_char: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\u0410\u0411\u0412\u0413\u0414\u0415\u0401\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0451\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u0402\u0452\u0403\u0453\u0404\u0454\u0406\u0456\u0407\u0457\u0408\u0458\u0409\u0459\u040a\u045a\u040b\u045b\u040c\u045c\u040e\u045e\u040f\u045f\u0490\u0491\u0492\u0493\u049a\u049b\u04ae\u04af\u04b2\u04b3\u04b6\u04b7\u04c0\u04cf\u04e2\u04e3\u04e8\u04e9\u04ee\u04ef' experi ment_name: 'ru_filtered' train_data: 'all_data' valid_data: 'all_data\/val' manualSeed: 1111 workers: 6 batch_size: 64 #32  num_iter: 30000  valInterval: 200 saved_model: 'cyrillic_g2' FT: True optim: False # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - Adadelta lr: 1. beta1: 0.9 rho: 0.95 eps: 0.00000001 grad_clip: 5 #Data processing select_data: 'train' # \u044d\u0442\u043e \u043f\u0430\u043f\u043a\u0430 dataset \u0432 train_data batch_ratio: '1'  total_data_usage_ratio: 1.0 batch_max_length: 68  imgH: 64 imgW: 600 rgb: False contrast_adjust: False sensitive: True PAD: True contrast_adjust: 0.0 data_filtering_off: False # \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 Transformation: 'None' FeatureExtraction: 'VGG' SequenceModeling: 'BiLSTM' Prediction: 'CTC' num_fiducial: 20 input_channel: 1 output_channel: 256 hidden_size: 256 decode: 'greedy' new_prediction: False freeze_FeatureFxtraction: False freeze_SequenceModeling: False <\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u0430\u043a <code>custom_data_train.yaml<\/code> \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>config<\/code>.<\/p>\n<h3>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 EasyOCR<\/h3>\n<pre><code class=\"python\">!pip install utils  import os import torch.backends.cudnn as cudnn import yaml from train import train from utils import AttrDict import pandas as pd  cudnn.benchmark = True cudnn.deterministic = False  def get_config(file_path):     with open(file_path, 'r', encoding=\"utf8\") as stream:         opt = yaml.safe_load(stream)     opt = AttrDict(opt)     if opt.lang_char == 'None':         characters = ''         for data in opt['select_data'].split('-'):             csv_path = os.path.join(opt['train_data'], data, 'labels.csv')             df = pd.read_csv(csv_path, sep='^([^,]+),', engine='python', usecols=['filename', 'words'], keep_default_na=False)             all_char = ''.join(df['words'])             characters += ''.join(set(all_char))         characters = sorted(set(characters))         opt.character= ''.join(characters)     else:         opt.character = opt.number + opt.symbol + opt.lang_char     os.makedirs(f'.\/saved_models\/{opt.experiment_name}', exist_ok=True)     return opt  #\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 opt = get_config(\"config\/custom_data_train.yaml\") train(opt, amp=False)   <\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 EasyOCR<\/h3>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <a href=\"https:\/\/github.com\/JaidedAI\/EasyOCR\/releases\/download\/v1.4\/custom_example.zip\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/a>, \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b custom_example.py , custom_example.yaml \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 custom_EasyOCR (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = ~\/.EasyOCR\/user_network) \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 custom_example.pth (\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c) \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 model (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = ~\/.EasyOCR\/model) \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0441\u0435 3 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c custom_example <\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u0432\u0441\u0435 3 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0438\u043c\u044f.<\/p>\n<\/blockquote>\n<pre><code class=\"python\">reader = easyocr.Reader(['ru'],                         model_storage_directory='custom_EasyOCR\/model',                         user_network_directory='custom_EasyOCR\/user_network',                         recog_network='custom_example') <\/code><\/pre>\n<h3>\u041b\u0430\u0439\u0444\u0445\u0430\u043a\u0438 \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044e.<\/h3>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432 \u043e\u0442\u0442\u0435\u043d\u043a\u0438 \u0441\u0435\u0440\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">result = reader.readtext(image, allowlist='\u0410\u0411\u0412\u0413\u0414\u0415\u0401\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f-')<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u041d\u0430 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0441\u0442\u0440\u043e\u043a\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/691598\/\"> https:\/\/habr.com\/ru\/post\/691598\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-339334","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=339334"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339334\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=339334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=339334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=339334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}